Skip to content

Commit 0fbc9d4

Browse files
committed
rebase to Chromium 58
1 parent a9ba0b0 commit 0fbc9d4

File tree

7 files changed

+14
-29
lines changed

7 files changed

+14
-29
lines changed

src/api/menu/menu_views.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ void Menu::UpdateKeys(views::FocusManager *focus_manager){
148148
return ;
149149
} else {
150150
focus_manager_ = focus_manager;
151-
for(auto item : menu_items_) {
151+
for(auto* item : menu_items_) {
152152
item->UpdateKeys(focus_manager);
153153
}
154154
}
@@ -157,7 +157,7 @@ void Menu::UpdateKeys(views::FocusManager *focus_manager){
157157
void Menu::RemoveKeys() {
158158
if (!focus_manager_) return;
159159

160-
for(auto item: menu_items_) {
160+
for(auto* item: menu_items_) {
161161
item->RemoveKeys();
162162
}
163163

src/api/nw_window_api.cc

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#include "base/base64.h"
44
#include "base/strings/stringprintf.h"
55
#include "base/strings/utf_string_conversions.h"
6+
#include "base/threading/sequenced_worker_pool.h"
67
#include "content/public/browser/render_widget_host.h"
78
#include "chrome/browser/devtools/devtools_window.h"
89
#include "chrome/browser/extensions/devtools_util.h"
@@ -225,27 +226,13 @@ bool NwCurrentWindowInternalCapturePageInternalFunction::RunAsync() {
225226

226227
// TODO(miu): Account for fullscreen render widget? http://crbug.com/419878
227228
RenderWidgetHostView* const view = contents->GetRenderWidgetHostView();
228-
RenderWidgetHost* const host = view ? view->GetRenderWidgetHost() : nullptr;
229-
if (!view || !host) {
229+
if (!view) {
230230
OnCaptureFailure(FAILURE_REASON_VIEW_INVISIBLE);
231231
return false;
232232
}
233233

234-
// By default, the requested bitmap size is the view size in screen
235-
// coordinates. However, if there's more pixel detail available on the
236-
// current system, increase the requested bitmap size to capture it all.
237-
const gfx::Size view_size = view->GetViewBounds().size();
238-
gfx::Size bitmap_size = view_size;
239-
const gfx::NativeView native_view = view->GetNativeView();
240-
display::Screen* const screen = display::Screen::GetScreen();
241-
const float scale =
242-
screen->GetDisplayNearestWindow(native_view).device_scale_factor();
243-
if (scale > 1.0f)
244-
bitmap_size = gfx::ScaleToCeiledSize(view_size, scale);
245-
246-
host->CopyFromBackingStore(
247-
gfx::Rect(view_size),
248-
bitmap_size,
234+
view->CopyFromSurface(gfx::Rect(), // Copy entire surface area.
235+
gfx::Size(), // Result contains device-level detail.
249236
base::Bind(&NwCurrentWindowInternalCapturePageInternalFunction::CopyFromBackingStoreComplete,
250237
this),
251238
kN32_SkColorType);
@@ -708,7 +695,7 @@ bool NwCurrentWindowInternalGetWinParamInternalFunction::RunNWSync(base::ListVal
708695
int frame_id = created_frame->GetRoutingID();
709696

710697
base::DictionaryValue* result = new base::DictionaryValue;
711-
result->Set("frameId", new base::FundamentalValue(frame_id));
698+
result->Set("frameId", new base::Value(frame_id));
712699
result->Set("id", new base::StringValue(app_window->window_key()));
713700
app_window->GetSerializedState(result);
714701

src/api/object_manager.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ void ObjectManager::SendEvent(Base* object,
228228
if (!event_router)
229229
return;
230230
std::unique_ptr<base::ListValue> arguments(args.DeepCopy());
231-
arguments->Insert(0, base::WrapUnique(new base::FundamentalValue(object->id())));
231+
arguments->Insert(0, base::WrapUnique(new base::Value(object->id())));
232232
std::unique_ptr<Event> event(new Event(extensions::events::UNKNOWN, "NWObject" + event_name, std::move(arguments)));
233233
event->restrict_to_browser_context = browser_context_;
234234
event->user_gesture = EventRouter::USER_GESTURE_ENABLED;

src/browser/menubar_controller.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ MenuBarController::MenuBarController(MenuBarView* menubar, ui::MenuModel* menu_m
2424

2525
MenuBarController::~MenuBarController() {
2626
if (master_ == this) {
27-
for (auto ctr : controllers_)
27+
for (auto* ctr : controllers_)
2828
delete ctr;
2929
model_to_menu_map_.clear();
3030
}

src/nw_custom_bindings.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ void NWCustomBindings::EvalScript(
203203
base::string16 jscript = *v8::String::Value(args[1]);
204204
#endif
205205
if (web_frame) {
206-
result = web_frame->executeScriptAndReturnValue(blink::WebScriptSource(jscript));
206+
result = web_frame->executeScriptAndReturnValue(blink::WebScriptSource(blink::WebString::fromUTF16(jscript)));
207207
}
208208
args.GetReturnValue().Set(result);
209209
return;

src/nw_version.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222
#define NW_VERSION_H
2323

2424
#define NW_MAJOR_VERSION 0
25-
#define NW_MINOR_VERSION 21
26-
#define NW_PATCH_VERSION 6
25+
#define NW_MINOR_VERSION 22
26+
#define NW_PATCH_VERSION 0
2727

2828
#define NW_VERSION_IS_RELEASE 1
2929

src/renderer/nw_extensions_renderer_hooks.cc

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -381,13 +381,12 @@ void TryInjectStartScript(blink::WebLocalFrame* frame, const Extension* extensio
381381
//LOG(WARNING) << "Failed to load js script file: " << js_file.value();
382382
return;
383383
}
384-
base::string16 jscript = base::UTF8ToUTF16(content);
385384
if (!v8_context.IsEmpty()) {
386385
v8::MicrotasksScope microtasks(v8::Isolate::GetCurrent(), v8::MicrotasksScope::kDoNotRunMicrotasks);
387386
blink::ScriptForbiddenScope::AllowUserAgentScript script;
388387
v8::Context::Scope cscope(v8_context);
389388
// v8::Handle<v8::Value> result;
390-
frame->executeScriptAndReturnValue(WebScriptSource(jscript));
389+
frame->executeScriptAndReturnValue(WebScriptSource(blink::WebString::fromUTF8(content)));
391390
}
392391
}
393392

@@ -474,11 +473,10 @@ void DocumentElementHook(blink::WebLocalFrame* frame,
474473
resource_bundle->GetRawDataResource(IDR_NW_PRE13_SHIM_JS);
475474
if (resource.empty())
476475
return;
477-
base::string16 jscript = base::UTF8ToUTF16(resource.as_string());
478476
if (!v8_context.IsEmpty()) {
479477
v8::MicrotasksScope microtasks(v8::Isolate::GetCurrent(), v8::MicrotasksScope::kDoNotRunMicrotasks);
480478
v8::Context::Scope cscope(v8_context);
481-
frame->executeScriptAndReturnValue(WebScriptSource(jscript));
479+
frame->executeScriptAndReturnValue(WebScriptSource(blink::WebString::fromUTF8(resource.as_string())));
482480
}
483481
}
484482

0 commit comments

Comments
 (0)