Skip to content

Commit

Permalink
Hide WebContentsView from Chrome. This also removes WebContentsViewPort.
Browse files Browse the repository at this point in the history
TestWebContentsView goes away since it's not needed anymore

BUG=304341
R=avi@chromium.org, thestig@chromium.org

Review URL: https://codereview.chromium.org/262823006

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@268072 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
jam@chromium.org committed May 3, 2014
1 parent 08bb750 commit fc2b46b
Show file tree
Hide file tree
Showing 237 changed files with 569 additions and 1,008 deletions.
4 changes: 1 addition & 3 deletions android_webview/native/aw_autofill_manager_delegate.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
#include "components/autofill/core/common/autofill_pref_names.h"
#include "components/user_prefs/user_prefs.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_contents_view.h"
#include "jni/AwAutofillManagerDelegate_jni.h"

using base::android::AttachCurrentThread;
Expand Down Expand Up @@ -95,8 +94,7 @@ void AwAutofillManagerDelegate::ShowAutofillPopup(
delegate_ = delegate;

// Convert element_bounds to be in screen space.
gfx::Rect client_area;
web_contents_->GetView()->GetContainerBounds(&client_area);
gfx::Rect client_area = web_contents_->GetContainerBounds();
gfx::RectF element_bounds_in_screen_space =
element_bounds + client_area.OffsetFromOrigin();

Expand Down
1 change: 0 additions & 1 deletion android_webview/native/aw_web_contents_view_delegate.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

#include "content/public/browser/android/content_view_core.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_contents_view.h"
#include "content/public/common/context_menu_params.h"

namespace android_webview {
Expand Down
2 changes: 0 additions & 2 deletions apps/app_window.cc
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/resource_dispatcher_host.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_contents_view.h"
#include "content/public/common/media_stream_request.h"
#include "extensions/browser/extension_registry.h"
#include "extensions/browser/extension_system.h"
Expand Down Expand Up @@ -328,7 +327,6 @@ void AppWindow::Init(const GURL& url,
// We want to show the window only when the content has been painted. For
// that to happen, we need to define a size for the content, otherwise the
// layout will happen in a 0x0 area.
// Note: WebContents::GetView() is guaranteed to be non-null.
gfx::Insets frame_insets = native_app_window_->GetFrameInsets();
gfx::Rect initial_bounds = new_params.GetInitialWindowBounds(frame_insets);
initial_bounds.Inset(frame_insets);
Expand Down
5 changes: 2 additions & 3 deletions apps/shell/browser/shell_app_window.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#include "content/public/browser/navigation_controller.h"
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_contents_view.h"
#include "extensions/browser/view_type_utils.h"
#include "extensions/common/extension_messages.h"
#include "ipc/ipc_message_macros.h"
Expand Down Expand Up @@ -44,11 +43,11 @@ void ShellAppWindow::Init(BrowserContext* context, gfx::Size initial_size) {
void ShellAppWindow::LoadURL(const GURL& url) {
content::NavigationController::LoadURLParams params(url);
web_contents_->GetController().LoadURLWithParams(params);
web_contents_->GetView()->Focus();
web_contents_->Focus();
}

aura::Window* ShellAppWindow::GetNativeWindow() {
return web_contents_->GetView()->GetNativeView();
return web_contents_->GetNativeView();
}

int ShellAppWindow::GetRenderViewRoutingID() {
Expand Down
3 changes: 1 addition & 2 deletions apps/ui/views/native_app_window_views.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/render_widget_host_view.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_contents_view.h"
#include "extensions/common/draggable_region.h"
#include "third_party/skia/include/core/SkRegion.h"
#include "ui/gfx/path.h"
Expand Down Expand Up @@ -233,7 +232,7 @@ bool NativeAppWindowViews::ShouldDescendIntoChildForEventHandling(
gfx::NativeView child,
const gfx::Point& location) {
#if defined(USE_AURA)
if (child->Contains(web_view_->web_contents()->GetView()->GetNativeView())) {
if (child->Contains(web_view_->web_contents()->GetNativeView())) {
// App window should claim mouse events that fall within the draggable
// region.
return !draggable_region_.get() ||
Expand Down
3 changes: 1 addition & 2 deletions apps/ui/web_contents_sizer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#include "apps/ui/web_contents_sizer.h"

#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_contents_view.h"

#if defined(USE_AURA)
#include "ui/aura/window.h"
Expand All @@ -18,7 +17,7 @@ namespace apps {
void ResizeWebContents(content::WebContents* web_contents,
const gfx::Size& new_size) {
#if defined(USE_AURA)
aura::Window* window = web_contents->GetView()->GetNativeView();
aura::Window* window = web_contents->GetNativeView();
window->SetBounds(gfx::Rect(window->bounds().origin(), new_size));
#elif defined(OS_ANDROID)
content::RenderWidgetHostView* view = web_contents->GetRenderWidgetHostView();
Expand Down
3 changes: 1 addition & 2 deletions apps/ui/web_contents_sizer.mm
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,12 @@
#import <Cocoa/Cocoa.h>

#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_contents_view.h"

namespace apps {

void ResizeWebContents(content::WebContents* web_contents,
const gfx::Size& new_size) {
NSView* view = web_contents->GetView()->GetNativeView();
NSView* view = web_contents->GetNativeView();
NSRect old_wcv_frame = [view frame];
CGFloat new_x = old_wcv_frame.origin.x;
CGFloat new_y =
Expand Down
4 changes: 1 addition & 3 deletions chrome/browser/android/omnibox/omnibox_prerender.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_android.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_contents_view.h"
#include "jni/OmniboxPrerender_jni.h"
#include "url/gurl.h"

Expand Down Expand Up @@ -135,8 +134,7 @@ void OmniboxPrerender::DoPrerender(const AutocompleteMatch& match,
DCHECK(web_contents);
if (!web_contents)
return;
gfx::Rect container_bounds;
web_contents->GetView()->GetContainerBounds(&container_bounds);
gfx::Rect container_bounds = web_contents->GetContainerBounds();
predictors::AutocompleteActionPredictorFactory::GetForProfile(profile)->
StartPrerendering(
match.destination_url,
Expand Down
5 changes: 2 additions & 3 deletions chrome/browser/apps/app_browsertest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
#include "content/public/browser/devtools_agent_host.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/render_widget_host_view.h"
#include "content/public/browser/web_contents_view.h"
#include "content/public/test/test_utils.h"
#include "extensions/browser/event_router.h"
#include "extensions/browser/extension_system.h"
Expand Down Expand Up @@ -142,9 +141,9 @@ class ScopedPreviewTestingDelegate : PrintPreviewUI::TestingDelegate {
}

// PrintPreviewUI::TestingDelegate implementation.
virtual void DidRenderPreviewPage(const content::WebContents& preview_dialog)
virtual void DidRenderPreviewPage(content::WebContents* preview_dialog)
OVERRIDE {
dialog_size_ = preview_dialog.GetView()->GetContainerSize();
dialog_size_ = preview_dialog->GetContainerBounds().size();
++rendered_page_count_;
CHECK(rendered_page_count_ <= total_page_count_);
if (waiting_runner_ && rendered_page_count_ == total_page_count_) {
Expand Down
3 changes: 1 addition & 2 deletions chrome/browser/apps/ephemeral_app_launcher.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#include "chrome/browser/ui/extensions/application_launch.h"
#include "chrome/browser/ui/extensions/extension_enable_flow.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_contents_view.h"
#include "extensions/browser/extension_registry.h"
#include "extensions/browser/extension_system.h"
#include "extensions/common/permissions/permissions_data.h"
Expand All @@ -38,7 +37,7 @@ gfx::NativeWindow NativeWindowForWebContents(content::WebContents* contents) {
if (!contents)
return NULL;

return contents->GetView()->GetTopLevelNativeWindow();
return contents->GetTopLevelNativeWindow();
}

} // namespace
Expand Down
7 changes: 2 additions & 5 deletions chrome/browser/apps/web_view_interactive_browsertest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/render_widget_host_view.h"
#include "content/public/browser/web_contents.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 "net/test/embedded_test_server/embedded_test_server.h"
Expand Down Expand Up @@ -225,8 +224,7 @@ class WebViewInteractiveTest
guest_web_contents_ = source->GetWebContents();
embedder_web_contents_ = guest_web_contents_->GetEmbedderWebContents();

gfx::Rect offset;
embedder_web_contents_->GetView()->GetContainerBounds(&offset);
gfx::Rect offset = embedder_web_contents_->GetContainerBounds();
corner_ = gfx::Point(offset.x(), offset.y());

const testing::TestInfo* const test_info =
Expand Down Expand Up @@ -689,9 +687,8 @@ IN_PROC_BROWSER_TEST_F(WebViewInteractiveTest, DragDropWithinWebView) {

ASSERT_TRUE(ui_test_utils::ShowAndFocusNativeWindow(GetPlatformAppWindow()));

gfx::Rect offset;
embedder_web_contents_ = GetFirstAppWindowWebContents();
embedder_web_contents_->GetView()->GetContainerBounds(&offset);
gfx::Rect offset = embedder_web_contents_->GetContainerBounds();
corner_ = gfx::Point(offset.x(), offset.y());

// In the drag drop test we add 20px padding to the page body because on
Expand Down
3 changes: 1 addition & 2 deletions chrome/browser/apps/window_controls_browsertest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
#include "chrome/browser/extensions/extension_test_message_listener.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/common/chrome_switches.h"
#include "content/public/browser/web_contents_view.h"
#include "content/public/test/browser_test_utils.h"
#include "extensions/browser/process_manager.h"

Expand Down Expand Up @@ -69,7 +68,7 @@ IN_PROC_BROWSER_TEST_F(WindowControlsTest, CloseControlWorks) {

// Send mouse click somewhere inside the [x] button
const int controlOffset = 25;
int x = web_contents->GetView()->GetContainerSize().width() - controlOffset;
int x = web_contents->GetContainerBounds().size().width() - controlOffset;
int y = controlOffset;
content::SimulateMouseClickAt(web_contents,
0,
Expand Down
1 change: 0 additions & 1 deletion chrome/browser/browser_keyevents_browsertest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
#include "content/public/browser/notification_service.h"
#include "content/public/browser/render_widget_host_view.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_contents_view.h"
#include "content/public/test/browser_test_utils.h"
#include "net/test/embedded_test_server/embedded_test_server.h"
#include "ui/events/keycodes/keyboard_codes.h"
Expand Down
1 change: 0 additions & 1 deletion chrome/browser/chrome_content_browser_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@
#include "content/public/browser/resource_context.h"
#include "content/public/browser/site_instance.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_contents_view.h"
#include "content/public/common/child_process_host.h"
#include "content/public/common/content_descriptors.h"
#include "content/public/common/url_utils.h"
Expand Down
4 changes: 1 addition & 3 deletions chrome/browser/chrome_plugin_browsertest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
#include "net/base/filename_util.h"

#if defined(OS_WIN)
#include "content/public/browser/web_contents_view.h"
#include "ui/aura/window.h"
#include "ui/aura/window_tree_host.h"
#endif
Expand Down Expand Up @@ -326,8 +325,7 @@ IN_PROC_BROWSER_TEST_F(ChromePluginTest, WindowedNPAPIPluginHidden) {
EXPECT_EQ(expected_title2, title_watcher2.WaitAndGetTitle());

HWND child = NULL;
HWND hwnd =
tab->GetView()->GetNativeView()->GetHost()->GetAcceleratedWidget();
HWND hwnd = tab->GetNativeView()->GetHost()->GetAcceleratedWidget();
EnumChildWindows(hwnd, EnumerateChildren,reinterpret_cast<LPARAM>(&child));

RECT region;
Expand Down
3 changes: 1 addition & 2 deletions chrome/browser/chromeos/external_protocol_dialog.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#include "chrome/browser/external_protocol/external_protocol_handler.h"
#include "chrome/browser/tab_contents/tab_util.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_contents_view.h"
#include "grit/chromium_strings.h"
#include "grit/generated_resources.h"
#include "ui/base/l10n/l10n_util.h"
Expand Down Expand Up @@ -108,7 +107,7 @@ ExternalProtocolDialog::ExternalProtocolDialog(WebContents* web_contents,

gfx::NativeWindow parent_window;
if (web_contents) {
parent_window = web_contents->GetView()->GetTopLevelNativeWindow();
parent_window = web_contents->GetTopLevelNativeWindow();
} else {
// Dialog is top level if we don't have a web_contents associated with us.
parent_window = NULL;
Expand Down
3 changes: 1 addition & 2 deletions chrome/browser/chromeos/login/login_display_host_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@
#include "content/public/browser/notification_types.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_contents_view.h"
#include "content/public/browser/web_ui.h"
#include "grit/browser_resources.h"
#include "media/audio/sounds/sounds_manager.h"
Expand Down Expand Up @@ -960,7 +959,7 @@ void LoginDisplayHostImpl::ShowWebUI() {
}
LOG(WARNING) << "Login WebUI >> Show already initialized UI";
login_window_->Show();
login_view_->GetWebContents()->GetView()->Focus();
login_view_->GetWebContents()->Focus();
login_view_->SetStatusAreaVisible(status_area_saved_visibility_);
login_view_->OnPostponedShow();

Expand Down
3 changes: 1 addition & 2 deletions chrome/browser/chromeos/login/webui_login_view.cc
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/render_widget_host_view.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_contents_view.h"
#include "content/public/browser/web_ui.h"
#include "third_party/WebKit/public/web/WebInputEvent.h"
#include "ui/gfx/rect.h"
Expand Down Expand Up @@ -337,7 +336,7 @@ void WebUILoginView::AboutToRequestFocusFromTabTraversal(bool reverse) {
// Return the focus to the web contents.
webui_login_->web_contents()->FocusThroughTabTraversal(reverse);
GetWidget()->Activate();
webui_login_->web_contents()->GetView()->Focus();
webui_login_->web_contents()->Focus();
}

void WebUILoginView::Observe(int type,
Expand Down
3 changes: 1 addition & 2 deletions chrome/browser/devtools/devtools_file_helper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/render_view_host.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/public/common/url_constants.h"
#include "grit/generated_resources.h"
Expand Down Expand Up @@ -83,7 +82,7 @@ class SelectFileDialog : public ui::SelectFileDialog::Listener,
NULL,
0,
base::FilePath::StringType(),
platform_util::GetTopLevel(web_contents_->GetView()->GetNativeView()),
platform_util::GetTopLevel(web_contents_->GetNativeView()),
NULL);
}

Expand Down
3 changes: 1 addition & 2 deletions chrome/browser/devtools/devtools_ui_bindings.cc
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
#include "content/public/browser/user_metrics.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_contents_observer.h"
#include "content/public/browser/web_contents_view.h"
#include "content/public/common/page_transition_types.h"
#include "content/public/common/renderer_preferences.h"
#include "content/public/common/url_constants.h"
Expand Down Expand Up @@ -203,7 +202,7 @@ class DefaultBindingsDelegate : public DevToolsUIBindings::Delegate {

void DefaultBindingsDelegate::ActivateWindow() {
web_contents_->GetDelegate()->ActivateContents(web_contents_);
web_contents_->GetView()->Focus();
web_contents_->Focus();
}

void DefaultBindingsDelegate::OpenInNewTab(const std::string& url) {
Expand Down
11 changes: 5 additions & 6 deletions chrome/browser/devtools/devtools_window.cc
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
#include "content/public/browser/user_metrics.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_contents_observer.h"
#include "content/public/browser/web_contents_view.h"
#include "content/public/common/content_client.h"
#include "content/public/common/page_transition_types.h"
#include "content/public/common/url_constants.h"
Expand Down Expand Up @@ -481,12 +480,12 @@ void DevToolsWindow::Show(const DevToolsToggleAction& action) {
tab_strip_model->ActivateTabAt(inspected_tab_index, true);

inspected_window->UpdateDevTools();
web_contents_->GetView()->SetInitialFocus();
web_contents_->SetInitialFocus();
inspected_window->Show();
// On Aura, focusing once is not enough. Do it again.
// Note that focusing only here but not before isn't enough either. We just
// need to focus twice.
web_contents_->GetView()->SetInitialFocus();
web_contents_->SetInitialFocus();

PrefsTabHelper::CreateForWebContents(web_contents_);
web_contents_->GetRenderViewHost()->SyncRendererPrefs();
Expand All @@ -505,7 +504,7 @@ void DevToolsWindow::Show(const DevToolsToggleAction& action) {

if (should_show_window) {
browser_->window()->Show();
web_contents_->GetView()->SetInitialFocus();
web_contents_->SetInitialFocus();
}

DoAction(action);
Expand Down Expand Up @@ -864,7 +863,7 @@ bool DevToolsWindow::PreHandleGestureEvent(

void DevToolsWindow::ActivateWindow() {
if (is_docked_ && GetInspectedBrowserWindow())
web_contents_->GetView()->Focus();
web_contents_->Focus();
else if (!is_docked_ && !browser_->window()->IsActive())
browser_->window()->Activate();
}
Expand Down Expand Up @@ -1061,7 +1060,7 @@ void DevToolsWindow::CreateDevToolsBrowser() {
browser_ = new Browser(Browser::CreateParams::CreateForDevTools(
profile_,
chrome::GetHostDesktopTypeForNativeView(
web_contents_->GetView()->GetNativeView())));
web_contents_->GetNativeView())));
browser_->tab_strip_model()->AddWebContents(
web_contents_, -1, content::PAGE_TRANSITION_AUTO_TOPLEVEL,
TabStripModel::ADD_ACTIVE);
Expand Down
Loading

0 comments on commit fc2b46b

Please sign in to comment.