From 7a89a08534f29b74af78bbf950463d63377fc9fd Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Mon, 28 Jul 2014 15:29:51 +0800 Subject: [PATCH] Update to new Chromium APIs. --- atom/browser/api/atom_api_menu_mac.mm | 3 +-- atom/browser/api/atom_api_web_contents.cc | 6 +++--- atom/browser/api/atom_api_web_contents.h | 2 +- atom/browser/api/event.cc | 2 +- atom/browser/api/event.h | 2 +- atom/browser/atom_browser_main_parts.cc | 6 +----- atom/browser/native_window.cc | 5 +---- atom/browser/native_window_mac.mm | 13 ++++++------- atom/browser/native_window_views.cc | 1 - atom/browser/ui/accelerator_util.cc | 2 +- atom/common/chrome_version.h | 2 +- atom/renderer/api/atom_api_renderer_ipc.cc | 6 +++--- atom/renderer/api/atom_api_web_view.cc | 4 ++-- atom/renderer/atom_render_view_observer.cc | 4 +++- atom/renderer/atom_render_view_observer.h | 2 +- docs/api/browser-window.md | 1 - vendor/brightray | 2 +- vendor/node | 2 +- 18 files changed, 28 insertions(+), 37 deletions(-) diff --git a/atom/browser/api/atom_api_menu_mac.mm b/atom/browser/api/atom_api_menu_mac.mm index 4b54a7e2f76..f5428ec487c 100644 --- a/atom/browser/api/atom_api_menu_mac.mm +++ b/atom/browser/api/atom_api_menu_mac.mm @@ -8,7 +8,6 @@ #include "base/message_loop/message_loop.h" #include "base/strings/sys_string_conversions.h" #include "content/public/browser/web_contents.h" -#include "content/public/browser/web_contents_view.h" #include "atom/common/node_includes.h" @@ -44,7 +43,7 @@ void MenuMac::Popup(Window* window) { // Show the menu. [NSMenu popUpContextMenu:[menu_controller menu] withEvent:clickEvent - forView:web_contents->GetView()->GetContentNativeView()]; + forView:web_contents->GetContentNativeView()]; } // static diff --git a/atom/browser/api/atom_api_web_contents.cc b/atom/browser/api/atom_api_web_contents.cc index 14fc69c3175..33abbcd75e9 100644 --- a/atom/browser/api/atom_api_web_contents.cc +++ b/atom/browser/api/atom_api_web_contents.cc @@ -9,6 +9,7 @@ #include "atom/common/native_mate_converters/string16_converter.h" #include "atom/common/native_mate_converters/value_converter.h" #include "base/strings/utf_string_conversions.h" +#include "content/public/browser/render_frame_host.h" #include "content/public/browser/render_process_host.h" #include "content/public/browser/render_view_host.h" #include "content/public/browser/web_contents.h" @@ -66,7 +67,7 @@ bool WebContents::OnMessageReceived(const IPC::Message& message) { return handled; } -void WebContents::WebContentsDestroyed(content::WebContents*) { +void WebContents::WebContentsDestroyed() { // The RenderViewDeleted was not called when the WebContents is destroyed. RenderViewDeleted(web_contents_->GetRenderViewHost()); Emit("destroyed"); @@ -155,8 +156,7 @@ bool WebContents::IsCrashed() const { } void WebContents::ExecuteJavaScript(const base::string16& code) { - web_contents()->GetRenderViewHost()->ExecuteJavascriptInWebFrame( - base::string16(), code); + web_contents()->GetMainFrame()->ExecuteJavaScript(code); } bool WebContents::SendIPCMessage(const base::string16& channel, diff --git a/atom/browser/api/atom_api_web_contents.h b/atom/browser/api/atom_api_web_contents.h index 36c91434d5e..4a83153bca2 100644 --- a/atom/browser/api/atom_api_web_contents.h +++ b/atom/browser/api/atom_api_web_contents.h @@ -62,7 +62,7 @@ class WebContents : public mate::EventEmitter, virtual void DidStopLoading( content::RenderViewHost* render_view_host) OVERRIDE; virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; - virtual void WebContentsDestroyed(content::WebContents*) OVERRIDE; + virtual void WebContentsDestroyed() OVERRIDE; private: // Called when received a message from renderer. diff --git a/atom/browser/api/event.cc b/atom/browser/api/event.cc index 579fa3a41dc..c97e968d1e6 100644 --- a/atom/browser/api/event.cc +++ b/atom/browser/api/event.cc @@ -36,7 +36,7 @@ void Event::SetSenderAndMessage(content::WebContents* sender, Observe(sender); } -void Event::WebContentsDestroyed(content::WebContents* web_contents) { +void Event::WebContentsDestroyed() { sender_ = NULL; message_ = NULL; } diff --git a/atom/browser/api/event.h b/atom/browser/api/event.h index b1713a4e68c..c32eb8a36aa 100644 --- a/atom/browser/api/event.h +++ b/atom/browser/api/event.h @@ -40,7 +40,7 @@ class Event : public Wrappable, virtual ObjectTemplateBuilder GetObjectTemplateBuilder(v8::Isolate* isolate); // content::WebContentsObserver implementations: - virtual void WebContentsDestroyed(content::WebContents*) OVERRIDE; + virtual void WebContentsDestroyed() OVERRIDE; private: // Replyer for the synchronous messages. diff --git a/atom/browser/atom_browser_main_parts.cc b/atom/browser/atom_browser_main_parts.cc index c141b265fd7..86d8d6b1e74 100644 --- a/atom/browser/atom_browser_main_parts.cc +++ b/atom/browser/atom_browser_main_parts.cc @@ -54,11 +54,7 @@ brightray::BrowserContext* AtomBrowserMainParts::CreateBrowserContext() { } void AtomBrowserMainParts::InitProxyResolverV8() { - // Since we are integrating node in browser, we can just be sure that an - // V8 instance would be prepared, while the ProxyResolverV8::CreateIsolate() - // would try to create a V8 isolate, which messed everything on Windows, so - // we have to override and call RememberDefaultIsolate on Windows instead. - net::ProxyResolverV8::RememberDefaultIsolate(); + brightray::BrowserMainParts::InitProxyResolverV8(); } void AtomBrowserMainParts::PostEarlyInitialization() { diff --git a/atom/browser/native_window.cc b/atom/browser/native_window.cc index bf055570bdb..4be4ac69412 100644 --- a/atom/browser/native_window.cc +++ b/atom/browser/native_window.cc @@ -38,7 +38,6 @@ #include "content/public/browser/render_process_host.h" #include "content/public/browser/render_view_host.h" #include "content/public/browser/render_widget_host_view.h" -#include "content/public/browser/web_contents_view.h" #include "content/public/common/renderer_preferences.h" #include "content/public/common/user_agent.h" #include "ipc/ipc_message_macros.h" @@ -305,7 +304,7 @@ void NativeWindow::CloseWebContents() { ScheduleUnresponsiveEvent(5000); if (web_contents->NeedToFireBeforeUnload()) - web_contents->GetMainFrame()->DispatchBeforeUnload(false); + web_contents->DispatchBeforeUnload(false); else web_contents->Close(); } @@ -356,8 +355,6 @@ void NativeWindow::OverrideWebkitPrefs(const GURL& url, WebPreferences* prefs) { prefs->experimental_webgl_enabled = b; if (web_preferences.Get("webaudio", &b)) prefs->webaudio_enabled = b; - if (web_preferences.Get("accelerated-compositing", &b)) - prefs->accelerated_compositing_enabled = b; if (web_preferences.Get("plugins", &b)) prefs->plugins_enabled = b; if (web_preferences.Get("extra-plugin-dirs", &list)) diff --git a/atom/browser/native_window_mac.mm b/atom/browser/native_window_mac.mm index 77bea46655b..e16aabdc93a 100644 --- a/atom/browser/native_window_mac.mm +++ b/atom/browser/native_window_mac.mm @@ -13,7 +13,6 @@ #include "base/strings/sys_string_conversions.h" #include "content/public/browser/native_web_keyboard_event.h" #include "content/public/browser/web_contents.h" -#include "content/public/browser/web_contents_view.h" #include "content/public/browser/render_view_host.h" #include "content/public/browser/render_widget_host_view.h" #include "native_mate/dictionary.h" @@ -56,7 +55,7 @@ static const CGFloat kAtomWindowCornerRadius = 4.0; if (!web_contents) return; - web_contents->GetView()->RestoreFocus(); + web_contents->RestoreFocus(); content::RenderWidgetHostView* rwhv = web_contents->GetRenderWidgetHostView(); if (rwhv) @@ -70,7 +69,7 @@ static const CGFloat kAtomWindowCornerRadius = 4.0; if (!web_contents) return; - web_contents->GetView()->StoreFocus(); + web_contents->StoreFocus(); content::RenderWidgetHostView* rwhv = web_contents->GetRenderWidgetHostView(); if (rwhv) @@ -492,7 +491,7 @@ gfx::NativeWindow NativeWindowMac::GetNativeWindow() { bool NativeWindowMac::IsWithinDraggableRegion(NSPoint point) const { if (!draggable_region_) return false; - NSView* webView = GetWebContents()->GetView()->GetNativeView(); + NSView* webView = GetWebContents()->GetNativeView(); NSInteger webViewHeight = NSHeight([webView bounds]); // |draggable_region_| is stored in local platform-indepdent coordiate system // while |point| is in local Cocoa coordinate system. Do the conversion @@ -581,7 +580,7 @@ void NativeWindowMac::UninstallView() { } void NativeWindowMac::ClipWebView() { - NSView* view = GetWebContents()->GetView()->GetNativeView(); + NSView* view = GetWebContents()->GetNativeView(); view.wantsLayer = YES; view.layer.masksToBounds = YES; @@ -594,7 +593,7 @@ void NativeWindowMac::InstallDraggableRegionViews() { // All ControlRegionViews should be added as children of the WebContentsView, // because WebContentsView will be removed and re-added when entering and // leaving fullscreen mode. - NSView* webView = GetWebContents()->GetView()->GetNativeView(); + NSView* webView = GetWebContents()->GetNativeView(); NSInteger webViewHeight = NSHeight([webView bounds]); // Remove all ControlRegionViews that are added last time. @@ -626,7 +625,7 @@ void NativeWindowMac::UpdateDraggableRegionsForCustomDrag( const std::vector& regions) { // We still need one ControlRegionView to cover the whole window such that // mouse events could be captured. - NSView* web_view = GetWebContents()->GetView()->GetNativeView(); + NSView* web_view = GetWebContents()->GetNativeView(); gfx::Rect window_bounds( 0, 0, NSWidth([web_view bounds]), NSHeight([web_view bounds])); system_drag_exclude_areas_.clear(); diff --git a/atom/browser/native_window_views.cc b/atom/browser/native_window_views.cc index b63b8ae4633..4c99a56389f 100644 --- a/atom/browser/native_window_views.cc +++ b/atom/browser/native_window_views.cc @@ -24,7 +24,6 @@ #include "base/strings/utf_string_conversions.h" #include "browser/inspectable_web_contents_view.h" #include "content/public/browser/native_web_keyboard_event.h" -#include "content/public/browser/web_contents_view.h" #include "native_mate/dictionary.h" #include "ui/aura/window.h" #include "ui/aura/window_tree_host.h" diff --git a/atom/browser/ui/accelerator_util.cc b/atom/browser/ui/accelerator_util.cc index 09e98cf02a8..16251e822c6 100644 --- a/atom/browser/ui/accelerator_util.cc +++ b/atom/browser/ui/accelerator_util.cc @@ -87,7 +87,7 @@ ui::KeyboardCode KeyboardCodeFromCharCode(char c, bool* shifted) { bool StringToAccelerator(const std::string& description, ui::Accelerator* accelerator) { - if (!IsStringASCII(description)) { + if (!base::IsStringASCII(description)) { LOG(ERROR) << "The accelerator string can only contain ASCII characters"; return false; } diff --git a/atom/common/chrome_version.h b/atom/common/chrome_version.h index f6b1b8febed..a8f70f3ce00 100644 --- a/atom/common/chrome_version.h +++ b/atom/common/chrome_version.h @@ -8,7 +8,7 @@ #ifndef ATOM_COMMON_CHROME_VERSION_H_ #define ATOM_COMMON_CHROME_VERSION_H_ -#define CHROME_VERSION_STRING "35.0.1916.153" +#define CHROME_VERSION_STRING "36.0.1985.125" #define CHROME_VERSION "v" CHROME_VERSION_STRING #endif // ATOM_COMMON_CHROME_VERSION_H_ diff --git a/atom/renderer/api/atom_api_renderer_ipc.cc b/atom/renderer/api/atom_api_renderer_ipc.cc index 678a0c7e1fc..a0fd27f4ded 100644 --- a/atom/renderer/api/atom_api_renderer_ipc.cc +++ b/atom/renderer/api/atom_api_renderer_ipc.cc @@ -7,19 +7,19 @@ #include "atom/common/native_mate_converters/value_converter.h" #include "content/public/renderer/render_view.h" #include "native_mate/dictionary.h" -#include "third_party/WebKit/public/web/WebFrame.h" +#include "third_party/WebKit/public/web/WebLocalFrame.h" #include "third_party/WebKit/public/web/WebView.h" #include "atom/common/node_includes.h" using content::RenderView; -using blink::WebFrame; +using blink::WebLocalFrame; using blink::WebView; namespace { RenderView* GetCurrentRenderView() { - WebFrame* frame = WebFrame::frameForCurrentContext(); + WebLocalFrame* frame = WebLocalFrame::frameForCurrentContext(); if (!frame) return NULL; diff --git a/atom/renderer/api/atom_api_web_view.cc b/atom/renderer/api/atom_api_web_view.cc index 1f983cdf96a..defa8237ec1 100644 --- a/atom/renderer/api/atom_api_web_view.cc +++ b/atom/renderer/api/atom_api_web_view.cc @@ -6,7 +6,7 @@ #include "native_mate/dictionary.h" #include "native_mate/object_template_builder.h" -#include "third_party/WebKit/public/web/WebFrame.h" +#include "third_party/WebKit/public/web/WebLocalFrame.h" #include "third_party/WebKit/public/web/WebView.h" #include "atom/common/node_includes.h" @@ -18,7 +18,7 @@ namespace api { namespace { blink::WebView* GetCurrentWebView() { - blink::WebFrame* frame = blink::WebFrame::frameForCurrentContext(); + blink::WebLocalFrame* frame = blink::WebLocalFrame::frameForCurrentContext(); if (!frame) return NULL; return frame->view(); diff --git a/atom/renderer/atom_render_view_observer.cc b/atom/renderer/atom_render_view_observer.cc index 05d17e1d96f..1ec21ef1f6a 100644 --- a/atom/renderer/atom_render_view_observer.cc +++ b/atom/renderer/atom_render_view_observer.cc @@ -18,6 +18,7 @@ #include "third_party/WebKit/public/web/WebDraggableRegion.h" #include "third_party/WebKit/public/web/WebDocument.h" #include "third_party/WebKit/public/web/WebFrame.h" +#include "third_party/WebKit/public/web/WebLocalFrame.h" #include "third_party/WebKit/public/web/WebView.h" #include "atom/common/node_includes.h" @@ -36,7 +37,8 @@ AtomRenderViewObserver::AtomRenderViewObserver( AtomRenderViewObserver::~AtomRenderViewObserver() { } -void AtomRenderViewObserver::DidCreateDocumentElement(blink::WebFrame* frame) { +void AtomRenderViewObserver::DidCreateDocumentElement( + blink::WebLocalFrame* frame) { // Read --zoom-factor from command line. std::string zoom_factor_str = CommandLine::ForCurrentProcess()-> GetSwitchValueASCII(switches::kZoomFactor);; diff --git a/atom/renderer/atom_render_view_observer.h b/atom/renderer/atom_render_view_observer.h index 8941c04b017..1e1f356f02f 100644 --- a/atom/renderer/atom_render_view_observer.h +++ b/atom/renderer/atom_render_view_observer.h @@ -25,7 +25,7 @@ class AtomRenderViewObserver : public content::RenderViewObserver { private: // content::RenderViewObserver implementation. - virtual void DidCreateDocumentElement(blink::WebFrame* frame) OVERRIDE; + virtual void DidCreateDocumentElement(blink::WebLocalFrame* frame) OVERRIDE; virtual void DraggableRegionsChanged(blink::WebFrame* frame) OVERRIDE; virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; diff --git a/docs/api/browser-window.md b/docs/api/browser-window.md index 8e89e684815..3a9a2815297 100644 --- a/docs/api/browser-window.md +++ b/docs/api/browser-window.md @@ -63,7 +63,6 @@ You can also create a window without chrome by using * `text-areas-are-resizable` Boolean * `webgl` Boolean * `webaudio` Boolean - * `accelerated-compositing` Boolean * `plugins` Boolean - Whether plugins should be enabled, currently only `NPAPI` plugins are supported. * `extra-plugin-dirs` Array - Array of paths that would be searched for diff --git a/vendor/brightray b/vendor/brightray index 04ecc57b5bb..6c2709003cb 160000 --- a/vendor/brightray +++ b/vendor/brightray @@ -1 +1 @@ -Subproject commit 04ecc57b5bb2f6d015b673d5b17affdce1039ff1 +Subproject commit 6c2709003cb0d06ca105c5cb86ea9f6d666261c3 diff --git a/vendor/node b/vendor/node index 4d2db275a38..6d772c3cda0 160000 --- a/vendor/node +++ b/vendor/node @@ -1 +1 @@ -Subproject commit 4d2db275a386b68e3c22ce87ca0c19fddae139e8 +Subproject commit 6d772c3cda0bb8270857397e128ea1e36c361125