]> khamidou — GitHub mirrors - electron.git/commitdiff
Fix API changes of Chrome 38
authorCheng Zhao <zcbenz@gmail.com>
Sat, 11 Oct 2014 11:11:34 +0000 (19:11 +0800)
committerCheng Zhao <zcbenz@gmail.com>
Sat, 11 Oct 2014 11:11:34 +0000 (19:11 +0800)
12 files changed:
atom/browser/api/atom_api_app.cc
atom/browser/api/atom_api_content_tracing.cc
atom/browser/api/atom_api_web_contents.cc
atom/browser/api/atom_api_web_contents.h
atom/browser/atom_browser_client.cc
atom/browser/atom_browser_client.h
atom/browser/native_window.cc
atom/browser/native_window.h
atom/browser/net/asar/url_request_asar_job.cc
atom/browser/ui/accelerator_util.cc
atom/common/api/api_messages.h
chromium_src/chrome/renderer/printing/print_web_view_helper.cc

index 7331b66a808771f8a979019436a58f261f37baee..46cc4c26faf36d9ad862da6f891c2d87bcb04ddc 100644 (file)
@@ -19,6 +19,7 @@
 #include "native_mate/callback.h"
 #include "native_mate/dictionary.h"
 #include "native_mate/object_template_builder.h"
+#include "net/base/load_flags.h"
 #include "net/proxy/proxy_service.h"
 #include "net/url_request/url_request_context.h"
 #include "net/url_request/url_request_context_getter.h"
@@ -46,10 +47,10 @@ class ResolveProxyHelper {
 
     // Start the request.
     int result = proxy_service->ResolveProxy(
-        url, &proxy_info_,
+        url, net::LOAD_NORMAL, &proxy_info_,
         base::Bind(&ResolveProxyHelper::OnResolveProxyCompleted,
                    base::Unretained(this)),
-        &pac_req_, net::BoundNetLog());
+        &pac_req_, nullptr, net::BoundNetLog());
 
     // Completed synchronously.
     if (result != net::ERR_IO_PENDING)
index e5894a771ba2eafa37f7f31532a2d367cd44410d..81120461124f0b4c91f6797c9c4c91ec94767223 100644 (file)
@@ -3,6 +3,7 @@
 // found in the LICENSE file.
 
 #include <set>
+#include <string>
 
 #include "atom/common/native_mate_converters/file_path_converter.h"
 #include "base/bind.h"
@@ -31,17 +32,30 @@ struct Converter<std::set<T> > {
 };
 
 template<>
-struct Converter<TracingController::Options> {
+struct Converter<base::debug::CategoryFilter> {
   static bool FromV8(v8::Isolate* isolate,
                      v8::Handle<v8::Value> val,
-                     TracingController::Options* out) {
-    if (!val->IsNumber())
+                     base::debug::CategoryFilter* out) {
+    std::string filter;
+    if (!ConvertFromV8(isolate, val, &filter))
       return false;
-    *out = static_cast<TracingController::Options>(val->IntegerValue());
+    *out = base::debug::CategoryFilter(filter);
     return true;
   }
 };
 
+template<>
+struct Converter<base::debug::TraceOptions> {
+  static bool FromV8(v8::Isolate* isolate,
+                     v8::Handle<v8::Value> val,
+                     base::debug::TraceOptions* out) {
+    std::string options;
+    if (!ConvertFromV8(isolate, val, &options))
+      return false;
+    return out->SetFromString(options);
+  }
+};
+
 }  // namespace mate
 
 namespace {
index 33abbcd75e932a606c137f1500d22ce6bdf24a0b..a56688c616dfcc85607f7f0440e5d18901eb60e6 100644 (file)
@@ -35,10 +35,10 @@ void WebContents::RenderProcessGone(base::TerminationStatus status) {
   Emit("crashed");
 }
 
-void WebContents::DidFinishLoad(int64 frame_id,
-                                const GURL& validated_url,
-                                bool is_main_frame,
-                                content::RenderViewHost* render_view_host) {
+void WebContents::DidFinishLoad(content::RenderFrameHost* render_frame_host,
+                                const GURL& validated_url) {
+  bool is_main_frame = !render_frame_host->GetParent();
+
   base::ListValue args;
   args.AppendBoolean(is_main_frame);
   Emit("did-frame-finish-load", args);
index 4a83153bca2b2d4d1d3b250f120841a52d28c428..145cd5aba9a839f7862208bb69eb4fbf95195d61 100644 (file)
@@ -52,11 +52,8 @@ class WebContents : public mate::EventEmitter,
   // content::WebContentsObserver implementations:
   virtual void RenderViewDeleted(content::RenderViewHost*) OVERRIDE;
   virtual void RenderProcessGone(base::TerminationStatus status) OVERRIDE;
-  virtual void DidFinishLoad(
-      int64 frame_id,
-      const GURL& validated_url,
-      bool is_main_frame,
-      content::RenderViewHost* render_view_host) OVERRIDE;
+  virtual void DidFinishLoad(content::RenderFrameHost* render_frame_host,
+                             const GURL& validated_url) OVERRIDE;
   virtual void DidStartLoading(
       content::RenderViewHost* render_view_host) OVERRIDE;
   virtual void DidStopLoading(
index ba3e8a69666ce205442fcb7779c289753969496e..22ff32ad219e3a5f28fac1603968e0cb97662bc2 100644 (file)
@@ -18,8 +18,8 @@
 #include "content/public/browser/resource_dispatcher_host.h"
 #include "content/public/browser/site_instance.h"
 #include "content/public/browser/web_contents.h"
+#include "content/public/common/web_preferences.h"
 #include "ui/base/l10n/l10n_util.h"
-#include "webkit/common/webpreferences.h"
 
 namespace atom {
 
@@ -76,7 +76,7 @@ content::AccessTokenStore* AtomBrowserClient::CreateAccessTokenStore() {
 void AtomBrowserClient::OverrideWebkitPrefs(
     content::RenderViewHost* render_view_host,
     const GURL& url,
-    WebPreferences* prefs) {
+    content::WebPreferences* prefs) {
   prefs->javascript_enabled = true;
   prefs->web_security_enabled = true;
   prefs->javascript_can_open_windows_automatically = true;
index 344606c3ca2cc892526c62183313e53e69061e95..523b95143d0c2d5664c4cbf1a3ceb4b8c6973fe3 100644 (file)
@@ -28,7 +28,7 @@ class AtomBrowserClient : public brightray::BrowserClient {
   virtual content::AccessTokenStore* CreateAccessTokenStore() OVERRIDE;
   virtual void OverrideWebkitPrefs(content::RenderViewHost* render_view_host,
                                    const GURL& url,
-                                   WebPreferences* prefs) OVERRIDE;
+                                   content::WebPreferences* prefs) OVERRIDE;
   virtual bool ShouldSwapBrowsingInstancesForNavigation(
       content::SiteInstance* site_instance,
       const GURL& current_url,
index 583958cb24da226afb36bc6b61b7c70a155258c9..dfd589049638cd9177ee02cee7e58fdab2cbe961 100644 (file)
 #include "content/public/common/content_switches.h"
 #include "content/public/common/renderer_preferences.h"
 #include "content/public/common/user_agent.h"
+#include "content/public/common/web_preferences.h"
 #include "ipc/ipc_message_macros.h"
 #include "native_mate/dictionary.h"
 #include "ui/gfx/codec/png_codec.h"
 #include "ui/gfx/point.h"
 #include "ui/gfx/rect.h"
 #include "ui/gfx/size.h"
-#include "webkit/common/webpreferences.h"
 
 using content::NavigationEntry;
 
@@ -248,9 +248,8 @@ bool NativeWindow::IsDevToolsOpened() {
 
 void NativeWindow::InspectElement(int x, int y) {
   OpenDevTools();
-  content::RenderViewHost* rvh = GetWebContents()->GetRenderViewHost();
   scoped_refptr<content::DevToolsAgentHost> agent(
-      content::DevToolsAgentHost::GetOrCreateFor(rvh));
+      content::DevToolsAgentHost::GetOrCreateFor(GetWebContents()));
   agent->InspectElement(x, y);
 }
 
@@ -287,7 +286,7 @@ void NativeWindow::CapturePage(const gfx::Rect& rect,
       base::Bind(&NativeWindow::OnCapturePageDone,
                  weak_factory_.GetWeakPtr(),
                  callback),
-      SkBitmap::kARGB_8888_Config);
+      kAlpha_8_SkColorType);
 }
 
 void NativeWindow::DestroyWebContents() {
@@ -368,7 +367,8 @@ void NativeWindow::AppendExtraCommandLineSwitches(
   }
 }
 
-void NativeWindow::OverrideWebkitPrefs(const GURL& url, WebPreferences* prefs) {
+void NativeWindow::OverrideWebkitPrefs(const GURL& url,
+                                       content::WebPreferences* prefs) {
   if (web_preferences_.IsEmpty())
     return;
 
index 929c1aabc5bbb4b0a2193bc266e9a26614ab644f..0a2abb7059c84c0dc3fa9a77b9337479211ec503 100644 (file)
@@ -23,8 +23,6 @@
 #include "native_mate/persistent_dictionary.h"
 #include "ui/gfx/image/image_skia.h"
 
-struct WebPreferences;
-
 namespace base {
 class CommandLine;
 }
@@ -32,6 +30,7 @@ class CommandLine;
 namespace content {
 class BrowserContext;
 class WebContents;
+struct WebPreferences;
 }
 
 namespace gfx {
@@ -178,7 +177,7 @@ class NativeWindow : public brightray::DefaultWebContentsDelegate,
   // Called when renderer process is going to be started.
   void AppendExtraCommandLineSwitches(base::CommandLine* command_line,
                                       int child_process_id);
-  void OverrideWebkitPrefs(const GURL& url, WebPreferences* prefs);
+  void OverrideWebkitPrefs(const GURL& url, content::WebPreferences* prefs);
 
   // Public API used by platform-dependent delegates and observers to send UI
   // related notifications.
index a66eaf57d71776e432172d700364211fb0cb1428..9c0bab951b941f3ecc2edbb7d3c0583b66f4131e 100644 (file)
@@ -99,7 +99,7 @@ void URLRequestAsarJob::DidOpen(int result) {
     return;
   }
 
-  int rv = stream_->Seek(net::FROM_BEGIN,
+  int rv = stream_->Seek(base::File::FROM_BEGIN,
                          file_info_.offset,
                          base::Bind(&URLRequestAsarJob::DidSeek,
                                     weak_ptr_factory_.GetWeakPtr()));
index 16251e822c6fd89add12675984b412e33bda8b74..7d075ce0bde8851e5bad2dc7e2f58d318710d04e 100644 (file)
@@ -91,7 +91,7 @@ bool StringToAccelerator(const std::string& description,
     LOG(ERROR) << "The accelerator string can only contain ASCII characters";
     return false;
   }
-  std::string shortcut(StringToLowerASCII(description));
+  std::string shortcut(base::StringToLowerASCII(description));
 
   std::vector<std::string> tokens;
   base::SplitString(shortcut, '+', &tokens);
index 045bceb719af38586baa89ec733788d498ff76ca..bd8bfd5a06ebdf415c5af412a66d5f5bebadb069 100644 (file)
@@ -9,6 +9,7 @@
 #include "base/values.h"
 #include "content/public/common/common_param_traits.h"
 #include "ipc/ipc_message_macros.h"
+#include "ui/gfx/ipc/gfx_param_traits.h"
 
 // The message starter should be declared in ipc/ipc_message_start.h. Since
 // we don't want to patch Chromium, we just pretend to be Content Shell.
index b962f45112fb84f19fefd367721b662097f7691e..df9e287cdcbb2b14f5bf01b29945455bb8582d67 100644 (file)
 #include "base/strings/stringprintf.h"
 #include "base/strings/utf_string_conversions.h"
 #include "chrome/common/print_messages.h"
+#include "content/public/common/web_preferences.h"
 #include "content/public/renderer/render_frame.h"
 #include "content/public/renderer/render_thread.h"
 #include "content/public/renderer/render_view.h"
-#include "content/public/renderer/web_preferences.h"
 #include "net/base/escape.h"
 #include "printing/metafile.h"
 #include "printing/metafile_impl.h"
@@ -42,7 +42,8 @@
 #include "third_party/WebKit/public/web/WebView.h"
 #include "third_party/WebKit/public/web/WebViewClient.h"
 #include "ui/base/resource/resource_bundle.h"
-#include "webkit/common/webpreferences.h"
+
+using content::WebPreferences;
 
 namespace printing {
 
@@ -547,7 +548,7 @@ void PrepareFrameAndViewForPrint::CopySelection(
 
   blink::WebView* web_view = blink::WebView::create(this);
   owns_web_view_ = true;
-  content::ApplyWebPreferences(prefs, web_view);
+  content::RenderView::ApplyWebPreferences(prefs, web_view);
   web_view->setMainFrame(blink::WebLocalFrame::create(this));
   frame_.Reset(web_view->mainFrame()->toWebLocalFrame());
   node_to_print_.reset();