summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-02-25 16:34:10 +0000
committerjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-02-25 16:34:10 +0000
commit60780f41729ab40ba08b93ad4c279fbe0aee4c13 (patch)
tree8faf01fe888ec562bf61bcb499f97e3868d1948d
parenta5746d059d86cebd31b3ef6d549f679d8686978c (diff)
downloadchromium_src-60780f41729ab40ba08b93ad4c279fbe0aee4c13.zip
chromium_src-60780f41729ab40ba08b93ad4c279fbe0aee4c13.tar.gz
chromium_src-60780f41729ab40ba08b93ad4c279fbe0aee4c13.tar.bz2
Move WebContentsView methods that are only called inside content over to WebContentsViewPort.
Review URL: https://codereview.chromium.org/12313084 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@184420 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/autofill/risk/fingerprint_browsertest.cc10
-rw-r--r--chrome/browser/chrome_content_browser_client.cc7
-rw-r--r--chrome/browser/chrome_content_browser_client.h4
-rw-r--r--content/browser/web_contents/interstitial_page_impl.cc6
-rw-r--r--content/browser/web_contents/web_contents_impl.cc17
-rw-r--r--content/browser/web_contents/web_contents_impl.h6
-rw-r--r--content/browser/web_contents/web_contents_view_android.cc85
-rw-r--r--content/browser/web_contents/web_contents_view_android.h19
-rw-r--r--content/browser/web_contents/web_contents_view_aura.cc164
-rw-r--r--content/browser/web_contents/web_contents_view_aura.h18
-rw-r--r--content/browser/web_contents/web_contents_view_gtk.cc157
-rw-r--r--content/browser/web_contents/web_contents_view_gtk.h18
-rw-r--r--content/browser/web_contents/web_contents_view_guest.cc90
-rw-r--r--content/browser/web_contents/web_contents_view_guest.h24
-rw-r--r--content/browser/web_contents/web_contents_view_mac.h21
-rw-r--r--content/browser/web_contents/web_contents_view_mac.mm171
-rw-r--r--content/browser/web_contents/web_contents_view_win.cc113
-rw-r--r--content/browser/web_contents/web_contents_view_win.h18
-rw-r--r--content/port/browser/web_contents_view_port.h36
-rw-r--r--content/public/browser/content_browser_client.cc2
-rw-r--r--content/public/browser/content_browser_client.h6
-rw-r--r--content/public/browser/web_contents_view.h35
-rw-r--r--content/test/test_content_browser_client.cc2
-rw-r--r--content/test/test_content_browser_client.h2
-rw-r--r--content/test/test_web_contents_view.cc60
-rw-r--r--content/test/test_web_contents_view.h22
26 files changed, 534 insertions, 579 deletions
diff --git a/chrome/browser/autofill/risk/fingerprint_browsertest.cc b/chrome/browser/autofill/risk/fingerprint_browsertest.cc
index b3ccb32..752444f 100644
--- a/chrome/browser/autofill/risk/fingerprint_browsertest.cc
+++ b/chrome/browser/autofill/risk/fingerprint_browsertest.cc
@@ -70,12 +70,6 @@ class TestWebContentsView : public WebContentsView {
}
// The rest of WebContentsView:
- virtual void CreateView(const gfx::Size& initial_size,
- gfx::NativeView context) OVERRIDE {}
- virtual RenderWidgetHostView* CreateViewForWidget(
- RenderWidgetHost* render_widget_host) OVERRIDE { return NULL; }
- virtual RenderWidgetHostView* CreateViewForPopupWidget(
- RenderWidgetHost* render_widget_host) OVERRIDE { return NULL; }
virtual gfx::NativeView GetNativeView() const OVERRIDE {
return gfx::NativeView();
}
@@ -85,18 +79,14 @@ class TestWebContentsView : public WebContentsView {
virtual gfx::NativeWindow GetTopLevelNativeWindow() const OVERRIDE {
return gfx::NativeWindow();
}
- virtual void SetPageTitle(const string16& title) OVERRIDE {}
virtual void OnTabCrashed(base::TerminationStatus status,
int error_code) OVERRIDE {}
virtual void SizeContents(const gfx::Size& size) OVERRIDE {}
- virtual void RenderViewCreated(RenderViewHost* host) OVERRIDE {}
virtual void Focus() OVERRIDE {}
virtual void SetInitialFocus() OVERRIDE {}
virtual void StoreFocus() OVERRIDE {}
virtual void RestoreFocus() OVERRIDE {}
virtual WebDropData* GetDropData() const OVERRIDE { return NULL; }
- virtual bool IsEventTracking() const OVERRIDE { return false; }
- virtual void CloseTabAfterEventTracking() OVERRIDE {}
virtual gfx::Rect GetViewBounds() const OVERRIDE { return gfx::Rect(); }
#if defined(OS_MACOSX)
virtual void SetAllowOverlappingViews(bool overlapping) OVERRIDE {}
diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc
index 2e44dc4..674e54e 100644
--- a/chrome/browser/chrome_content_browser_client.cc
+++ b/chrome/browser/chrome_content_browser_client.cc
@@ -505,13 +505,6 @@ content::BrowserMainParts* ChromeContentBrowserClient::CreateBrowserMainParts(
return main_parts;
}
-content::WebContentsView*
- ChromeContentBrowserClient::OverrideCreateWebContentsView(
- WebContents* web_contents,
- content::RenderViewHostDelegateView** render_view_host_delegate_view) {
- return NULL;
-}
-
std::string ChromeContentBrowserClient::GetStoragePartitionIdForSite(
content::BrowserContext* browser_context,
const GURL& site) {
diff --git a/chrome/browser/chrome_content_browser_client.h b/chrome/browser/chrome_content_browser_client.h
index c49aa95..e48da6b 100644
--- a/chrome/browser/chrome_content_browser_client.h
+++ b/chrome/browser/chrome_content_browser_client.h
@@ -38,10 +38,6 @@ class ChromeContentBrowserClient : public content::ContentBrowserClient {
virtual content::BrowserMainParts* CreateBrowserMainParts(
const content::MainFunctionParams& parameters) OVERRIDE;
- virtual content::WebContentsView* OverrideCreateWebContentsView(
- content::WebContents* web_contents,
- content::RenderViewHostDelegateView** render_view_host_delegate_view)
- OVERRIDE;
virtual std::string GetStoragePartitionIdForSite(
content::BrowserContext* browser_context,
const GURL& site) OVERRIDE;
diff --git a/content/browser/web_contents/interstitial_page_impl.cc b/content/browser/web_contents/interstitial_page_impl.cc
index a783035..c5e0dd4 100644
--- a/content/browser/web_contents/interstitial_page_impl.cc
+++ b/content/browser/web_contents/interstitial_page_impl.cc
@@ -24,6 +24,7 @@
#include "content/common/view_messages.h"
#include "content/port/browser/render_view_host_delegate_view.h"
#include "content/port/browser/render_widget_host_view_port.h"
+#include "content/port/browser/web_contents_view_port.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/content_browser_client.h"
@@ -33,7 +34,6 @@
#include "content/public/browser/notification_service.h"
#include "content/public/browser/notification_source.h"
#include "content/public/browser/storage_partition.h"
-#include "content/public/browser/web_contents_view.h"
#include "content/public/common/bindings_policy.h"
#include "content/public/common/page_transition_types.h"
#include "net/base/escape.h"
@@ -504,8 +504,10 @@ WebContentsView* InterstitialPageImpl::CreateWebContentsView() {
if (!enabled() || !create_view_)
return NULL;
WebContentsView* web_contents_view = web_contents()->GetView();
+ WebContentsViewPort* web_contents_view_port =
+ static_cast<WebContentsViewPort*>(web_contents_view);
RenderWidgetHostView* view =
- web_contents_view->CreateViewForWidget(render_view_host_);
+ web_contents_view_port->CreateViewForWidget(render_view_host_);
render_view_host_->SetView(view);
render_view_host_->AllowBindings(BINDINGS_POLICY_DOM_AUTOMATION);
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
index 2e28fa1..f4b6aa4 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -1249,7 +1249,7 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params) {
}
if (enable_browser_plugin_guest_views) {
- WebContentsView* platform_view = CreateWebContentsView(
+ WebContentsViewPort* platform_view = CreateWebContentsView(
this, delegate, &render_view_host_delegate_view_);
WebContentsViewGuest* rv = new WebContentsViewGuest(
@@ -1468,7 +1468,7 @@ void WebContentsImpl::CreateNewWindow(
new_contents->set_opener_web_ui_type(GetWebUITypeForCurrentState());
if (!params.opener_suppressed) {
- WebContentsView* new_view = new_contents->GetView();
+ WebContentsViewPort* new_view = new_contents->view_.get();
// TODO(brettw): It seems bogus that we have to call this function on the
// newly created object and give it one of its own member variables.
@@ -2766,7 +2766,7 @@ void WebContentsImpl::RenderViewCreated(RenderViewHost* render_view_host) {
new ViewMsg_EnableViewSourceMode(render_view_host->GetRoutingID()));
}
- GetView()->RenderViewCreated(render_view_host);
+ view_->RenderViewCreated(render_view_host);
FOR_EACH_OBSERVER(
WebContentsObserver, observers_, RenderViewCreated(render_view_host));
@@ -2960,6 +2960,7 @@ void WebContentsImpl::UpdateTargetURL(int32 page_id, const GURL& url) {
}
void WebContentsImpl::Close(RenderViewHost* rvh) {
+#if defined(OS_MACOSX)
// The UI may be in an event-tracking loop, such as between the
// mouse-down and mouse-up in text selection or a button click.
// Defer the close until after tracking is complete, so that we
@@ -2967,10 +2968,11 @@ void WebContentsImpl::Close(RenderViewHost* rvh) {
// TODO(shess): This could get more fine-grained. For instance,
// closing a tab in another window while selecting text in the
// current window's Omnibox should be just fine.
- if (GetView()->IsEventTracking()) {
- GetView()->CloseTabAfterEventTracking();
+ if (view_->IsEventTracking()) {
+ view_->CloseTabAfterEventTracking();
return;
}
+#endif
// Ignore this if it comes from a RenderViewHost that we aren't showing.
if (delegate_ && rvh == GetRenderViewHost())
@@ -3405,8 +3407,7 @@ void WebContentsImpl::NotifySwappedFromRenderManager(RenderViewHost* rvh) {
host->SetOverscrollControllerEnabled(delegate_->CanOverscrollContent());
}
- static_cast<WebContentsViewPort*>(GetView())->
- RenderViewSwappedIn(render_manager_.current_host());
+ view_->RenderViewSwappedIn(render_manager_.current_host());
}
int WebContentsImpl::CreateOpenerRenderViewsForRenderManager(
@@ -3539,7 +3540,7 @@ void WebContentsImpl::SaveURL(const GURL& url,
}
void WebContentsImpl::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) {
- RenderWidgetHostView* rwh_view = GetView()->CreateViewForWidget(rvh);
+ RenderWidgetHostView* rwh_view = view_->CreateViewForWidget(rvh);
// Can be NULL during tests.
if (rwh_view)
rwh_view->SetSize(GetView()->GetContainerSize());
diff --git a/content/browser/web_contents/web_contents_impl.h b/content/browser/web_contents/web_contents_impl.h
index 25eda8f..9e8124f 100644
--- a/content/browser/web_contents/web_contents_impl.h
+++ b/content/browser/web_contents/web_contents_impl.h
@@ -55,14 +55,14 @@ class TestWebContents;
class WebContentsDelegate;
class WebContentsImpl;
class WebContentsObserver;
-class WebContentsView;
+class WebContentsViewPort;
class WebContentsViewDelegate;
struct FaviconURL;
struct LoadNotificationDetails;
// Factory function for the implementations that content knows about. Takes
// ownership of |delegate|.
-WebContentsView* CreateWebContentsView(
+WebContentsViewPort* CreateWebContentsView(
WebContentsImpl* web_contents,
WebContentsViewDelegate* delegate,
RenderViewHostDelegateView** render_view_host_delegate_view);
@@ -706,7 +706,7 @@ class CONTENT_EXPORT WebContentsImpl
NavigationControllerImpl controller_;
// The corresponding view.
- scoped_ptr<WebContentsView> view_;
+ scoped_ptr<WebContentsViewPort> view_;
// The view of the RVHD. Usually this is our WebContentsView implementation,
// but if an embedder uses a different WebContentsView, they'll need to
diff --git a/content/browser/web_contents/web_contents_view_android.cc b/content/browser/web_contents/web_contents_view_android.cc
index e8eca23..116545e 100644
--- a/content/browser/web_contents/web_contents_view_android.cc
+++ b/content/browser/web_contents/web_contents_view_android.cc
@@ -15,7 +15,7 @@
#include "content/public/browser/web_contents_delegate.h"
namespace content {
-WebContentsView* CreateWebContentsView(
+WebContentsViewPort* CreateWebContentsView(
WebContentsImpl* web_contents,
WebContentsViewDelegate* delegate,
RenderViewHostDelegateView** render_view_host_delegate_view) {
@@ -54,37 +54,6 @@ void WebContentsViewAndroid::SetContentViewCore(
}
}
-void WebContentsViewAndroid::CreateView(
- const gfx::Size& initial_size, gfx::NativeView context) {
-}
-
-RenderWidgetHostView* WebContentsViewAndroid::CreateViewForWidget(
- RenderWidgetHost* render_widget_host) {
- if (render_widget_host->GetView()) {
- // During testing, the view will already be set up in most cases to the
- // test view, so we don't want to clobber it with a real one. To verify that
- // this actually is happening (and somebody isn't accidentally creating the
- // view twice), we check for the RVH Factory, which will be set when we're
- // making special ones (which go along with the special views).
- DCHECK(RenderViewHostFactory::has_factory());
- return render_widget_host->GetView();
- }
- // Note that while this instructs the render widget host to reference
- // |native_view_|, this has no effect without also instructing the
- // native view (i.e. ContentView) how to obtain a reference to this widget in
- // order to paint it. See ContentView::GetRenderWidgetHostViewAndroid for an
- // example of how this is achieved for InterstitialPages.
- RenderWidgetHostImpl* rwhi = RenderWidgetHostImpl::From(render_widget_host);
- RenderWidgetHostView* view = new RenderWidgetHostViewAndroid(
- rwhi, content_view_core_);
- return view;
-}
-
-RenderWidgetHostView* WebContentsViewAndroid::CreateViewForPopupWidget(
- RenderWidgetHost* render_widget_host) {
- return RenderWidgetHostViewPort::CreateViewForWidget(render_widget_host);
-}
-
gfx::NativeView WebContentsViewAndroid::GetNativeView() const {
return content_view_core_;
}
@@ -125,12 +94,6 @@ void WebContentsViewAndroid::SizeContents(const gfx::Size& size) {
rwhv->SetSize(size);
}
-void WebContentsViewAndroid::RenderViewCreated(RenderViewHost* host) {
-}
-
-void WebContentsViewAndroid::RenderViewSwappedIn(RenderViewHost* host) {
-}
-
void WebContentsViewAndroid::Focus() {
if (web_contents_->ShowingInterstitialPage())
web_contents_->GetInterstitialPage()->Focus();
@@ -158,15 +121,6 @@ WebDropData* WebContentsViewAndroid::GetDropData() const {
return NULL;
}
-bool WebContentsViewAndroid::IsEventTracking() const {
- NOTIMPLEMENTED();
- return false;
-}
-
-void WebContentsViewAndroid::CloseTabAfterEventTracking() {
- NOTIMPLEMENTED();
-}
-
gfx::Rect WebContentsViewAndroid::GetViewBounds() const {
RenderWidgetHostView* rwhv = web_contents_->GetRenderWidgetHostView();
if (rwhv)
@@ -175,6 +129,43 @@ gfx::Rect WebContentsViewAndroid::GetViewBounds() const {
return gfx::Rect();
}
+void WebContentsViewAndroid::CreateView(
+ const gfx::Size& initial_size, gfx::NativeView context) {
+}
+
+RenderWidgetHostView* WebContentsViewAndroid::CreateViewForWidget(
+ RenderWidgetHost* render_widget_host) {
+ if (render_widget_host->GetView()) {
+ // During testing, the view will already be set up in most cases to the
+ // test view, so we don't want to clobber it with a real one. To verify that
+ // this actually is happening (and somebody isn't accidentally creating the
+ // view twice), we check for the RVH Factory, which will be set when we're
+ // making special ones (which go along with the special views).
+ DCHECK(RenderViewHostFactory::has_factory());
+ return render_widget_host->GetView();
+ }
+ // Note that while this instructs the render widget host to reference
+ // |native_view_|, this has no effect without also instructing the
+ // native view (i.e. ContentView) how to obtain a reference to this widget in
+ // order to paint it. See ContentView::GetRenderWidgetHostViewAndroid for an
+ // example of how this is achieved for InterstitialPages.
+ RenderWidgetHostImpl* rwhi = RenderWidgetHostImpl::From(render_widget_host);
+ RenderWidgetHostView* view = new RenderWidgetHostViewAndroid(
+ rwhi, content_view_core_);
+ return view;
+}
+
+RenderWidgetHostView* WebContentsViewAndroid::CreateViewForPopupWidget(
+ RenderWidgetHost* render_widget_host) {
+ return RenderWidgetHostViewPort::CreateViewForWidget(render_widget_host);
+}
+
+void WebContentsViewAndroid::RenderViewCreated(RenderViewHost* host) {
+}
+
+void WebContentsViewAndroid::RenderViewSwappedIn(RenderViewHost* host) {
+}
+
void WebContentsViewAndroid::ShowContextMenu(
const ContextMenuParams& params,
ContextMenuSourceType type) {
diff --git a/content/browser/web_contents/web_contents_view_android.h b/content/browser/web_contents/web_contents_view_android.h
index 17146ac..01f1731 100644
--- a/content/browser/web_contents/web_contents_view_android.h
+++ b/content/browser/web_contents/web_contents_view_android.h
@@ -29,32 +29,29 @@ class WebContentsViewAndroid : public WebContentsViewPort,
void SetContentViewCore(ContentViewCoreImpl* content_view_core);
// WebContentsView implementation --------------------------------------------
-
- virtual void CreateView(
- const gfx::Size& initial_size, gfx::NativeView context) OVERRIDE;
- virtual RenderWidgetHostView* CreateViewForWidget(
- RenderWidgetHost* render_widget_host) OVERRIDE;
- virtual RenderWidgetHostView* CreateViewForPopupWidget(
- RenderWidgetHost* render_widget_host) OVERRIDE;
virtual gfx::NativeView GetNativeView() const OVERRIDE;
virtual gfx::NativeView GetContentNativeView() const OVERRIDE;
virtual gfx::NativeWindow GetTopLevelNativeWindow() const OVERRIDE;
virtual void GetContainerBounds(gfx::Rect* out) const OVERRIDE;
- virtual void SetPageTitle(const string16& title) OVERRIDE;
virtual void OnTabCrashed(base::TerminationStatus status,
int error_code) OVERRIDE;
virtual void SizeContents(const gfx::Size& size) OVERRIDE;
- virtual void RenderViewCreated(RenderViewHost* host) OVERRIDE;
virtual void Focus() OVERRIDE;
virtual void SetInitialFocus() OVERRIDE;
virtual void StoreFocus() OVERRIDE;
virtual void RestoreFocus() OVERRIDE;
virtual WebDropData* GetDropData() const OVERRIDE;
- virtual bool IsEventTracking() const OVERRIDE;
- virtual void CloseTabAfterEventTracking() OVERRIDE;
virtual gfx::Rect GetViewBounds() const OVERRIDE;
// WebContentsViewPort implementation ----------------------------------------
+ virtual void CreateView(
+ const gfx::Size& initial_size, gfx::NativeView context) OVERRIDE;
+ virtual RenderWidgetHostView* CreateViewForWidget(
+ RenderWidgetHost* render_widget_host) OVERRIDE;
+ virtual RenderWidgetHostView* CreateViewForPopupWidget(
+ RenderWidgetHost* render_widget_host) OVERRIDE;
+ virtual void SetPageTitle(const string16& title) OVERRIDE;
+ virtual void RenderViewCreated(RenderViewHost* host) OVERRIDE;
virtual void RenderViewSwappedIn(RenderViewHost* host) OVERRIDE;
// Backend implementation of RenderViewHostDelegateView.
diff --git a/content/browser/web_contents/web_contents_view_aura.cc b/content/browser/web_contents/web_contents_view_aura.cc
index 439cc49..c4505c1 100644
--- a/content/browser/web_contents/web_contents_view_aura.cc
+++ b/content/browser/web_contents/web_contents_view_aura.cc
@@ -57,7 +57,7 @@
#endif
namespace content {
-WebContentsView* CreateWebContentsView(
+WebContentsViewPort* CreateWebContentsView(
WebContentsImpl* web_contents,
WebContentsViewDelegate* delegate,
RenderViewHostDelegateView** render_view_host_delegate_view) {
@@ -1082,6 +1082,85 @@ void WebContentsViewAura::UpdateOverscrollWindowBrightness(float delta_x) {
////////////////////////////////////////////////////////////////////////////////
// WebContentsViewAura, WebContentsView implementation:
+gfx::NativeView WebContentsViewAura::GetNativeView() const {
+ return window_.get();
+}
+
+gfx::NativeView WebContentsViewAura::GetContentNativeView() const {
+ RenderWidgetHostView* rwhv = web_contents_->GetRenderWidgetHostView();
+ return rwhv ? rwhv->GetNativeView() : NULL;
+}
+
+gfx::NativeWindow WebContentsViewAura::GetTopLevelNativeWindow() const {
+ return window_->GetToplevelWindow();
+}
+
+void WebContentsViewAura::GetContainerBounds(gfx::Rect *out) const {
+ *out = window_->GetBoundsInScreen();
+}
+
+void WebContentsViewAura::OnTabCrashed(base::TerminationStatus status,
+ int error_code) {
+ // Set the focus to the parent because neither the view window nor this
+ // window can handle key events.
+ if (window_->HasFocus() && window_->parent())
+ window_->parent()->Focus();
+}
+
+void WebContentsViewAura::SizeContents(const gfx::Size& size) {
+ gfx::Rect bounds = window_->bounds();
+ if (bounds.size() != size) {
+ bounds.set_size(size);
+ window_->SetBounds(bounds);
+ } else {
+ // Our size matches what we want but the renderers size may not match.
+ // Pretend we were resized so that the renderers size is updated too.
+ SizeChangedCommon(size);
+ }
+}
+
+void WebContentsViewAura::Focus() {
+ if (web_contents_->GetInterstitialPage()) {
+ web_contents_->GetInterstitialPage()->Focus();
+ return;
+ }
+
+ if (delegate_.get() && delegate_->Focus())
+ return;
+
+ RenderWidgetHostView* rwhv = web_contents_->GetRenderWidgetHostView();
+ if (rwhv)
+ rwhv->Focus();
+}
+
+void WebContentsViewAura::SetInitialFocus() {
+ if (web_contents_->FocusLocationBarByDefault())
+ web_contents_->SetFocusToLocationBar(false);
+ else
+ Focus();
+}
+
+void WebContentsViewAura::StoreFocus() {
+ if (delegate_.get())
+ delegate_->StoreFocus();
+}
+
+void WebContentsViewAura::RestoreFocus() {
+ if (delegate_.get())
+ delegate_->RestoreFocus();
+}
+
+WebDropData* WebContentsViewAura::GetDropData() const {
+ return current_drop_data_.get();
+}
+
+gfx::Rect WebContentsViewAura::GetViewBounds() const {
+ return window_->GetBoundsInRootWindow();
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// WebContentsViewAura, WebContentsViewPort implementation:
+
void WebContentsViewAura::CreateView(
const gfx::Size& initial_size, gfx::NativeView context) {
// NOTE: we ignore |initial_size| since in some cases it's wrong (such as
@@ -1165,47 +1244,10 @@ RenderWidgetHostView* WebContentsViewAura::CreateViewForPopupWidget(
return RenderWidgetHostViewPort::CreateViewForWidget(render_widget_host);
}
-gfx::NativeView WebContentsViewAura::GetNativeView() const {
- return window_.get();
-}
-
-gfx::NativeView WebContentsViewAura::GetContentNativeView() const {
- RenderWidgetHostView* rwhv = web_contents_->GetRenderWidgetHostView();
- return rwhv ? rwhv->GetNativeView() : NULL;
-}
-
-gfx::NativeWindow WebContentsViewAura::GetTopLevelNativeWindow() const {
- return window_->GetToplevelWindow();
-}
-
-void WebContentsViewAura::GetContainerBounds(gfx::Rect *out) const {
- *out = window_->GetBoundsInScreen();
-}
-
void WebContentsViewAura::SetPageTitle(const string16& title) {
window_->set_title(title);
}
-void WebContentsViewAura::OnTabCrashed(base::TerminationStatus status,
- int error_code) {
- // Set the focus to the parent because neither the view window nor this
- // window can handle key events.
- if (window_->HasFocus() && window_->parent())
- window_->parent()->Focus();
-}
-
-void WebContentsViewAura::SizeContents(const gfx::Size& size) {
- gfx::Rect bounds = window_->bounds();
- if (bounds.size() != size) {
- bounds.set_size(size);
- window_->SetBounds(bounds);
- } else {
- // Our size matches what we want but the renderers size may not match.
- // Pretend we were resized so that the renderers size is updated too.
- SizeChangedCommon(size);
- }
-}
-
void WebContentsViewAura::RenderViewCreated(RenderViewHost* host) {
}
@@ -1216,52 +1258,6 @@ void WebContentsViewAura::RenderViewSwappedIn(RenderViewHost* host) {
}
}
-void WebContentsViewAura::Focus() {
- if (web_contents_->GetInterstitialPage()) {
- web_contents_->GetInterstitialPage()->Focus();
- return;
- }
-
- if (delegate_.get() && delegate_->Focus())
- return;
-
- RenderWidgetHostView* rwhv = web_contents_->GetRenderWidgetHostView();
- if (rwhv)
- rwhv->Focus();
-}
-
-void WebContentsViewAura::SetInitialFocus() {
- if (web_contents_->FocusLocationBarByDefault())
- web_contents_->SetFocusToLocationBar(false);
- else
- Focus();
-}
-
-void WebContentsViewAura::StoreFocus() {
- if (delegate_.get())
- delegate_->StoreFocus();
-}
-
-void WebContentsViewAura::RestoreFocus() {
- if (delegate_.get())
- delegate_->RestoreFocus();
-}
-
-WebDropData* WebContentsViewAura::GetDropData() const {
- return current_drop_data_.get();
-}
-
-bool WebContentsViewAura::IsEventTracking() const {
- return false;
-}
-
-void WebContentsViewAura::CloseTabAfterEventTracking() {
-}
-
-gfx::Rect WebContentsViewAura::GetViewBounds() const {
- return window_->GetBoundsInRootWindow();
-}
-
////////////////////////////////////////////////////////////////////////////////
// WebContentsViewAura, RenderViewHostDelegateView implementation:
diff --git a/content/browser/web_contents/web_contents_view_aura.h b/content/browser/web_contents/web_contents_view_aura.h
index 77a3cb9..1b8269d 100644
--- a/content/browser/web_contents/web_contents_view_aura.h
+++ b/content/browser/web_contents/web_contents_view_aura.h
@@ -91,31 +91,29 @@ class CONTENT_EXPORT WebContentsViewAura
void UpdateOverscrollWindowBrightness(float delta_x);
// Overridden from WebContentsView:
- virtual void CreateView(
- const gfx::Size& initial_size, gfx::NativeView context) OVERRIDE;
- virtual RenderWidgetHostView* CreateViewForWidget(
- RenderWidgetHost* render_widget_host) OVERRIDE;
- virtual RenderWidgetHostView* CreateViewForPopupWidget(
- RenderWidgetHost* render_widget_host) OVERRIDE;
virtual gfx::NativeView GetNativeView() const OVERRIDE;
virtual gfx::NativeView GetContentNativeView() const OVERRIDE;
virtual gfx::NativeWindow GetTopLevelNativeWindow() const OVERRIDE;
virtual void GetContainerBounds(gfx::Rect *out) const OVERRIDE;
- virtual void SetPageTitle(const string16& title) OVERRIDE;
virtual void OnTabCrashed(base::TerminationStatus status,
int error_code) OVERRIDE;
virtual void SizeContents(const gfx::Size& size) OVERRIDE;
- virtual void RenderViewCreated(RenderViewHost* host) OVERRIDE;
virtual void Focus() OVERRIDE;
virtual void SetInitialFocus() OVERRIDE;
virtual void StoreFocus() OVERRIDE;
virtual void RestoreFocus() OVERRIDE;
virtual WebDropData* GetDropData() const OVERRIDE;
- virtual bool IsEventTracking() const OVERRIDE;
- virtual void CloseTabAfterEventTracking() OVERRIDE;
virtual gfx::Rect GetViewBounds() const OVERRIDE;
// Overridden from WebContentsViewPort:
+ virtual void CreateView(
+ const gfx::Size& initial_size, gfx::NativeView context) OVERRIDE;
+ virtual RenderWidgetHostView* CreateViewForWidget(
+ RenderWidgetHost* render_widget_host) OVERRIDE;
+ virtual RenderWidgetHostView* CreateViewForPopupWidget(
+ RenderWidgetHost* render_widget_host) OVERRIDE;
+ virtual void SetPageTitle(const string16& title) OVERRIDE;
+ virtual void RenderViewCreated(RenderViewHost* host) OVERRIDE;
virtual void RenderViewSwappedIn(RenderViewHost* host) OVERRIDE;
// Overridden from RenderViewHostDelegateView:
diff --git a/content/browser/web_contents/web_contents_view_gtk.cc b/content/browser/web_contents/web_contents_view_gtk.cc
index 29ecee4..7c66835 100644
--- a/content/browser/web_contents/web_contents_view_gtk.cc
+++ b/content/browser/web_contents/web_contents_view_gtk.cc
@@ -76,7 +76,7 @@ gboolean OnMouseScroll(GtkWidget* widget, GdkEventScroll* event,
} // namespace
-WebContentsView* CreateWebContentsView(
+WebContentsViewPort* CreateWebContentsView(
WebContentsImpl* web_contents,
WebContentsViewDelegate* delegate,
RenderViewHostDelegateView** render_view_host_delegate_view) {
@@ -108,52 +108,6 @@ WebContentsViewGtk::~WebContentsViewGtk() {
expanded_.Destroy();
}
-void WebContentsViewGtk::CreateView(
- const gfx::Size& initial_size, gfx::NativeView context) {
- requested_size_ = initial_size;
-}
-
-RenderWidgetHostView* WebContentsViewGtk::CreateViewForWidget(
- RenderWidgetHost* render_widget_host) {
- if (render_widget_host->GetView()) {
- // During testing, the view will already be set up in most cases to the
- // test view, so we don't want to clobber it with a real one. To verify that
- // this actually is happening (and somebody isn't accidentally creating the
- // view twice), we check for the RVH Factory, which will be set when we're
- // making special ones (which go along with the special views).
- DCHECK(RenderViewHostFactory::has_factory());
- return render_widget_host->GetView();
- }
-
- RenderWidgetHostView* view =
- RenderWidgetHostView::CreateViewForWidget(render_widget_host);
- view->InitAsChild(NULL);
- gfx::NativeView content_view = view->GetNativeView();
- g_signal_connect(content_view, "focus", G_CALLBACK(OnFocusThunk), this);
- g_signal_connect(content_view, "leave-notify-event",
- G_CALLBACK(OnLeaveNotify), web_contents_);
- g_signal_connect(content_view, "motion-notify-event",
- G_CALLBACK(OnMouseMove), web_contents_);
- g_signal_connect(content_view, "scroll-event",
- G_CALLBACK(OnMouseScroll), web_contents_);
- gtk_widget_add_events(content_view, GDK_LEAVE_NOTIFY_MASK |
- GDK_POINTER_MOTION_MASK);
- InsertIntoContentArea(content_view);
-
- // Renderer target DnD.
- drag_dest_.reset(new WebDragDestGtk(web_contents_, content_view));
-
- if (delegate_.get())
- drag_dest_->set_delegate(delegate_->GetDragDestDelegate());
-
- return view;
-}
-
-RenderWidgetHostView* WebContentsViewGtk::CreateViewForPopupWidget(
- RenderWidgetHost* render_widget_host) {
- return RenderWidgetHostViewPort::CreateViewForWidget(render_widget_host);
-}
-
gfx::NativeView WebContentsViewGtk::GetNativeView() const {
if (delegate_.get())
return delegate_->GetNativeView();
@@ -190,38 +144,10 @@ void WebContentsViewGtk::GetContainerBounds(gfx::Rect* out) const {
requested_size_.width(), requested_size_.height());
}
-void WebContentsViewGtk::SetPageTitle(const string16& title) {
- // Set the window name to include the page title so it's easier to spot
- // when debugging (e.g. via xwininfo -tree).
- gfx::NativeView content_view = GetContentNativeView();
- if (content_view) {
- GdkWindow* content_window = gtk_widget_get_window(content_view);
- if (content_window) {
- gdk_window_set_title(content_window, UTF16ToUTF8(title).c_str());
- }
- }
-}
-
void WebContentsViewGtk::OnTabCrashed(base::TerminationStatus status,
int error_code) {
}
-void WebContentsViewGtk::SizeContents(const gfx::Size& size) {
- // We don't need to manually set the size of of widgets in GTK+, but we do
- // need to pass the sizing information on to the RWHV which will pass the
- // sizing information on to the renderer.
- requested_size_ = size;
- RenderWidgetHostView* rwhv = web_contents_->GetRenderWidgetHostView();
- if (rwhv)
- rwhv->SetSize(size);
-}
-
-void WebContentsViewGtk::RenderViewCreated(RenderViewHost* host) {
-}
-
-void WebContentsViewGtk::RenderViewSwappedIn(RenderViewHost* host) {
-}
-
void WebContentsViewGtk::Focus() {
if (web_contents_->ShowingInterstitialPage()) {
web_contents_->GetInterstitialPage()->Focus();
@@ -252,13 +178,6 @@ WebDropData* WebContentsViewGtk::GetDropData() const {
return drag_dest_->current_drop_data();
}
-bool WebContentsViewGtk::IsEventTracking() const {
- return false;
-}
-
-void WebContentsViewGtk::CloseTabAfterEventTracking() {
-}
-
gfx::Rect WebContentsViewGtk::GetViewBounds() const {
gfx::Rect rect;
GdkWindow* window = gtk_widget_get_window(GetNativeView());
@@ -272,6 +191,80 @@ gfx::Rect WebContentsViewGtk::GetViewBounds() const {
return rect;
}
+void WebContentsViewGtk::CreateView(
+ const gfx::Size& initial_size, gfx::NativeView context) {
+ requested_size_ = initial_size;
+}
+
+RenderWidgetHostView* WebContentsViewGtk::CreateViewForWidget(
+ RenderWidgetHost* render_widget_host) {
+ if (render_widget_host->GetView()) {
+ // During testing, the view will already be set up in most cases to the
+ // test view, so we don't want to clobber it with a real one. To verify that
+ // this actually is happening (and somebody isn't accidentally creating the
+ // view twice), we check for the RVH Factory, which will be set when we're
+ // making special ones (which go along with the special views).
+ DCHECK(RenderViewHostFactory::has_factory());
+ return render_widget_host->GetView();
+ }
+
+ RenderWidgetHostView* view =
+ RenderWidgetHostView::CreateViewForWidget(render_widget_host);
+ view->InitAsChild(NULL);
+ gfx::NativeView content_view = view->GetNativeView();
+ g_signal_connect(content_view, "focus", G_CALLBACK(OnFocusThunk), this);
+ g_signal_connect(content_view, "leave-notify-event",
+ G_CALLBACK(OnLeaveNotify), web_contents_);
+ g_signal_connect(content_view, "motion-notify-event",
+ G_CALLBACK(OnMouseMove), web_contents_);
+ g_signal_connect(content_view, "scroll-event",
+ G_CALLBACK(OnMouseScroll), web_contents_);
+ gtk_widget_add_events(content_view, GDK_LEAVE_NOTIFY_MASK |
+ GDK_POINTER_MOTION_MASK);
+ InsertIntoContentArea(content_view);
+
+ // Renderer target DnD.
+ drag_dest_.reset(new WebDragDestGtk(web_contents_, content_view));
+
+ if (delegate_.get())
+ drag_dest_->set_delegate(delegate_->GetDragDestDelegate());
+
+ return view;
+}
+
+RenderWidgetHostView* WebContentsViewGtk::CreateViewForPopupWidget(
+ RenderWidgetHost* render_widget_host) {
+ return RenderWidgetHostViewPort::CreateViewForWidget(render_widget_host);
+}
+
+void WebContentsViewGtk::SetPageTitle(const string16& title) {
+ // Set the window name to include the page title so it's easier to spot
+ // when debugging (e.g. via xwininfo -tree).
+ gfx::NativeView content_view = GetContentNativeView();
+ if (content_view) {
+ GdkWindow* content_window = gtk_widget_get_window(content_view);
+ if (content_window) {
+ gdk_window_set_title(content_window, UTF16ToUTF8(title).c_str());
+ }
+ }
+}
+
+void WebContentsViewGtk::SizeContents(const gfx::Size& size) {
+ // We don't need to manually set the size of of widgets in GTK+, but we do
+ // need to pass the sizing information on to the RWHV which will pass the
+ // sizing information on to the renderer.
+ requested_size_ = size;
+ RenderWidgetHostView* rwhv = web_contents_->GetRenderWidgetHostView();
+ if (rwhv)
+ rwhv->SetSize(size);
+}
+
+void WebContentsViewGtk::RenderViewCreated(RenderViewHost* host) {
+}
+
+void WebContentsViewGtk::RenderViewSwappedIn(RenderViewHost* host) {
+}
+
WebContents* WebContentsViewGtk::web_contents() {
return web_contents_;
}
diff --git a/content/browser/web_contents/web_contents_view_gtk.h b/content/browser/web_contents/web_contents_view_gtk.h
index 3fda3f7..da1f45c 100644
--- a/content/browser/web_contents/web_contents_view_gtk.h
+++ b/content/browser/web_contents/web_contents_view_gtk.h
@@ -45,31 +45,29 @@ class CONTENT_EXPORT WebContentsViewGtk
// WebContentsView implementation --------------------------------------------
- virtual void CreateView(
- const gfx::Size& initial_size, gfx::NativeView context) OVERRIDE;
- virtual RenderWidgetHostView* CreateViewForWidget(
- RenderWidgetHost* render_widget_host) OVERRIDE;
- virtual RenderWidgetHostView* CreateViewForPopupWidget(
- RenderWidgetHost* render_widget_host) OVERRIDE;
virtual gfx::NativeView GetNativeView() const OVERRIDE;
virtual gfx::NativeView GetContentNativeView() const OVERRIDE;
virtual gfx::NativeWindow GetTopLevelNativeWindow() const OVERRIDE;
virtual void GetContainerBounds(gfx::Rect* out) const OVERRIDE;
- virtual void SetPageTitle(const string16& title) OVERRIDE;
virtual void OnTabCrashed(base::TerminationStatus status,
int error_code) OVERRIDE;
virtual void SizeContents(const gfx::Size& size) OVERRIDE;
- virtual void RenderViewCreated(RenderViewHost* host) OVERRIDE;
virtual void Focus() OVERRIDE;
virtual void SetInitialFocus() OVERRIDE;
virtual void StoreFocus() OVERRIDE;
virtual void RestoreFocus() OVERRIDE;
virtual WebDropData* GetDropData() const OVERRIDE;
- virtual bool IsEventTracking() const OVERRIDE;
- virtual void CloseTabAfterEventTracking() OVERRIDE;
virtual gfx::Rect GetViewBounds() const OVERRIDE;
// WebContentsViewPort implementation ----------------------------------------
+ virtual void CreateView(
+ const gfx::Size& initial_size, gfx::NativeView context) OVERRIDE;
+ virtual RenderWidgetHostView* CreateViewForWidget(
+ RenderWidgetHost* render_widget_host) OVERRIDE;
+ virtual RenderWidgetHostView* CreateViewForPopupWidget(
+ RenderWidgetHost* render_widget_host) OVERRIDE;
+ virtual void SetPageTitle(const string16& title) OVERRIDE;
+ virtual void RenderViewCreated(RenderViewHost* host) OVERRIDE;
virtual void RenderViewSwappedIn(RenderViewHost* host) OVERRIDE;
// Backend implementation of RenderViewHostDelegateView.
diff --git a/content/browser/web_contents/web_contents_view_guest.cc b/content/browser/web_contents/web_contents_view_guest.cc
index 075adc6..72adabd 100644
--- a/content/browser/web_contents/web_contents_view_guest.cc
+++ b/content/browser/web_contents/web_contents_view_guest.cc
@@ -27,50 +27,16 @@ WebContentsViewGuest::WebContentsViewGuest(
WebContentsImpl* web_contents,
BrowserPluginGuest* guest,
bool enable_compositing,
- WebContentsView* platform_view)
+ WebContentsViewPort* platform_view)
: web_contents_(web_contents),
guest_(guest),
enable_compositing_(enable_compositing),
- platform_view_(static_cast<WebContentsViewPort*>(platform_view)) {
+ platform_view_(platform_view) {
}
WebContentsViewGuest::~WebContentsViewGuest() {
}
-void WebContentsViewGuest::CreateView(const gfx::Size& initial_size,
- gfx::NativeView context) {
- platform_view_->CreateView(initial_size, context);
-}
-
-RenderWidgetHostView* WebContentsViewGuest::CreateViewForWidget(
- RenderWidgetHost* render_widget_host) {
- if (render_widget_host->GetView()) {
- // During testing, the view will already be set up in most cases to the
- // test view, so we don't want to clobber it with a real one. To verify that
- // this actually is happening (and somebody isn't accidentally creating the
- // view twice), we check for the RVH Factory, which will be set when we're
- // making special ones (which go along with the special views).
- DCHECK(RenderViewHostFactory::has_factory());
- return render_widget_host->GetView();
- }
-
- RenderWidgetHostView* platform_widget = NULL;
- platform_widget = platform_view_->CreateViewForWidget(render_widget_host);
-
- RenderWidgetHostView* view = new RenderWidgetHostViewGuest(
- render_widget_host,
- guest_,
- enable_compositing_,
- platform_widget);
-
- return view;
-}
-
-RenderWidgetHostView* WebContentsViewGuest::CreateViewForPopupWidget(
- RenderWidgetHost* render_widget_host) {
- return RenderWidgetHostViewPort::CreateViewForWidget(render_widget_host);
-}
-
gfx::NativeView WebContentsViewGuest::GetNativeView() const {
return NULL;
}
@@ -108,8 +74,41 @@ void WebContentsViewGuest::SetAllowOverlappingViews(bool overlapping) {
}
#endif
-WebContents* WebContentsViewGuest::web_contents() {
- return web_contents_;
+void WebContentsViewGuest::CreateView(const gfx::Size& initial_size,
+ gfx::NativeView context) {
+ platform_view_->CreateView(initial_size, context);
+}
+
+RenderWidgetHostView* WebContentsViewGuest::CreateViewForWidget(
+ RenderWidgetHost* render_widget_host) {
+ if (render_widget_host->GetView()) {
+ // During testing, the view will already be set up in most cases to the
+ // test view, so we don't want to clobber it with a real one. To verify that
+ // this actually is happening (and somebody isn't accidentally creating the
+ // view twice), we check for the RVH Factory, which will be set when we're
+ // making special ones (which go along with the special views).
+ DCHECK(RenderViewHostFactory::has_factory());
+ return render_widget_host->GetView();
+ }
+
+ RenderWidgetHostView* platform_widget = NULL;
+ platform_widget = platform_view_->CreateViewForWidget(render_widget_host);
+
+ RenderWidgetHostView* view = new RenderWidgetHostViewGuest(
+ render_widget_host,
+ guest_,
+ enable_compositing_,
+ platform_widget);
+
+ return view;
+}
+
+RenderWidgetHostView* WebContentsViewGuest::CreateViewForPopupWidget(
+ RenderWidgetHost* render_widget_host) {
+ return RenderWidgetHostViewPort::CreateViewForWidget(render_widget_host);
+}
+
+void WebContentsViewGuest::SetPageTitle(const string16& title) {
}
void WebContentsViewGuest::RenderViewCreated(RenderViewHost* host) {
@@ -120,15 +119,21 @@ void WebContentsViewGuest::RenderViewSwappedIn(RenderViewHost* host) {
platform_view_->RenderViewSwappedIn(host);
}
+#if defined(OS_MACOSX)
bool WebContentsViewGuest::IsEventTracking() const {
return false;
}
-void WebContentsViewGuest::RestoreFocus() {
- platform_view_->RestoreFocus();
+void WebContentsViewGuest::CloseTabAfterEventTracking() {
}
+#endif
-void WebContentsViewGuest::SetPageTitle(const string16& title) {
+WebContents* WebContentsViewGuest::web_contents() {
+ return web_contents_;
+}
+
+void WebContentsViewGuest::RestoreFocus() {
+ platform_view_->RestoreFocus();
}
void WebContentsViewGuest::OnTabCrashed(base::TerminationStatus status,
@@ -148,9 +153,6 @@ WebDropData* WebContentsViewGuest::GetDropData() const {
return NULL;
}
-void WebContentsViewGuest::CloseTabAfterEventTracking() {
-}
-
void WebContentsViewGuest::UpdateDragCursor(WebDragOperation operation) {
NOTIMPLEMENTED();
}
diff --git a/content/browser/web_contents/web_contents_view_guest.h b/content/browser/web_contents/web_contents_view_guest.h
index 23b024e..7725a52 100644
--- a/content/browser/web_contents/web_contents_view_guest.h
+++ b/content/browser/web_contents/web_contents_view_guest.h
@@ -31,42 +31,44 @@ class CONTENT_EXPORT WebContentsViewGuest
WebContentsViewGuest(WebContentsImpl* web_contents,
BrowserPluginGuest* guest,
bool enable_compositing,
- WebContentsView* platform_view);
+ WebContentsViewPort* platform_view);
virtual ~WebContentsViewGuest();
WebContents* web_contents();
// WebContentsView implementation --------------------------------------------
- virtual void CreateView(const gfx::Size& initial_size,
- gfx::NativeView context) OVERRIDE;
- virtual RenderWidgetHostView* CreateViewForWidget(
- RenderWidgetHost* render_widget_host) OVERRIDE;
- virtual RenderWidgetHostView* CreateViewForPopupWidget(
- RenderWidgetHost* render_widget_host) OVERRIDE;
virtual gfx::NativeView GetNativeView() const OVERRIDE;
virtual gfx::NativeView GetContentNativeView() const OVERRIDE;
virtual gfx::NativeWindow GetTopLevelNativeWindow() const OVERRIDE;
virtual void GetContainerBounds(gfx::Rect* out) const OVERRIDE;
- virtual void SetPageTitle(const string16& title) OVERRIDE;
virtual void OnTabCrashed(base::TerminationStatus status,
int error_code) OVERRIDE;
virtual void SizeContents(const gfx::Size& size) OVERRIDE;
- virtual void RenderViewCreated(RenderViewHost* host) OVERRIDE;
virtual void Focus() OVERRIDE;
virtual void SetInitialFocus() OVERRIDE;
virtual void StoreFocus() OVERRIDE;
virtual void RestoreFocus() OVERRIDE;
virtual WebDropData* GetDropData() const OVERRIDE;
- virtual bool IsEventTracking() const OVERRIDE;
- virtual void CloseTabAfterEventTracking() OVERRIDE;
virtual gfx::Rect GetViewBounds() const OVERRIDE;
#if defined(OS_MACOSX)
virtual void SetAllowOverlappingViews(bool overlapping) OVERRIDE;
#endif
// WebContentsViewPort implementation ----------------------------------------
+ virtual void CreateView(const gfx::Size& initial_size,
+ gfx::NativeView context) OVERRIDE;
+ virtual RenderWidgetHostView* CreateViewForWidget(
+ RenderWidgetHost* render_widget_host) OVERRIDE;
+ virtual RenderWidgetHostView* CreateViewForPopupWidget(
+ RenderWidgetHost* render_widget_host) OVERRIDE;
+ virtual void SetPageTitle(const string16& title) OVERRIDE;
+ virtual void RenderViewCreated(RenderViewHost* host) OVERRIDE;
virtual void RenderViewSwappedIn(RenderViewHost* host) OVERRIDE;
+#if defined(OS_MACOSX)
+ virtual bool IsEventTracking() const OVERRIDE;
+ virtual void CloseTabAfterEventTracking() OVERRIDE;
+#endif
// Backend implementation of RenderViewHostDelegateView.
virtual void ShowContextMenu(
diff --git a/content/browser/web_contents/web_contents_view_mac.h b/content/browser/web_contents/web_contents_view_mac.h
index 4b4f335..0388ac0 100644
--- a/content/browser/web_contents/web_contents_view_mac.h
+++ b/content/browser/web_contents/web_contents_view_mac.h
@@ -63,19 +63,10 @@ class WebContentsViewMac : public WebContentsViewPort,
virtual ~WebContentsViewMac();
// WebContentsView implementation --------------------------------------------
-
- virtual void CreateView(
- const gfx::Size& initial_size, gfx::NativeView context) OVERRIDE;
- virtual RenderWidgetHostView* CreateViewForWidget(
- RenderWidgetHost* render_widget_host) OVERRIDE;
- virtual RenderWidgetHostView* CreateViewForPopupWidget(
- RenderWidgetHost* render_widget_host) OVERRIDE;
virtual gfx::NativeView GetNativeView() const OVERRIDE;
virtual gfx::NativeView GetContentNativeView() const OVERRIDE;
virtual gfx::NativeWindow GetTopLevelNativeWindow() const OVERRIDE;
virtual void GetContainerBounds(gfx::Rect* out) const OVERRIDE;
- virtual void RenderViewCreated(RenderViewHost* host) OVERRIDE;
- virtual void SetPageTitle(const string16& title) OVERRIDE;
virtual void OnTabCrashed(base::TerminationStatus status,
int error_code) OVERRIDE;
virtual void SizeContents(const gfx::Size& size) OVERRIDE;
@@ -84,13 +75,21 @@ class WebContentsViewMac : public WebContentsViewPort,
virtual void StoreFocus() OVERRIDE;
virtual void RestoreFocus() OVERRIDE;
virtual WebDropData* GetDropData() const OVERRIDE;
- virtual bool IsEventTracking() const OVERRIDE;
- virtual void CloseTabAfterEventTracking() OVERRIDE;
virtual gfx::Rect GetViewBounds() const OVERRIDE;
virtual void SetAllowOverlappingViews(bool overlapping) OVERRIDE;
// WebContentsViewPort implementation ----------------------------------------
+ virtual void CreateView(
+ const gfx::Size& initial_size, gfx::NativeView context) OVERRIDE;
+ virtual RenderWidgetHostView* CreateViewForWidget(
+ RenderWidgetHost* render_widget_host) OVERRIDE;
+ virtual RenderWidgetHostView* CreateViewForPopupWidget(
+ RenderWidgetHost* render_widget_host) OVERRIDE;
+ virtual void SetPageTitle(const string16& title) OVERRIDE;
+ virtual void RenderViewCreated(RenderViewHost* host) OVERRIDE;
virtual void RenderViewSwappedIn(RenderViewHost* host) OVERRIDE;
+ virtual bool IsEventTracking() const OVERRIDE;
+ virtual void CloseTabAfterEventTracking() OVERRIDE;
// Backend implementation of RenderViewHostDelegateView.
virtual void ShowContextMenu(const ContextMenuParams& params,
diff --git a/content/browser/web_contents/web_contents_view_mac.mm b/content/browser/web_contents/web_contents_view_mac.mm
index c104bca..40ff4f1 100644
--- a/content/browser/web_contents/web_contents_view_mac.mm
+++ b/content/browser/web_contents/web_contents_view_mac.mm
@@ -67,7 +67,7 @@ COMPILE_ASSERT_MATCHING_ENUM(DragOperationEvery);
@end
namespace content {
-WebContentsView* CreateWebContentsView(
+WebContentsViewPort* CreateWebContentsView(
WebContentsImpl* web_contents,
WebContentsViewDelegate* delegate,
RenderViewHostDelegateView** render_view_host_delegate_view) {
@@ -92,61 +92,6 @@ WebContentsViewMac::~WebContentsViewMac() {
[cocoa_view_ clearWebContentsView];
}
-void WebContentsViewMac::CreateView(
- const gfx::Size& initial_size, gfx::NativeView context) {
- WebContentsViewCocoa* view =
- [[WebContentsViewCocoa alloc] initWithWebContentsViewMac:this];
- cocoa_view_.reset(view);
-}
-
-RenderWidgetHostView* WebContentsViewMac::CreateViewForWidget(
- RenderWidgetHost* render_widget_host) {
- if (render_widget_host->GetView()) {
- // During testing, the view will already be set up in most cases to the
- // test view, so we don't want to clobber it with a real one. To verify that
- // this actually is happening (and somebody isn't accidentally creating the
- // view twice), we check for the RVH Factory, which will be set when we're
- // making special ones (which go along with the special views).
- DCHECK(RenderViewHostFactory::has_factory());
- return render_widget_host->GetView();
- }
-
- RenderWidgetHostViewMac* view = static_cast<RenderWidgetHostViewMac*>(
- RenderWidgetHostView::CreateViewForWidget(render_widget_host));
- if (delegate()) {
- NSObject<RenderWidgetHostViewMacDelegate>* rw_delegate =
- delegate()->CreateRenderWidgetHostViewDelegate(render_widget_host);
- view->SetDelegate(rw_delegate);
- }
- view->SetAllowOverlappingViews(allow_overlapping_views_);
-
- // Fancy layout comes later; for now just make it our size and resize it
- // with us. In case there are other siblings of the content area, we want
- // to make sure the content area is on the bottom so other things draw over
- // it.
- NSView* view_view = view->GetNativeView();
- [view_view setFrame:[cocoa_view_.get() bounds]];
- [view_view setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable];
- // Add the new view below all other views; this also keeps it below any
- // overlay view installed.
- [cocoa_view_.get() addSubview:view_view
- positioned:NSWindowBelow
- relativeTo:nil];
- // For some reason known only to Cocoa, the autorecalculation of the key view
- // loop set on the window doesn't set the next key view when the subview is
- // added. On 10.6 things magically work fine; on 10.5 they fail
- // <http://crbug.com/61493>. Digging into Cocoa key view loop code yielded
- // madness; TODO(avi,rohit): look at this again and figure out what's really
- // going on.
- [cocoa_view_.get() setNextKeyView:view_view];
- return view;
-}
-
-RenderWidgetHostView* WebContentsViewMac::CreateViewForPopupWidget(
- RenderWidgetHost* render_widget_host) {
- return RenderWidgetHostViewPort::CreateViewForWidget(render_widget_host);
-}
-
gfx::NativeView WebContentsViewMac::GetNativeView() const {
return cocoa_view_.get();
}
@@ -203,20 +148,6 @@ void WebContentsViewMac::StartDragging(
offset:offset];
}
-void WebContentsViewMac::RenderViewCreated(RenderViewHost* host) {
- // We want updates whenever the intrinsic width of the webpage changes.
- // Put the RenderView into that mode. The preferred width is used for example
- // when the "zoom" button in the browser window is clicked.
- host->EnablePreferredSizeMode();
-}
-
-void WebContentsViewMac::RenderViewSwappedIn(RenderViewHost* host) {
-}
-
-void WebContentsViewMac::SetPageTitle(const string16& title) {
- // Meaningless on the Mac; widgets don't have a "title" attribute
-}
-
void WebContentsViewMac::OnTabCrashed(base::TerminationStatus /* status */,
int /* error_code */) {
}
@@ -321,21 +252,6 @@ void WebContentsViewMac::ShowPopupMenu(
allow_multiple_selection);
}
-bool WebContentsViewMac::IsEventTracking() const {
- return base::MessagePumpMac::IsHandlingSendEvent();
-}
-
-// Arrange to call CloseTab() after we're back to the main event loop.
-// The obvious way to do this would be PostNonNestableTask(), but that
-// will fire when the event-tracking loop polls for events. So we
-// need to bounce the message via Cocoa, instead.
-void WebContentsViewMac::CloseTabAfterEventTracking() {
- [cocoa_view_ cancelDeferredClose];
- [cocoa_view_ performSelector:@selector(closeTabAfterEvent)
- withObject:nil
- afterDelay:0.0];
-}
-
gfx::Rect WebContentsViewMac::GetViewBounds() const {
// This method is not currently used on mac.
NOTIMPLEMENTED();
@@ -353,6 +269,91 @@ void WebContentsViewMac::SetAllowOverlappingViews(bool overlapping) {
view->SetAllowOverlappingViews(allow_overlapping_views_);
}
+void WebContentsViewMac::CreateView(
+ const gfx::Size& initial_size, gfx::NativeView context) {
+ WebContentsViewCocoa* view =
+ [[WebContentsViewCocoa alloc] initWithWebContentsViewMac:this];
+ cocoa_view_.reset(view);
+}
+
+RenderWidgetHostView* WebContentsViewMac::CreateViewForWidget(
+ RenderWidgetHost* render_widget_host) {
+ if (render_widget_host->GetView()) {
+ // During testing, the view will already be set up in most cases to the
+ // test view, so we don't want to clobber it with a real one. To verify that
+ // this actually is happening (and somebody isn't accidentally creating the
+ // view twice), we check for the RVH Factory, which will be set when we're
+ // making special ones (which go along with the special views).
+ DCHECK(RenderViewHostFactory::has_factory());
+ return render_widget_host->GetView();
+ }
+
+ RenderWidgetHostViewMac* view = static_cast<RenderWidgetHostViewMac*>(
+ RenderWidgetHostView::CreateViewForWidget(render_widget_host));
+ if (delegate()) {
+ NSObject<RenderWidgetHostViewMacDelegate>* rw_delegate =
+ delegate()->CreateRenderWidgetHostViewDelegate(render_widget_host);
+ view->SetDelegate(rw_delegate);
+ }
+ view->SetAllowOverlappingViews(allow_overlapping_views_);
+
+ // Fancy layout comes later; for now just make it our size and resize it
+ // with us. In case there are other siblings of the content area, we want
+ // to make sure the content area is on the bottom so other things draw over
+ // it.
+ NSView* view_view = view->GetNativeView();
+ [view_view setFrame:[cocoa_view_.get() bounds]];
+ [view_view setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable];
+ // Add the new view below all other views; this also keeps it below any
+ // overlay view installed.
+ [cocoa_view_.get() addSubview:view_view
+ positioned:NSWindowBelow
+ relativeTo:nil];
+ // For some reason known only to Cocoa, the autorecalculation of the key view
+ // loop set on the window doesn't set the next key view when the subview is
+ // added. On 10.6 things magically work fine; on 10.5 they fail
+ // <http://crbug.com/61493>. Digging into Cocoa key view loop code yielded
+ // madness; TODO(avi,rohit): look at this again and figure out what's really
+ // going on.
+ [cocoa_view_.get() setNextKeyView:view_view];
+ return view;
+}
+
+RenderWidgetHostView* WebContentsViewMac::CreateViewForPopupWidget(
+ RenderWidgetHost* render_widget_host) {
+ return RenderWidgetHostViewPort::CreateViewForWidget(render_widget_host);
+}
+
+void WebContentsViewMac::SetPageTitle(const string16& title) {
+ // Meaningless on the Mac; widgets don't have a "title" attribute
+}
+
+
+void WebContentsViewMac::RenderViewCreated(RenderViewHost* host) {
+ // We want updates whenever the intrinsic width of the webpage changes.
+ // Put the RenderView into that mode. The preferred width is used for example
+ // when the "zoom" button in the browser window is clicked.
+ host->EnablePreferredSizeMode();
+}
+
+void WebContentsViewMac::RenderViewSwappedIn(RenderViewHost* host) {
+}
+
+bool WebContentsViewMac::IsEventTracking() const {
+ return base::MessagePumpMac::IsHandlingSendEvent();
+}
+
+// Arrange to call CloseTab() after we're back to the main event loop.
+// The obvious way to do this would be PostNonNestableTask(), but that
+// will fire when the event-tracking loop polls for events. So we
+// need to bounce the message via Cocoa, instead.
+void WebContentsViewMac::CloseTabAfterEventTracking() {
+ [cocoa_view_ cancelDeferredClose];
+ [cocoa_view_ performSelector:@selector(closeTabAfterEvent)
+ withObject:nil
+ afterDelay:0.0];
+}
+
void WebContentsViewMac::CloseTab() {
web_contents_->Close(web_contents_->GetRenderViewHost());
}
diff --git a/content/browser/web_contents/web_contents_view_win.cc b/content/browser/web_contents/web_contents_view_win.cc
index 67186e78..899dadb 100644
--- a/content/browser/web_contents/web_contents_view_win.cc
+++ b/content/browser/web_contents/web_contents_view_win.cc
@@ -20,7 +20,7 @@
#include "ui/gfx/screen.h"
namespace content {
-WebContentsView* CreateWebContentsView(
+WebContentsViewPort* CreateWebContentsView(
WebContentsImpl* web_contents,
WebContentsViewDelegate* delegate,
RenderViewHostDelegateView** render_view_host_delegate_view) {
@@ -101,49 +101,6 @@ WebContentsViewWin::~WebContentsViewWin() {
DestroyWindow(hwnd());
}
-void WebContentsViewWin::CreateView(
- const gfx::Size& initial_size, gfx::NativeView context) {
- initial_size_ = initial_size;
-
- set_window_style(WS_VISIBLE | WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS);
-
- Init(ui::GetHiddenWindow(), gfx::Rect(initial_size_));
-
- // Remove the root view drop target so we can register our own.
- RevokeDragDrop(GetNativeView());
- drag_dest_ = new WebDragDest(hwnd(), web_contents_);
- if (delegate_.get()) {
- WebDragDestDelegate* delegate = delegate_->GetDragDestDelegate();
- if (delegate)
- drag_dest_->set_delegate(delegate);
- }
-}
-
-RenderWidgetHostView* WebContentsViewWin::CreateViewForWidget(
- RenderWidgetHost* render_widget_host) {
- if (render_widget_host->GetView()) {
- // During testing, the view will already be set up in most cases to the
- // test view, so we don't want to clobber it with a real one. To verify that
- // this actually is happening (and somebody isn't accidentally creating the
- // view twice), we check for the RVH Factory, which will be set when we're
- // making special ones (which go along with the special views).
- DCHECK(RenderViewHostFactory::has_factory());
- return render_widget_host->GetView();
- }
-
- RenderWidgetHostViewWin* view = static_cast<RenderWidgetHostViewWin*>(
- RenderWidgetHostView::CreateViewForWidget(render_widget_host));
- view->CreateWnd(GetNativeView());
- view->ShowWindow(SW_SHOW);
- view->SetSize(initial_size_);
- return view;
-}
-
-RenderWidgetHostView* WebContentsViewWin::CreateViewForPopupWidget(
- RenderWidgetHost* render_widget_host) {
- return RenderWidgetHostViewPort::CreateViewForWidget(render_widget_host);
-}
-
gfx::NativeView WebContentsViewWin::GetNativeView() const {
return hwnd();
}
@@ -166,12 +123,6 @@ void WebContentsViewWin::GetContainerBounds(gfx::Rect *out) const {
*out = gfx::Rect(point.x, point.y, r.right - r.left, r.bottom - r.top);
}
-void WebContentsViewWin::SetPageTitle(const string16& title) {
- // It's possible to get this after the hwnd has been destroyed.
- if (GetNativeView())
- ::SetWindowText(GetNativeView(), title.c_str());
-}
-
void WebContentsViewWin::OnTabCrashed(base::TerminationStatus status,
int error_code) {
}
@@ -193,10 +144,22 @@ void WebContentsViewWin::SizeContents(const gfx::Size& size) {
}
}
-void WebContentsViewWin::RenderViewCreated(RenderViewHost* host) {
-}
+void WebContentsViewWin::CreateView(
+ const gfx::Size& initial_size, gfx::NativeView context) {
+ initial_size_ = initial_size;
-void WebContentsViewWin::RenderViewSwappedIn(RenderViewHost* host) {
+ set_window_style(WS_VISIBLE | WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS);
+
+ Init(ui::GetHiddenWindow(), gfx::Rect(initial_size_));
+
+ // Remove the root view drop target so we can register our own.
+ RevokeDragDrop(GetNativeView());
+ drag_dest_ = new WebDragDest(hwnd(), web_contents_);
+ if (delegate_.get()) {
+ WebDragDestDelegate* delegate = delegate_->GetDragDestDelegate();
+ if (delegate)
+ drag_dest_->set_delegate(delegate);
+ }
}
void WebContentsViewWin::Focus() {
@@ -234,19 +197,49 @@ WebDropData* WebContentsViewWin::GetDropData() const {
return drag_dest_->current_drop_data();
}
-bool WebContentsViewWin::IsEventTracking() const {
- return false;
-}
-
-void WebContentsViewWin::CloseTabAfterEventTracking() {
-}
-
gfx::Rect WebContentsViewWin::GetViewBounds() const {
RECT r;
GetWindowRect(hwnd(), &r);
return gfx::Rect(r);
}
+RenderWidgetHostView* WebContentsViewWin::CreateViewForWidget(
+ RenderWidgetHost* render_widget_host) {
+ if (render_widget_host->GetView()) {
+ // During testing, the view will already be set up in most cases to the
+ // test view, so we don't want to clobber it with a real one. To verify that
+ // this actually is happening (and somebody isn't accidentally creating the
+ // view twice), we check for the RVH Factory, which will be set when we're
+ // making special ones (which go along with the special views).
+ DCHECK(RenderViewHostFactory::has_factory());
+ return render_widget_host->GetView();
+ }
+
+ RenderWidgetHostViewWin* view = static_cast<RenderWidgetHostViewWin*>(
+ RenderWidgetHostView::CreateViewForWidget(render_widget_host));
+ view->CreateWnd(GetNativeView());
+ view->ShowWindow(SW_SHOW);
+ view->SetSize(initial_size_);
+ return view;
+}
+
+RenderWidgetHostView* WebContentsViewWin::CreateViewForPopupWidget(
+ RenderWidgetHost* render_widget_host) {
+ return RenderWidgetHostViewPort::CreateViewForWidget(render_widget_host);
+}
+
+void WebContentsViewWin::SetPageTitle(const string16& title) {
+ // It's possible to get this after the hwnd has been destroyed.
+ if (GetNativeView())
+ ::SetWindowText(GetNativeView(), title.c_str());
+}
+
+void WebContentsViewWin::RenderViewCreated(RenderViewHost* host) {
+}
+
+void WebContentsViewWin::RenderViewSwappedIn(RenderViewHost* host) {
+}
+
void WebContentsViewWin::ShowContextMenu(
const ContextMenuParams& params,
ContextMenuSourceType type) {
diff --git a/content/browser/web_contents/web_contents_view_win.h b/content/browser/web_contents/web_contents_view_win.h
index 7325124..5734892 100644
--- a/content/browser/web_contents/web_contents_view_win.h
+++ b/content/browser/web_contents/web_contents_view_win.h
@@ -52,31 +52,29 @@ class CONTENT_EXPORT WebContentsViewWin
END_MSG_MAP()
// Overridden from WebContentsView:
- virtual void CreateView(
- const gfx::Size& initial_size, gfx::NativeView context) OVERRIDE;
- virtual RenderWidgetHostView* CreateViewForWidget(
- RenderWidgetHost* render_widget_host) OVERRIDE;
- virtual RenderWidgetHostView* CreateViewForPopupWidget(
- RenderWidgetHost* render_widget_host) OVERRIDE;
virtual gfx::NativeView GetNativeView() const OVERRIDE;
virtual gfx::NativeView GetContentNativeView() const OVERRIDE;
virtual gfx::NativeWindow GetTopLevelNativeWindow() const OVERRIDE;
virtual void GetContainerBounds(gfx::Rect *out) const OVERRIDE;
- virtual void SetPageTitle(const string16& title) OVERRIDE;
virtual void OnTabCrashed(base::TerminationStatus status,
int error_code) OVERRIDE;
virtual void SizeContents(const gfx::Size& size) OVERRIDE;
- virtual void RenderViewCreated(RenderViewHost* host) OVERRIDE;
virtual void Focus() OVERRIDE;
virtual void SetInitialFocus() OVERRIDE;
virtual void StoreFocus() OVERRIDE;
virtual void RestoreFocus() OVERRIDE;
virtual WebDropData* GetDropData() const OVERRIDE;
- virtual bool IsEventTracking() const OVERRIDE;
- virtual void CloseTabAfterEventTracking() OVERRIDE;
virtual gfx::Rect GetViewBounds() const OVERRIDE;
// Overridden from WebContentsViewPort:
+ virtual void CreateView(
+ const gfx::Size& initial_size, gfx::NativeView context) OVERRIDE;
+ virtual RenderWidgetHostView* CreateViewForWidget(
+ RenderWidgetHost* render_widget_host) OVERRIDE;
+ virtual RenderWidgetHostView* CreateViewForPopupWidget(
+ RenderWidgetHost* render_widget_host) OVERRIDE;
+ virtual void SetPageTitle(const string16& title) OVERRIDE;
+ virtual void RenderViewCreated(RenderViewHost* host) OVERRIDE;
virtual void RenderViewSwappedIn(RenderViewHost* host) OVERRIDE;
// Implementation of RenderViewHostDelegateView.
diff --git a/content/port/browser/web_contents_view_port.h b/content/port/browser/web_contents_view_port.h
index a3f699a..631fe57 100644
--- a/content/port/browser/web_contents_view_port.h
+++ b/content/port/browser/web_contents_view_port.h
@@ -8,6 +8,9 @@
#include "content/public/browser/web_contents_view.h"
namespace content {
+class RenderViewHost;
+class RenderWidgetHost;
+class RenderWidgetHostView;
// This is the larger WebContentsView interface exposed only within content/ and
// to embedders looking to port to new platforms.
@@ -15,9 +18,42 @@ class CONTENT_EXPORT WebContentsViewPort : public WebContentsView {
public:
virtual ~WebContentsViewPort() {}
+ virtual void CreateView(
+ const gfx::Size& initial_size, gfx::NativeView context) = 0;
+
+ // Sets up the View that holds the rendered web page, receives messages for
+ // it and contains page plugins. The host view should be sized to the current
+ // size of the WebContents.
+ virtual RenderWidgetHostView* CreateViewForWidget(
+ RenderWidgetHost* render_widget_host) = 0;
+
+ // Creates a new View that holds a popup and receives messages for it.
+ virtual RenderWidgetHostView* CreateViewForPopupWidget(
+ RenderWidgetHost* render_widget_host) = 0;
+
+ // Sets the page title for the native widgets corresponding to the view. This
+ // is not strictly necessary and isn't expected to be displayed anywhere, but
+ // can aid certain debugging tools such as Spy++ on Windows where you are
+ // trying to find a specific window.
+ virtual void SetPageTitle(const string16& title) = 0;
+
+ // Invoked when the WebContents is notified that the RenderView has been
+ // fully created.
+ virtual void RenderViewCreated(RenderViewHost* host) = 0;
+
// Invoked when the WebContents is notified that the RenderView has been
// swapped in.
virtual void RenderViewSwappedIn(RenderViewHost* host) = 0;
+
+#if defined(OS_MACOSX)
+ // If we close the tab while a UI control is in an event-tracking
+ // loop, the control may message freed objects and crash.
+ // WebContents::Close() calls IsEventTracking(), and if it returns
+ // true CloseTabAfterEventTracking() is called and the close is not
+ // completed.
+ virtual bool IsEventTracking() const = 0;
+ virtual void CloseTabAfterEventTracking() = 0;
+#endif
};
} // namespace content
diff --git a/content/public/browser/content_browser_client.cc b/content/public/browser/content_browser_client.cc
index 1b07240..00b62a7 100644
--- a/content/public/browser/content_browser_client.cc
+++ b/content/public/browser/content_browser_client.cc
@@ -15,7 +15,7 @@ BrowserMainParts* ContentBrowserClient::CreateBrowserMainParts(
return NULL;
}
-WebContentsView* ContentBrowserClient::OverrideCreateWebContentsView(
+WebContentsViewPort* ContentBrowserClient::OverrideCreateWebContentsView(
WebContents* web_contents,
RenderViewHostDelegateView** render_view_host_delegate_view) {
return NULL;
diff --git a/content/public/browser/content_browser_client.h b/content/public/browser/content_browser_client.h
index 9dfee48..f4cd21b 100644
--- a/content/public/browser/content_browser_client.h
+++ b/content/public/browser/content_browser_client.h
@@ -76,8 +76,8 @@ class ResourceContext;
class SiteInstance;
class SpeechRecognitionManagerDelegate;
class WebContents;
-class WebContentsView;
class WebContentsViewDelegate;
+class WebContentsViewPort;
struct MainFunctionParams;
struct ShowDesktopNotificationHostMsgParams;
@@ -99,11 +99,11 @@ class CONTENT_EXPORT ContentBrowserClient {
virtual BrowserMainParts* CreateBrowserMainParts(
const MainFunctionParams& parameters);
- // Allows an embedder to return their own WebContentsView implementation.
+ // Allows an embedder to return their own WebContentsViewPort implementation.
// Return NULL to let the default one for the platform be created. Otherwise
// |render_view_host_delegate_view| also needs to be provided, and it is
// owned by the embedder.
- virtual WebContentsView* OverrideCreateWebContentsView(
+ virtual WebContentsViewPort* OverrideCreateWebContentsView(
WebContents* web_contents,
RenderViewHostDelegateView** render_view_host_delegate_view);
diff --git a/content/public/browser/web_contents_view.h b/content/public/browser/web_contents_view.h
index ba54c22..d0a7309 100644
--- a/content/public/browser/web_contents_view.h
+++ b/content/public/browser/web_contents_view.h
@@ -18,10 +18,6 @@ struct WebDropData;
namespace content {
-class RenderViewHost;
-class RenderWidgetHost;
-class RenderWidgetHostView;
-
// The WebContentsView is an interface that is implemented by the platform-
// dependent web contents views. The WebContents uses this interface to talk to
// them.
@@ -29,19 +25,6 @@ class CONTENT_EXPORT WebContentsView {
public:
virtual ~WebContentsView() {}
- virtual void CreateView(
- const gfx::Size& initial_size, gfx::NativeView context) = 0;
-
- // Sets up the View that holds the rendered web page, receives messages for
- // it and contains page plugins. The host view should be sized to the current
- // size of the WebContents.
- virtual RenderWidgetHostView* CreateViewForWidget(
- RenderWidgetHost* render_widget_host) = 0;
-
- // Creates a new View that holds a popup and receives messages for it.
- virtual RenderWidgetHostView* CreateViewForPopupWidget(
- RenderWidgetHost* render_widget_host) = 0;
-
// Returns the native widget that contains the contents of the tab.
virtual gfx::NativeView GetNativeView() const = 0;
@@ -66,12 +49,6 @@ class CONTENT_EXPORT WebContentsView {
return gfx::Size(rc.width(), rc.height());
}
- // Sets the page title for the native widgets corresponding to the view. This
- // is not strictly necessary and isn't expected to be displayed anywhere, but
- // can aid certain debugging tools such as Spy++ on Windows where you are
- // trying to find a specific window.
- virtual void SetPageTitle(const string16& title) = 0;
-
// Used to notify the view that a tab has crashed.
virtual void OnTabCrashed(base::TerminationStatus status, int error_code) = 0;
@@ -85,10 +62,6 @@ class CONTENT_EXPORT WebContentsView {
// WebContents without the special code.
virtual void SizeContents(const gfx::Size& size) = 0;
- // Invoked when the WebContents is notified that the RenderView has been
- // fully created.
- virtual void RenderViewCreated(RenderViewHost* host) = 0;
-
// Sets focus to the native widget for this tab.
virtual void Focus() = 0;
@@ -106,14 +79,6 @@ class CONTENT_EXPORT WebContentsView {
// Returns the current drop data, if any.
virtual WebDropData* GetDropData() const = 0;
- // If we close the tab while a UI control is in an event-tracking
- // loop, the control may message freed objects and crash.
- // WebContents::Close() calls IsEventTracking(), and if it returns
- // true CloseTabAfterEventTracking() is called and the close is not
- // completed.
- virtual bool IsEventTracking() const = 0;
- virtual void CloseTabAfterEventTracking() = 0;
-
// Get the bounds of the View, relative to the parent.
virtual gfx::Rect GetViewBounds() const = 0;
diff --git a/content/test/test_content_browser_client.cc b/content/test/test_content_browser_client.cc
index 05dcd12..5754fd2 100644
--- a/content/test/test_content_browser_client.cc
+++ b/content/test/test_content_browser_client.cc
@@ -19,7 +19,7 @@ TestContentBrowserClient::TestContentBrowserClient() {
TestContentBrowserClient::~TestContentBrowserClient() {
}
-WebContentsView* TestContentBrowserClient::OverrideCreateWebContentsView(
+WebContentsViewPort* TestContentBrowserClient::OverrideCreateWebContentsView(
WebContents* web_contents,
RenderViewHostDelegateView** render_view_host_delegate_view) {
#if defined(OS_IOS)
diff --git a/content/test/test_content_browser_client.h b/content/test/test_content_browser_client.h
index b8b9276..f0d58bb 100644
--- a/content/test/test_content_browser_client.h
+++ b/content/test/test_content_browser_client.h
@@ -20,7 +20,7 @@ class TestContentBrowserClient : public ContentBrowserClient {
TestContentBrowserClient();
virtual ~TestContentBrowserClient();
- virtual WebContentsView* OverrideCreateWebContentsView(
+ virtual WebContentsViewPort* OverrideCreateWebContentsView(
WebContents* web_contents,
RenderViewHostDelegateView** render_view_host_delegate_view) OVERRIDE;
virtual base::FilePath GetDefaultDownloadDirectory() OVERRIDE;
diff --git a/content/test/test_web_contents_view.cc b/content/test/test_web_contents_view.cc
index e00bd6e..3658f74 100644
--- a/content/test/test_web_contents_view.cc
+++ b/content/test/test_web_contents_view.cc
@@ -42,20 +42,6 @@ void TestWebContentsView::GotFocus() {
void TestWebContentsView::TakeFocus(bool reverse) {
}
-void TestWebContentsView::CreateView(const gfx::Size& initial_size,
- gfx::NativeView context) {
-}
-
-RenderWidgetHostView* TestWebContentsView::CreateViewForWidget(
- RenderWidgetHost* render_widget_host) {
- return NULL;
-}
-
-RenderWidgetHostView* TestWebContentsView::CreateViewForPopupWidget(
- RenderWidgetHost* render_widget_host) {
- return NULL;
-}
-
gfx::NativeView TestWebContentsView::GetNativeView() const {
return gfx::NativeView();
}
@@ -71,9 +57,6 @@ gfx::NativeWindow TestWebContentsView::GetTopLevelNativeWindow() const {
void TestWebContentsView::GetContainerBounds(gfx::Rect *out) const {
}
-void TestWebContentsView::SetPageTitle(const string16& title) {
-}
-
void TestWebContentsView::OnTabCrashed(base::TerminationStatus status,
int error_code) {
}
@@ -81,12 +64,6 @@ void TestWebContentsView::OnTabCrashed(base::TerminationStatus status,
void TestWebContentsView::SizeContents(const gfx::Size& size) {
}
-void TestWebContentsView::RenderViewCreated(RenderViewHost* host) {
-}
-
-void TestWebContentsView::RenderViewSwappedIn(RenderViewHost* host) {
-}
-
void TestWebContentsView::Focus() {
}
@@ -103,19 +80,44 @@ WebDropData* TestWebContentsView::GetDropData() const {
return NULL;
}
-bool TestWebContentsView::IsEventTracking() const {
- return false;
+gfx::Rect TestWebContentsView::GetViewBounds() const {
+ return gfx::Rect();
}
-void TestWebContentsView::CloseTabAfterEventTracking() {
+#if defined(OS_MACOSX)
+void TestWebContentsView::SetAllowOverlappingViews(bool overlapping) {
}
+#endif
-gfx::Rect TestWebContentsView::GetViewBounds() const {
- return gfx::Rect();
+void TestWebContentsView::CreateView(const gfx::Size& initial_size,
+ gfx::NativeView context) {
+}
+
+RenderWidgetHostView* TestWebContentsView::CreateViewForWidget(
+ RenderWidgetHost* render_widget_host) {
+ return NULL;
+}
+
+RenderWidgetHostView* TestWebContentsView::CreateViewForPopupWidget(
+ RenderWidgetHost* render_widget_host) {
+ return NULL;
+}
+
+void TestWebContentsView::SetPageTitle(const string16& title) {
+}
+
+void TestWebContentsView::RenderViewCreated(RenderViewHost* host) {
+}
+
+void TestWebContentsView::RenderViewSwappedIn(RenderViewHost* host) {
}
#if defined(OS_MACOSX)
-void TestWebContentsView::SetAllowOverlappingViews(bool overlapping) {
+bool TestWebContentsView::IsEventTracking() const {
+ return false;
+}
+
+void TestWebContentsView::CloseTabAfterEventTracking() {
}
#endif
diff --git a/content/test/test_web_contents_view.h b/content/test/test_web_contents_view.h
index 97ab618..dfb791a 100644
--- a/content/test/test_web_contents_view.h
+++ b/content/test/test_web_contents_view.h
@@ -37,35 +37,37 @@ class TestWebContentsView : public WebContentsViewPort,
virtual void TakeFocus(bool reverse) OVERRIDE;
// WebContentsView:
- virtual void CreateView(const gfx::Size& initial_size,
- gfx::NativeView context) OVERRIDE;
- virtual RenderWidgetHostView* CreateViewForWidget(
- RenderWidgetHost* render_widget_host) OVERRIDE;
- virtual RenderWidgetHostView* CreateViewForPopupWidget(
- RenderWidgetHost* render_widget_host) OVERRIDE;
virtual gfx::NativeView GetNativeView() const OVERRIDE;
virtual gfx::NativeView GetContentNativeView() const OVERRIDE;
virtual gfx::NativeWindow GetTopLevelNativeWindow() const OVERRIDE;
virtual void GetContainerBounds(gfx::Rect *out) const OVERRIDE;
- virtual void SetPageTitle(const string16& title) OVERRIDE;
virtual void OnTabCrashed(base::TerminationStatus status,
int error_code) OVERRIDE;
virtual void SizeContents(const gfx::Size& size) OVERRIDE;
- virtual void RenderViewCreated(RenderViewHost* host) OVERRIDE;
virtual void Focus() OVERRIDE;
virtual void SetInitialFocus() OVERRIDE;
virtual void StoreFocus() OVERRIDE;
virtual void RestoreFocus() OVERRIDE;
virtual WebDropData* GetDropData() const OVERRIDE;
- virtual bool IsEventTracking() const OVERRIDE;
- virtual void CloseTabAfterEventTracking() OVERRIDE;
virtual gfx::Rect GetViewBounds() const OVERRIDE;
#if defined(OS_MACOSX)
virtual void SetAllowOverlappingViews(bool overlapping) OVERRIDE;
#endif
// WebContentsViewPort:
+ virtual void CreateView(const gfx::Size& initial_size,
+ gfx::NativeView context) OVERRIDE;
+ virtual RenderWidgetHostView* CreateViewForWidget(
+ RenderWidgetHost* render_widget_host) OVERRIDE;
+ virtual RenderWidgetHostView* CreateViewForPopupWidget(
+ RenderWidgetHost* render_widget_host) OVERRIDE;
+ virtual void SetPageTitle(const string16& title) OVERRIDE;
+ virtual void RenderViewCreated(RenderViewHost* host) OVERRIDE;
virtual void RenderViewSwappedIn(RenderViewHost* host) OVERRIDE;
+#if defined(OS_MACOSX)
+ virtual bool IsEventTracking() const OVERRIDE;
+ virtual void CloseTabAfterEventTracking() OVERRIDE;
+#endif
private:
DISALLOW_COPY_AND_ASSIGN(TestWebContentsView);