Browse Source

Update to new Chromium APIs.

Cheng Zhao 10 years ago
parent
commit
7a89a08534

+ 1 - 2
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

+ 3 - 3
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,

+ 1 - 1
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.

+ 1 - 1
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;
 }

+ 1 - 1
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.

+ 1 - 5
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() {

+ 1 - 4
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))

+ 6 - 7
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<DraggableRegion>& 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();

+ 0 - 1
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"

+ 1 - 1
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;
   }

+ 1 - 1
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_

+ 3 - 3
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;
 

+ 2 - 2
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();

+ 3 - 1
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);;

+ 1 - 1
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;
 

+ 0 - 1
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

+ 1 - 1
vendor/brightray

@@ -1 +1 @@
-Subproject commit 04ecc57b5bb2f6d015b673d5b17affdce1039ff1
+Subproject commit 6c2709003cb0d06ca105c5cb86ea9f6d666261c3

+ 1 - 1
vendor/node

@@ -1 +1 @@
-Subproject commit 4d2db275a386b68e3c22ce87ca0c19fddae139e8
+Subproject commit 6d772c3cda0bb8270857397e128ea1e36c361125