Skip to content

Commit c2f53c9

Browse files
GnorTechrogerwang
authored andcommitted
rebase to Chromium 56
1 parent c499640 commit c2f53c9

File tree

7 files changed

+21
-24
lines changed

7 files changed

+21
-24
lines changed

src/api/BUILD.gn

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Use of this source code is governed by a BSD-style license that can be
33
# found in the LICENSE file.
44

5-
import("//build/json_schema_api.gni")
5+
import("//tools/json_schema_compiler/json_schema_api.gni")
66
import("//tools/json_schema_compiler/json_features.gni")
77
import("schemas.gni")
88

src/api/nw_screen_api.cc

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@
2020
#include "content/public/browser/render_process_host.h"
2121
#include "content/public/browser/web_contents.h"
2222
#include "third_party/webrtc/modules/desktop_capture/desktop_capture_options.h"
23-
#include "third_party/webrtc/modules/desktop_capture/screen_capturer.h"
24-
#include "third_party/webrtc/modules/desktop_capture/window_capturer.h"
23+
#include "third_party/webrtc/modules/desktop_capture/desktop_capturer.h"
2524
#include "ui/gfx/codec/png_codec.h"
2625
#include "ui/gfx/image/image.h"
2726
#include "ui/gfx/image/image_skia.h"
@@ -205,8 +204,8 @@ namespace extensions {
205204

206205
webrtc::DesktopCaptureOptions options = webrtc::DesktopCaptureOptions::CreateDefault();
207206
options.set_disable_effects(false);
208-
std::unique_ptr<webrtc::ScreenCapturer> screenCapturer(screens ? webrtc::ScreenCapturer::Create(options) : nullptr);
209-
std::unique_ptr<webrtc::WindowCapturer> windowCapturer(windows ? webrtc::WindowCapturer::Create(options) : nullptr);
207+
std::unique_ptr<webrtc::DesktopCapturer> screenCapturer(screens ? webrtc::DesktopCapturer::CreateScreenCapturer(options) : nullptr);
208+
std::unique_ptr<webrtc::DesktopCapturer> windowCapturer(windows ? webrtc::DesktopCapturer::CreateWindowCapturer(options) : nullptr);
210209

211210
media_list_.reset(new NativeDesktopMediaList(std::move(screenCapturer), std::move(windowCapturer)));
212211

src/api/nw_window_api.cc

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#include "content/public/browser/render_widget_host.h"
77
#include "chrome/browser/devtools/devtools_window.h"
88
#include "chrome/browser/extensions/devtools_util.h"
9+
#include "chrome/browser/ui/webui/print_preview/printer_backend_proxy.h"
910
#include "components/zoom/zoom_controller.h"
1011
#include "content/nw/src/api/menu/menu.h"
1112
#include "content/nw/src/api/object_manager.h"
@@ -23,7 +24,6 @@
2324
#include "ui/display/display.h"
2425
#include "ui/gfx/geometry/size_conversions.h"
2526
#include "ui/display/screen.h"
26-
2727
#include "content/nw/src/api/nw_current_window_internal.h"
2828

2929
#if defined(OS_WIN)
@@ -41,7 +41,7 @@
4141
#endif
4242

4343
#if defined(OS_LINUX)
44-
#include "chrome/browser/ui/libgtk2ui/gtk2_ui.h"
44+
#include "chrome/browser/ui/libgtkui/gtk_ui.h"
4545
#endif
4646

4747
#if defined(OS_LINUX) || defined(OS_WIN)
@@ -631,20 +631,16 @@ bool NwCurrentWindowInternalSetTitleInternalFunction::RunNWSync(base::ListValue*
631631
}
632632

633633
bool NwCurrentWindowInternalGetPrintersFunction::RunAsync() {
634-
base::ListValue* results = new base::ListValue;
635-
content::BrowserThread::PostTaskAndReply(
636-
content::BrowserThread::FILE, FROM_HERE,
637-
base::Bind(&chrome::EnumeratePrintersOnBlockingPoolThread,
638-
base::Unretained(results)),
634+
printing::EnumeratePrinters(Profile::FromBrowserContext(browser_context()),
639635
base::Bind(&NwCurrentWindowInternalGetPrintersFunction::OnGetPrinterList,
640-
this,
641-
base::Unretained(results)));
636+
this));
642637
return true;
643638
}
644639

645-
void NwCurrentWindowInternalGetPrintersFunction::OnGetPrinterList(base::ListValue* results) {
646-
std::unique_ptr<base::ListValue> printers(results);
647-
SetResult(std::move(printers));
640+
void NwCurrentWindowInternalGetPrintersFunction::OnGetPrinterList(const printing::PrinterList& printer_list) {
641+
base::ListValue* printers = new base::ListValue();
642+
chrome::PrintersToValues(printer_list, printers);
643+
SetResult(base::WrapUnique(printers));
648644
SendResponse(true);
649645
}
650646

src/api/nw_window_api.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#include "content/public/browser/readback_types.h"
77
#include "extensions/browser/extension_function.h"
88
#include "extensions/common/api/extension_types.h"
9+
#include "printing/backend/print_backend.h"
910

1011
class SkBitmap;
1112

@@ -285,7 +286,7 @@ class NwCurrentWindowInternalGetPrintersFunction : public AsyncExtensionFunction
285286
public:
286287
NwCurrentWindowInternalGetPrintersFunction() {}
287288
bool RunAsync() override;
288-
void OnGetPrinterList(base::ListValue* results);
289+
void OnGetPrinterList(const printing::PrinterList& printer_list);
289290
protected:
290291
~NwCurrentWindowInternalGetPrintersFunction() override {}
291292
DECLARE_EXTENSION_FUNCTION("nw.currentWindowInternal.getPrinters", UNKNOWN)

src/api/schemas.gni

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
import("//build/config/features.gni")
66
import("//build/config/ui.gni")
7+
import("//extensions/features/features.gni")
78

89
assert(enable_extensions)
910

src/nw_version.h

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

2424
#define NW_MAJOR_VERSION 0
25-
#define NW_MINOR_VERSION 19
26-
#define NW_PATCH_VERSION 6
25+
#define NW_MINOR_VERSION 20
26+
#define NW_PATCH_VERSION 0
2727

28-
#define NW_VERSION_IS_RELEASE 1
28+
#define NW_VERSION_IS_RELEASE 0
2929

3030
#ifndef NW_STRINGIFY
3131
#define NW_STRINGIFY(n) NW_STRINGIFY_HELPER(n)

src/renderer/nw_extensions_renderer_hooks.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,7 @@ void DocumentHook2(bool start, content::RenderFrame* frame, Dispatcher* dispatch
424424
web_frame->mainWorldScriptContext()->Global();
425425
arguments.push_back(v8::Boolean::New(isolate, start));
426426
arguments.push_back(window);
427-
script_context->module_system()->CallModuleMethod("nw.Window", "onDocumentStartEnd", &arguments);
427+
script_context->module_system()->CallModuleMethodSafe("nw.Window", "onDocumentStartEnd", &arguments);
428428
}
429429

430430
void DocumentElementHook(blink::WebLocalFrame* frame,
@@ -514,7 +514,7 @@ void willHandleNavigationPolicy(content::RenderView* rv,
514514
arguments.push_back(v8_str(request.url().string().utf8().c_str()));
515515
arguments.push_back(policy_obj);
516516
if (new_win) {
517-
script_context->module_system()->CallModuleMethod("nw.Window",
517+
script_context->module_system()->CallModuleMethodSafe("nw.Window",
518518
"onNewWinPolicy", &arguments);
519519
} else {
520520
const char* req_context = nullptr;
@@ -533,7 +533,7 @@ void willHandleNavigationPolicy(content::RenderView* rv,
533533
}
534534
if (req_context) {
535535
arguments.push_back(v8_str(req_context));
536-
script_context->module_system()->CallModuleMethod("nw.Window",
536+
script_context->module_system()->CallModuleMethodSafe("nw.Window",
537537
"onNavigation", &arguments);
538538
}
539539
}

0 commit comments

Comments
 (0)