summaryrefslogtreecommitdiffstats
path: root/content
diff options
context:
space:
mode:
authorjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-02-26 06:09:06 +0000
committerjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-02-26 06:09:06 +0000
commitf3615f0a53ed81a0146c3ff2816ac8432b779cbf (patch)
treecb1565c101fc9c425c8d6848e9bbd4ea62d00078 /content
parentc9e49a0ce0b7e7d0cc4c447f1c81161d28dbfe07 (diff)
downloadchromium_src-f3615f0a53ed81a0146c3ff2816ac8432b779cbf.zip
chromium_src-f3615f0a53ed81a0146c3ff2816ac8432b779cbf.tar.gz
chromium_src-f3615f0a53ed81a0146c3ff2816ac8432b779cbf.tar.bz2
Remove WebContents methods that duplicate WebContentsView methods.
Review URL: https://codereview.chromium.org/12334073 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@184598 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r--content/browser/android/download_controller_android_impl.cc3
-rw-r--r--content/browser/web_contents/web_contents_drag_win.cc3
-rw-r--r--content/browser/web_contents/web_contents_impl.cc22
-rw-r--r--content/browser/web_contents/web_contents_impl.h4
-rw-r--r--content/browser/web_contents/web_contents_view_aura_browsertest.cc10
-rw-r--r--content/public/browser/web_contents.h16
-rw-r--r--content/public/test/web_contents_tester.cc28
-rw-r--r--content/public/test/web_contents_tester.h6
-rw-r--r--content/shell/shell.cc10
-rw-r--r--content/shell/shell_aura.cc3
-rw-r--r--content/shell/shell_devtools_frontend.cc3
-rw-r--r--content/shell/shell_download_manager_delegate.cc2
-rw-r--r--content/shell/shell_gtk.cc6
-rw-r--r--content/shell/shell_web_contents_view_delegate_gtk.cc6
-rw-r--r--content/shell/shell_web_contents_view_delegate_mac.mm8
-rw-r--r--content/shell/shell_web_contents_view_delegate_win.cc6
16 files changed, 37 insertions, 99 deletions
diff --git a/content/browser/android/download_controller_android_impl.cc b/content/browser/android/download_controller_android_impl.cc
index f1a3699..386d6a0 100644
--- a/content/browser/android/download_controller_android_impl.cc
+++ b/content/browser/android/download_controller_android_impl.cc
@@ -18,6 +18,7 @@
#include "content/browser/web_contents/web_contents_impl.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/global_request_id.h"
+#include "content/public/browser/web_contents_view.h"
#include "jni/DownloadController_jni.h"
#include "net/cookies/cookie_options.h"
#include "net/cookies/cookie_store.h"
@@ -311,7 +312,7 @@ ScopedJavaLocalRef<jobject>
if (!web_contents)
return ScopedJavaLocalRef<jobject>();
- ContentViewCore* view_core = web_contents->GetContentNativeView();
+ ContentViewCore* view_core = web_contents->GetView()->GetContentNativeView();
return view_core ? view_core->GetJavaObject() :
ScopedJavaLocalRef<jobject>();
}
diff --git a/content/browser/web_contents/web_contents_drag_win.cc b/content/browser/web_contents/web_contents_drag_win.cc
index cb83dcd..0b7fac4 100644
--- a/content/browser/web_contents/web_contents_drag_win.cc
+++ b/content/browser/web_contents/web_contents_drag_win.cc
@@ -24,6 +24,7 @@
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/content_browser_client.h"
#include "content/public/browser/web_contents.h"
+#include "content/public/browser/web_contents_view.h"
#include "content/public/browser/web_drag_dest_delegate.h"
#include "net/base/net_util.h"
#include "third_party/skia/include/core/SkBitmap.h"
@@ -348,7 +349,7 @@ bool WebContentsDragWin::DoDragging(const WebDropData& drop_data,
// Use a local variable to keep track of the contents view window handle.
// It might not be safe to access the instance after DoDragDrop returns
// because the window could be disposed in the nested message loop.
- HWND native_window = web_contents_->GetNativeView();
+ HWND native_window = web_contents_->GetView()->GetNativeView();
// We need to enable recursive tasks on the message loop so we can get
// updates while in the system DoDragDrop loop.
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
index f4b6aa4..e8e55a7 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -344,7 +344,7 @@ WebContentsImpl::~WebContentsImpl() {
#if defined(OS_WIN) && !defined(USE_AURA)
// If we still have a window handle, destroy it. GetNativeView can return
// NULL if this contents was part of a window that closed.
- if (GetNativeView()) {
+ if (view_->GetNativeView()) {
RenderViewHost* host = GetRenderViewHost();
if (host && host->GetView())
RenderWidgetHostViewPort::FromRWHV(host->GetView())->WillWmDestroy();
@@ -1186,22 +1186,6 @@ WebContents* WebContentsImpl::Clone() {
return tc;
}
-gfx::NativeView WebContentsImpl::GetContentNativeView() const {
- return view_->GetContentNativeView();
-}
-
-gfx::NativeView WebContentsImpl::GetNativeView() const {
- return view_->GetNativeView();
-}
-
-void WebContentsImpl::GetContainerBounds(gfx::Rect* out) const {
- view_->GetContainerBounds(out);
-}
-
-void WebContentsImpl::Focus() {
- view_->Focus();
-}
-
void WebContentsImpl::Observe(int type,
const NotificationSource& source,
const NotificationDetails& details) {
@@ -2385,7 +2369,7 @@ void WebContentsImpl::OnFindMatchRectsReply(
void WebContentsImpl::OnOpenDateTimeDialog(
const ViewHostMsg_DateTimeDialogValue_Params& value) {
date_time_chooser_->ShowDialog(
- GetContentNativeView(), GetRenderViewHost(), value.dialog_type,
+ view_->GetContentNativeView(), GetRenderViewHost(), value.dialog_type,
value.year, value.month, value.day, value.hour,
value.minute, value.second);
}
@@ -2787,7 +2771,7 @@ void WebContentsImpl::RenderViewReady(RenderViewHost* rvh) {
// window).
if (was_crashed && !FocusLocationBarByDefault() &&
(!delegate_ || delegate_->ShouldFocusPageAfterCrash())) {
- Focus();
+ view_->Focus();
}
FOR_EACH_OBSERVER(WebContentsObserver, observers_, RenderViewReady());
diff --git a/content/browser/web_contents/web_contents_impl.h b/content/browser/web_contents/web_contents_impl.h
index 9e8124f..a1e01b7 100644
--- a/content/browser/web_contents/web_contents_impl.h
+++ b/content/browser/web_contents/web_contents_impl.h
@@ -232,10 +232,6 @@ class CONTENT_EXPORT WebContentsImpl
virtual bool NeedToFireBeforeUnload() OVERRIDE;
virtual void Stop() OVERRIDE;
virtual WebContents* Clone() OVERRIDE;
- virtual gfx::NativeView GetContentNativeView() const OVERRIDE;
- virtual gfx::NativeView GetNativeView() const OVERRIDE;
- virtual void GetContainerBounds(gfx::Rect* out) const OVERRIDE;
- virtual void Focus() OVERRIDE;
virtual void FocusThroughTabTraversal(bool reverse) OVERRIDE;
virtual bool ShowingInterstitialPage() const OVERRIDE;
virtual InterstitialPage* GetInterstitialPage() const OVERRIDE;
diff --git a/content/browser/web_contents/web_contents_view_aura_browsertest.cc b/content/browser/web_contents/web_contents_view_aura_browsertest.cc
index b029296..3a278f3 100644
--- a/content/browser/web_contents/web_contents_view_aura_browsertest.cc
+++ b/content/browser/web_contents/web_contents_view_aura_browsertest.cc
@@ -13,6 +13,7 @@
#include "content/browser/web_contents/navigation_controller_impl.h"
#include "content/browser/web_contents/navigation_entry_impl.h"
#include "content/browser/web_contents/web_contents_impl.h"
+#include "content/public/browser/web_contents_view.h"
#include "content/public/common/content_switches.h"
#include "content/public/test/browser_test_utils.h"
#include "content/public/test/test_utils.h"
@@ -84,7 +85,8 @@ class WebContentsViewAuraTest : public ContentBrowserTest {
ASSERT_TRUE(test_server()->Start());
GURL test_url(test_server()->GetURL(url));
NavigateToURL(shell(), test_url);
- aura::Window* content = shell()->web_contents()->GetContentNativeView();
+ aura::Window* content =
+ shell()->web_contents()->GetView()->GetContentNativeView();
content->GetRootWindow()->SetHostSize(gfx::Size(800, 600));
}
@@ -116,7 +118,7 @@ class WebContentsViewAuraTest : public ContentBrowserTest {
EXPECT_TRUE(controller.CanGoBack());
EXPECT_FALSE(controller.CanGoForward());
- aura::Window* content = web_contents->GetContentNativeView();
+ aura::Window* content = web_contents->GetView()->GetContentNativeView();
gfx::Rect bounds = content->GetBoundsInRootWindow();
aura::test::EventGenerator generator(content->GetRootWindow(), content);
@@ -219,7 +221,7 @@ IN_PROC_BROWSER_TEST_F(WebContentsViewAuraTest,
web_contents->GetController().GoBack();
EXPECT_EQ(1, GetCurrentIndex());
- aura::Window* content = web_contents->GetContentNativeView();
+ aura::Window* content = web_contents->GetView()->GetContentNativeView();
aura::RootWindow* root_window = content->GetRootWindow();
gfx::Rect bounds = content->GetBoundsInRootWindow();
@@ -321,7 +323,7 @@ IN_PROC_BROWSER_TEST_F(WebContentsViewAuraTest,
// index 3 to index 2, and index 3 should have a screenshot.
string16 expected_title = ASCIIToUTF16("Title: #2");
content::TitleWatcher title_watcher(web_contents, expected_title);
- aura::Window* content = web_contents->GetContentNativeView();
+ aura::Window* content = web_contents->GetView()->GetContentNativeView();
gfx::Rect bounds = content->GetBoundsInRootWindow();
aura::test::EventGenerator generator(content->GetRootWindow(), content);
generator.GestureScrollSequence(
diff --git a/content/public/browser/web_contents.h b/content/public/browser/web_contents.h
index 1a26c89..e5e8440 100644
--- a/content/public/browser/web_contents.h
+++ b/content/public/browser/web_contents.h
@@ -272,22 +272,6 @@ class WebContents : public PageNavigator,
virtual WebContents* Clone() = 0;
// Views and focus -----------------------------------------------------------
- // TODO(brettw): Most of these should be removed and the caller should call
- // the view directly.
-
- // Returns the actual window that is focused when this WebContents is shown.
- virtual gfx::NativeView GetContentNativeView() const = 0;
-
- // Returns the NativeView associated with this WebContents. Outside of
- // automation in the context of the UI, this is required to be implemented.
- virtual gfx::NativeView GetNativeView() const = 0;
-
- // Returns the bounds of this WebContents in the screen coordinate system.
- virtual void GetContainerBounds(gfx::Rect* out) const = 0;
-
- // Makes the tab the focused window.
- virtual void Focus() = 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).
diff --git a/content/public/test/web_contents_tester.cc b/content/public/test/web_contents_tester.cc
index 3b2ed55..4435d9ff 100644
--- a/content/public/test/web_contents_tester.cc
+++ b/content/public/test/web_contents_tester.cc
@@ -13,24 +13,6 @@ namespace {
// The two subclasses here are instantiated via the deprecated
// CreateWebContentsFor... factories below.
-class TestWebContentsCountFocus : public TestWebContents {
- public:
- explicit TestWebContentsCountFocus(BrowserContext* browser_context)
- : TestWebContents(browser_context), focus_called_(0) {
- }
-
- virtual int GetNumberOfFocusCalls() OVERRIDE {
- return focus_called_;
- }
-
- virtual void Focus() OVERRIDE {
- focus_called_++;
- }
-
- private:
- int focus_called_;
-};
-
class TestWebContentsCountSetFocusToLocationBar : public TestWebContents {
public:
explicit TestWebContentsCountSetFocusToLocationBar(
@@ -73,14 +55,4 @@ WebContents* WebContentsTester::CreateTestWebContentsCountSetFocusToLocationBar(
return web_contents;
}
-// static
-WebContents* WebContentsTester::CreateTestWebContentsCountFocus(
- BrowserContext* browser_context,
- SiteInstance* instance) {
- TestWebContentsCountFocus* web_contents =
- new TestWebContentsCountFocus(browser_context);
- web_contents->Init(WebContents::CreateParams(browser_context, instance));
- return web_contents;
-}
-
} // namespace content
diff --git a/content/public/test/web_contents_tester.h b/content/public/test/web_contents_tester.h
index 5c4a37c..5978d0b 100644
--- a/content/public/test/web_contents_tester.h
+++ b/content/public/test/web_contents_tester.h
@@ -65,12 +65,6 @@ class WebContentsTester {
BrowserContext* browser_context,
SiteInstance* instance);
- // Deprecated. Creates a WebContents enabled for testing, that
- // counts the number of times Focus is called.
- static WebContents* CreateTestWebContentsCountFocus(
- BrowserContext* browser_context,
- SiteInstance* instance);
-
// Simulates the appropriate RenderView (pending if any, current otherwise)
// sending a navigate notification for the NavigationController pending entry.
virtual void CommitPendingNavigation() = 0;
diff --git a/content/shell/shell.cc b/content/shell/shell.cc
index fe65fc1..0a92aff 100644
--- a/content/shell/shell.cc
+++ b/content/shell/shell.cc
@@ -156,22 +156,22 @@ void Shell::LoadURLForFrame(const GURL& url, const std::string& frame_name) {
PAGE_TRANSITION_TYPED | PAGE_TRANSITION_FROM_ADDRESS_BAR);
params.frame_name = frame_name;
web_contents_->GetController().LoadURLWithParams(params);
- web_contents_->Focus();
+ web_contents_->GetView()->Focus();
}
void Shell::GoBackOrForward(int offset) {
web_contents_->GetController().GoToOffset(offset);
- web_contents_->Focus();
+ web_contents_->GetView()->Focus();
}
void Shell::Reload() {
web_contents_->GetController().Reload(false);
- web_contents_->Focus();
+ web_contents_->GetView()->Focus();
}
void Shell::Stop() {
web_contents_->Stop();
- web_contents_->Focus();
+ web_contents_->GetView()->Focus();
}
void Shell::UpdateNavigationControls() {
@@ -201,7 +201,7 @@ void Shell::CloseDevTools() {
gfx::NativeView Shell::GetContentView() {
if (!web_contents_.get())
return NULL;
- return web_contents_->GetNativeView();
+ return web_contents_->GetView()->GetNativeView();
}
WebContents* Shell::OpenURLFromTab(WebContents* source,
diff --git a/content/shell/shell_aura.cc b/content/shell/shell_aura.cc
index 2297587..f78c9e1 100644
--- a/content/shell/shell_aura.cc
+++ b/content/shell/shell_aura.cc
@@ -7,6 +7,7 @@
#include "base/command_line.h"
#include "base/utf_string_conversions.h"
#include "content/public/browser/web_contents.h"
+#include "content/public/browser/web_contents_view.h"
#include "ui/aura/env.h"
#include "ui/aura/root_window.h"
#include "ui/aura/window.h"
@@ -87,7 +88,7 @@ class ShellWindowDelegateView : public WidgetDelegateView,
contents_view_->SetLayoutManager(new FillLayout());
web_view_ = new WebView(web_contents->GetBrowserContext());
web_view_->SetWebContents(web_contents);
- web_contents->Focus();
+ web_contents->GetView()->Focus();
contents_view_->AddChildView(web_view_);
Layout();
}
diff --git a/content/shell/shell_devtools_frontend.cc b/content/shell/shell_devtools_frontend.cc
index d6aaeeb..9149680 100644
--- a/content/shell/shell_devtools_frontend.cc
+++ b/content/shell/shell_devtools_frontend.cc
@@ -9,6 +9,7 @@
#include "content/public/browser/devtools_http_handler.h"
#include "content/public/browser/devtools_manager.h"
#include "content/public/browser/web_contents.h"
+#include "content/public/browser/web_contents_view.h"
#include "content/public/common/content_client.h"
#include "content/shell/shell.h"
#include "content/shell/shell_browser_context.h"
@@ -65,7 +66,7 @@ ShellDevToolsFrontend* ShellDevToolsFrontend::Show(
}
void ShellDevToolsFrontend::Focus() {
- web_contents()->Focus();
+ web_contents()->GetView()->Focus();
}
void ShellDevToolsFrontend::Close() {
diff --git a/content/shell/shell_download_manager_delegate.cc b/content/shell/shell_download_manager_delegate.cc
index 0771754..55c36df 100644
--- a/content/shell/shell_download_manager_delegate.cc
+++ b/content/shell/shell_download_manager_delegate.cc
@@ -135,7 +135,7 @@ void ShellDownloadManagerDelegate::ChooseDownloadPath(
OPENFILENAME save_as;
ZeroMemory(&save_as, sizeof(save_as));
save_as.lStructSize = sizeof(OPENFILENAME);
- save_as.hwndOwner = item->GetWebContents()->GetNativeView();
+ save_as.hwndOwner = item->GetWebContents()->GetView()->GetNativeView();
save_as.lpstrFile = file_name;
save_as.nMaxFile = arraysize(file_name);
diff --git a/content/shell/shell_gtk.cc b/content/shell/shell_gtk.cc
index de41e66..8d024ce 100644
--- a/content/shell/shell_gtk.cc
+++ b/content/shell/shell_gtk.cc
@@ -209,8 +209,10 @@ void Shell::PlatformSetContents() {
void Shell::SizeTo(int width, int height) {
content_width_ = width;
content_height_ = height;
- if (web_contents_.get())
- gtk_widget_set_size_request(web_contents_->GetNativeView(), width, height);
+ if (web_contents_.get()) {
+ gtk_widget_set_size_request(web_contents_->GetView()->GetNativeView(),
+ width, height);
+ }
}
void Shell::PlatformResizeSubViews() {
diff --git a/content/shell/shell_web_contents_view_delegate_gtk.cc b/content/shell/shell_web_contents_view_delegate_gtk.cc
index ce354ef..cd72e03 100644
--- a/content/shell/shell_web_contents_view_delegate_gtk.cc
+++ b/content/shell/shell_web_contents_view_delegate_gtk.cc
@@ -196,17 +196,17 @@ gboolean ShellWebContentsViewDelegate::OnNativeViewFocusEvent(
void ShellWebContentsViewDelegate::OnBackMenuActivated(GtkWidget* widget) {
web_contents_->GetController().GoToOffset(-1);
- web_contents_->Focus();
+ web_contents_->GetView()->Focus();
}
void ShellWebContentsViewDelegate::OnForwardMenuActivated(GtkWidget* widget) {
web_contents_->GetController().GoToOffset(1);
- web_contents_->Focus();
+ web_contents_->GetView()->Focus();
}
void ShellWebContentsViewDelegate::OnReloadMenuActivated(GtkWidget* widget) {
web_contents_->GetController().Reload(false);
- web_contents_->Focus();
+ web_contents_->GetView()->Focus();
}
void ShellWebContentsViewDelegate::OnOpenURLMenuActivated(GtkWidget* widget) {
diff --git a/content/shell/shell_web_contents_view_delegate_mac.mm b/content/shell/shell_web_contents_view_delegate_mac.mm
index 7143e16..2460595 100644
--- a/content/shell/shell_web_contents_view_delegate_mac.mm
+++ b/content/shell/shell_web_contents_view_delegate_mac.mm
@@ -201,7 +201,7 @@ void ShellWebContentsViewDelegate::ShowContextMenu(
YES,
delegate);
- NSView* parent_view = web_contents_->GetContentNativeView();
+ NSView* parent_view = web_contents_->GetView()->GetContentNativeView();
NSEvent* currentEvent = [NSApp currentEvent];
NSWindow* window = [parent_view window];
NSPoint position = [window mouseLocationOutsideOfEventStream];
@@ -248,15 +248,15 @@ void ShellWebContentsViewDelegate::ActionPerformed(int tag) {
}
case ShellContextMenuItemBackTag:
web_contents_->GetController().GoToOffset(-1);
- web_contents_->Focus();
+ web_contents_->GetView()->Focus();
break;
case ShellContextMenuItemForwardTag:
web_contents_->GetController().GoToOffset(1);
- web_contents_->Focus();
+ web_contents_->GetView()->Focus();
break;
case ShellContextMenuItemReloadTag: {
web_contents_->GetController().Reload(false);
- web_contents_->Focus();
+ web_contents_->GetView()->Focus();
break;
}
case ShellContextMenuItemInspectTag: {
diff --git a/content/shell/shell_web_contents_view_delegate_win.cc b/content/shell/shell_web_contents_view_delegate_win.cc
index 071b1af..df400f7 100644
--- a/content/shell/shell_web_contents_view_delegate_win.cc
+++ b/content/shell/shell_web_contents_view_delegate_win.cc
@@ -216,15 +216,15 @@ void ShellWebContentsViewDelegate::MenuItemSelected(int selection) {
}
case ShellContextMenuItemBackId:
web_contents_->GetController().GoToOffset(-1);
- web_contents_->Focus();
+ web_contents_->GetView()->Focus();
break;
case ShellContextMenuItemForwardId:
web_contents_->GetController().GoToOffset(1);
- web_contents_->Focus();
+ web_contents_->GetView()->Focus();
break;
case ShellContextMenuItemReloadId:
web_contents_->GetController().Reload(false);
- web_contents_->Focus();
+ web_contents_->GetView()->Focus();
break;
case ShellContextMenuItemInspectId: {
ShellDevToolsFrontend::Show(web_contents_);