Update to new Chromium APIs.

This commit is contained in:
Cheng Zhao 2014-07-28 15:29:51 +08:00
parent 5ad203ad99
commit 7a89a08534
18 changed files with 28 additions and 37 deletions

View file

@ -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

View file

@ -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,

View file

@ -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.

View file

@ -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;
}

View file

@ -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.

View file

@ -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() {

View file

@ -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))

View file

@ -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();

View file

@ -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"

View file

@ -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;
}