Hide WebContentsView from Chrome. This also removes WebContentsViewPort.
TestWebContentsView goes away since it's not needed anymore
BUG=304341
[email protected], [email protected]
Review URL: https://codereview.chromium.org/262823006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@268072 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/content/public/browser/content_browser_client.cc b/content/public/browser/content_browser_client.cc
index ba80b8f..fb8279bc 100644
--- a/content/public/browser/content_browser_client.cc
+++ b/content/public/browser/content_browser_client.cc
@@ -15,12 +15,6 @@
return NULL;
}
-WebContentsViewPort* ContentBrowserClient::OverrideCreateWebContentsView(
- WebContents* web_contents,
- RenderViewHostDelegateView** render_view_host_delegate_view) {
- return NULL;
-}
-
WebContentsViewDelegate* ContentBrowserClient::GetWebContentsViewDelegate(
WebContents* web_contents) {
return NULL;
diff --git a/content/public/browser/content_browser_client.h b/content/public/browser/content_browser_client.h
index ac40ae2..5f0473b 100644
--- a/content/public/browser/content_browser_client.h
+++ b/content/public/browser/content_browser_client.h
@@ -95,14 +95,12 @@
class RenderFrameHost;
class RenderProcessHost;
class RenderViewHost;
-class RenderViewHostDelegateView;
class ResourceContext;
class SiteInstance;
class SpeechRecognitionManagerDelegate;
class VibrationProvider;
class WebContents;
class WebContentsViewDelegate;
-class WebContentsViewPort;
struct MainFunctionParams;
struct Referrer;
struct ShowDesktopNotificationHostMsgParams;
@@ -135,14 +133,6 @@
virtual BrowserMainParts* CreateBrowserMainParts(
const MainFunctionParams& parameters);
- // 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 WebContentsViewPort* OverrideCreateWebContentsView(
- WebContents* web_contents,
- RenderViewHostDelegateView** render_view_host_delegate_view);
-
// If content creates the WebContentsView implementation, it will ask the
// embedder to return an (optional) delegate to customize it. The view will
// own the delegate.
diff --git a/content/public/browser/web_contents.h b/content/public/browser/web_contents.h
index 0e0ed9b..fd31c1a 100644
--- a/content/public/browser/web_contents.h
+++ b/content/public/browser/web_contents.h
@@ -23,7 +23,7 @@
#include "third_party/skia/include/core/SkColor.h"
#include "ui/base/window_open_disposition.h"
#include "ui/gfx/native_widget_types.h"
-#include "ui/gfx/size.h"
+#include "ui/gfx/rect.h"
#if defined(OS_ANDROID)
#include "base/android/scoped_java_ref.h"
@@ -37,11 +37,6 @@
struct WebFindOptions;
}
-namespace gfx {
-class Rect;
-class Size;
-}
-
namespace net {
struct LoadStateWithParam;
}
@@ -57,8 +52,8 @@
class RenderWidgetHostView;
class SiteInstance;
class WebContentsDelegate;
-class WebContentsView;
struct CustomContextMenuContext;
+struct DropData;
struct RendererPreferences;
// WebContents is the core class in content/. A WebContents renders web content
@@ -68,7 +63,7 @@
// scoped_ptr<content::WebContents> web_contents(
// content::WebContents::Create(
// content::WebContents::CreateParams(browser_context)));
-// gfx::NativeView view = web_contents->GetView()->GetNativeView();
+// gfx::NativeView view = web_contents->GetNativeView();
// // |view| is an HWND, NSView*, GtkWidget*, etc.; insert it into the view
// // hierarchy wherever it needs to go.
//
@@ -210,9 +205,6 @@
// NULL.
virtual RenderWidgetHostView* GetFullscreenRenderWidgetHostView() const = 0;
- // The WebContentsView will never change and is guaranteed non-NULL.
- virtual WebContentsView* GetView() const = 0;
-
// Create a WebUI page for the given url. In most cases, this doesn't need to
// be called by embedders since content will create its own WebUI objects as
// necessary. However if the embedder wants to create its own WebUI object and
@@ -372,6 +364,42 @@
// Views and focus -----------------------------------------------------------
+ // Returns the native widget that contains the contents of the tab.
+ virtual gfx::NativeView GetNativeView() = 0;
+
+ // Returns the native widget with the main content of the tab (i.e. the main
+ // render view host, though there may be many popups in the tab as children of
+ // the container).
+ virtual gfx::NativeView GetContentNativeView() = 0;
+
+ // Returns the outermost native view. This will be used as the parent for
+ // dialog boxes.
+ virtual gfx::NativeWindow GetTopLevelNativeWindow() = 0;
+
+ // Computes the rectangle for the native widget that contains the contents of
+ // the tab in the screen coordinate system.
+ virtual gfx::Rect GetContainerBounds() = 0;
+
+ // Get the bounds of the View, relative to the parent.
+ virtual gfx::Rect GetViewBounds() = 0;
+
+ // Returns the current drop data, if any.
+ virtual DropData* GetDropData() = 0;
+
+ // Sets focus to the native widget for this tab.
+ virtual void Focus() = 0;
+
+ // Sets focus to the appropriate element when the WebContents is shown the
+ // first time.
+ virtual void SetInitialFocus() = 0;
+
+ // Stores the currently focused view.
+ virtual void StoreFocus() = 0;
+
+ // Restores focus to the last focus view. If StoreFocus has not yet been
+ // invoked, SetInitialFocus is invoked.
+ virtual void RestoreFocus() = 0;
+
// Focuses the first (last if |reverse| is true) element in the page.
// Invoked when this tab is getting the focus through tab traversal (|reverse|
// is true when using Shift-Tab).
@@ -545,6 +573,24 @@
CONTENT_EXPORT static WebContents* FromJavaWebContents(
jobject jweb_contents_android);
virtual base::android::ScopedJavaLocalRef<jobject> GetJavaWebContents() = 0;
+#elif defined(OS_MACOSX)
+ // The web contents view assumes that its view will never be overlapped by
+ // another view (either partially or fully). This allows it to perform
+ // optimizations. If the view is in a view hierarchy where it might be
+ // overlapped by another view, notify the view by calling this with |true|.
+ virtual void SetAllowOverlappingViews(bool overlapping) = 0;
+
+ // Returns true if overlapping views are allowed, false otherwise.
+ virtual bool GetAllowOverlappingViews() = 0;
+
+ // To draw two overlapping web contents view, the underlaying one should
+ // know about the overlaying one. Caller must ensure that |overlay| exists
+ // until |RemoveOverlayView| is called.
+ virtual void SetOverlayView(WebContents* overlay,
+ const gfx::Point& offset) = 0;
+
+ // Removes the previously set overlay view.
+ virtual void RemoveOverlayView() = 0;
#endif // OS_ANDROID
private:
diff --git a/content/public/browser/web_contents_delegate.cc b/content/public/browser/web_contents_delegate.cc
index 5346c2ae..9a26e0f 100644
--- a/content/public/browser/web_contents_delegate.cc
+++ b/content/public/browser/web_contents_delegate.cc
@@ -196,7 +196,7 @@
}
gfx::Size WebContentsDelegate::GetSizeForNewRenderView(
- const WebContents* web_contents) const {
+ WebContents* web_contents) const {
return gfx::Size();
}
diff --git a/content/public/browser/web_contents_delegate.h b/content/public/browser/web_contents_delegate.h
index d22d7c7..0edb3bdc 100644
--- a/content/public/browser/web_contents_delegate.h
+++ b/content/public/browser/web_contents_delegate.h
@@ -447,8 +447,7 @@
// This is optional for implementations of WebContentsDelegate; if the
// delegate doesn't provide a size, the current WebContentsView's size will be
// used.
- virtual gfx::Size GetSizeForNewRenderView(
- const WebContents* web_contents) const;
+ virtual gfx::Size GetSizeForNewRenderView(WebContents* web_contents) const;
// Notification that validation of a form displayed by the |web_contents|
// has failed. There can only be one message per |web_contents| at a time.
diff --git a/content/public/browser/web_contents_view.h b/content/public/browser/web_contents_view.h
deleted file mode 100644
index 8405945..0000000
--- a/content/public/browser/web_contents_view.h
+++ /dev/null
@@ -1,107 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_VIEW_H_
-#define CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_VIEW_H_
-
-#include <string>
-
-#include "base/basictypes.h"
-#include "base/process/kill.h"
-#include "content/common/content_export.h"
-#include "ui/gfx/native_widget_types.h"
-#include "ui/gfx/rect.h"
-#include "ui/gfx/size.h"
-
-namespace content {
-struct DropData;
-
-// The WebContentsView is an interface that is implemented by the platform-
-// dependent web contents views. The WebContents uses this interface to talk to
-// them.
-class CONTENT_EXPORT WebContentsView {
- public:
- virtual ~WebContentsView() {}
-
- // Returns the native widget that contains the contents of the tab.
- virtual gfx::NativeView GetNativeView() const = 0;
-
- // Returns the native widget with the main content of the tab (i.e. the main
- // render view host, though there may be many popups in the tab as children of
- // the container).
- virtual gfx::NativeView GetContentNativeView() const = 0;
-
- // Returns the outermost native view. This will be used as the parent for
- // dialog boxes.
- virtual gfx::NativeWindow GetTopLevelNativeWindow() const = 0;
-
- // Computes the rectangle for the native widget that contains the contents of
- // the tab in the screen coordinate system.
- virtual void GetContainerBounds(gfx::Rect* out) const = 0;
-
- // Helper function for GetContainerBounds. Most callers just want to know the
- // size, and this makes it more clear.
- gfx::Size GetContainerSize() const {
- gfx::Rect rc;
- GetContainerBounds(&rc);
- return gfx::Size(rc.width(), rc.height());
- }
-
- // Used to notify the view that a tab has crashed.
- virtual void OnTabCrashed(base::TerminationStatus status, int error_code) = 0;
-
- // TODO(brettw) this is a hack. It's used in two places at the time of this
- // writing: (1) when render view hosts switch, we need to size the replaced
- // one to be correct, since it wouldn't have known about sizes that happened
- // while it was hidden; (2) in constrained windows.
- //
- // (1) will be fixed once interstitials are cleaned up. (2) seems like it
- // should be cleaned up or done some other way, since this works for normal
- // WebContents without the special code.
- virtual void SizeContents(const gfx::Size& size) = 0;
-
- // Sets focus to the native widget for this tab.
- virtual void Focus() = 0;
-
- // Sets focus to the appropriate element when the WebContents is shown the
- // first time.
- virtual void SetInitialFocus() = 0;
-
- // Stores the currently focused view.
- virtual void StoreFocus() = 0;
-
- // Restores focus to the last focus view. If StoreFocus has not yet been
- // invoked, SetInitialFocus is invoked.
- virtual void RestoreFocus() = 0;
-
- // Returns the current drop data, if any.
- virtual DropData* GetDropData() const = 0;
-
- // Get the bounds of the View, relative to the parent.
- virtual gfx::Rect GetViewBounds() const = 0;
-
-#if defined(OS_MACOSX)
- // The web contents view assumes that its view will never be overlapped by
- // another view (either partially or fully). This allows it to perform
- // optimizations. If the view is in a view hierarchy where it might be
- // overlapped by another view, notify the view by calling this with |true|.
- virtual void SetAllowOverlappingViews(bool overlapping) = 0;
-
- // Returns true if overlapping views are allowed, false otherwise.
- virtual bool GetAllowOverlappingViews() const = 0;
-
- // To draw two overlapping web contents view, the underlaying one should
- // know about the overlaying one. Caller must ensure that |overlay| exists
- // until |RemoveOverlayView| is called.
- virtual void SetOverlayView(WebContentsView* overlay,
- const gfx::Point& offset) = 0;
-
- // Removes the previously set overlay view.
- virtual void RemoveOverlayView() = 0;
-#endif
-};
-
-} // namespace content
-
-#endif // CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_VIEW_H_