Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(74)

Side by Side Diff: content/browser/web_contents/web_contents_impl.cc

Issue 10409029: Add a factory function to create WebContentsView implementations. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix android Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/web_contents/web_contents_impl.h" 5 #include "content/browser/web_contents/web_contents_impl.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 #include "net/base/net_util.h" 62 #include "net/base/net_util.h"
63 #include "net/base/network_change_notifier.h" 63 #include "net/base/network_change_notifier.h"
64 #include "net/url_request/url_request_context_getter.h" 64 #include "net/url_request/url_request_context_getter.h"
65 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" 65 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h"
66 #include "ui/base/ui_base_switches.h" 66 #include "ui/base/ui_base_switches.h"
67 #include "ui/gfx/monitor.h" 67 #include "ui/gfx/monitor.h"
68 #include "ui/gfx/screen.h" 68 #include "ui/gfx/screen.h"
69 #include "webkit/glue/web_intent_data.h" 69 #include "webkit/glue/web_intent_data.h"
70 #include "webkit/glue/webpreferences.h" 70 #include "webkit/glue/webpreferences.h"
71 71
72 #if defined(USE_AURA) 72 #if defined(OS_MACOSX)
73 #include "content/browser/web_contents/web_contents_view_aura.h"
74 #elif defined(OS_WIN)
75 #include "content/browser/web_contents/web_contents_view_win.h"
76 #elif defined(TOOLKIT_GTK)
77 #include "content/browser/web_contents/web_contents_view_gtk.h"
78 #elif defined(OS_MACOSX)
79 #include "content/browser/web_contents/web_contents_view_mac.h"
80 #include "ui/surface/io_surface_support_mac.h" 73 #include "ui/surface/io_surface_support_mac.h"
81 #elif defined(OS_ANDROID)
82 #include "content/browser/web_contents/web_contents_view_android.h"
83 #endif 74 #endif
84 75
85 // Cross-Site Navigations 76 // Cross-Site Navigations
86 // 77 //
87 // If a WebContentsImpl is told to navigate to a different web site (as 78 // If a WebContentsImpl is told to navigate to a different web site (as
88 // determined by SiteInstance), it will replace its current RenderViewHost with 79 // determined by SiteInstance), it will replace its current RenderViewHost with
89 // a new RenderViewHost dedicated to the new SiteInstance. This works as 80 // a new RenderViewHost dedicated to the new SiteInstance. This works as
90 // follows: 81 // follows:
91 // 82 //
92 // - Navigate determines whether the destination is cross-site, and if so, 83 // - Navigate determines whether the destination is cross-site, and if so,
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 view_type_(content::VIEW_TYPE_INVALID), 281 view_type_(content::VIEW_TYPE_INVALID),
291 color_chooser_(NULL) { 282 color_chooser_(NULL) {
292 render_manager_.Init(browser_context, site_instance, routing_id); 283 render_manager_.Init(browser_context, site_instance, routing_id);
293 284
294 view_.reset(content::GetContentClient()->browser()-> 285 view_.reset(content::GetContentClient()->browser()->
295 OverrideCreateWebContentsView(this)); 286 OverrideCreateWebContentsView(this));
296 if (!view_.get()) { 287 if (!view_.get()) {
297 content::WebContentsViewDelegate* delegate = 288 content::WebContentsViewDelegate* delegate =
298 content::GetContentClient()->browser()->GetWebContentsViewDelegate( 289 content::GetContentClient()->browser()->GetWebContentsViewDelegate(
299 this); 290 this);
300 #if defined(USE_AURA) 291 view_.reset(CreateWebContentsView(this, delegate));
301 view_.reset(new WebContentsViewAura(this, delegate));
302 #elif defined(OS_WIN)
303 view_.reset(new WebContentsViewWin(this, delegate));
304 #elif defined(TOOLKIT_GTK)
305 view_.reset(new content::WebContentsViewGtk(this, delegate));
306 #elif defined(OS_MACOSX)
307 view_.reset(web_contents_view_mac::CreateWebContentsView(this, delegate));
308 #elif defined(OS_ANDROID)
309 view_.reset(new WebContentsViewAndroid(this));
310 #endif
311 (void)delegate;
312 } 292 }
313 CHECK(view_.get()); 293 CHECK(view_.get());
314 294
315 // We have the initial size of the view be based on the size of the view of 295 // We have the initial size of the view be based on the size of the view of
316 // the passed in WebContents. 296 // the passed in WebContents.
317 view_->CreateView(base_web_contents ? 297 view_->CreateView(base_web_contents ?
318 base_web_contents->GetView()->GetContainerSize() : gfx::Size()); 298 base_web_contents->GetView()->GetContainerSize() : gfx::Size());
319 299
320 // Listen for whether our opener gets destroyed. 300 // Listen for whether our opener gets destroyed.
321 if (opener_) { 301 if (opener_) {
(...skipping 2461 matching lines...) Expand 10 before | Expand all | Expand 10 after
2783 void WebContentsImpl::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { 2763 void WebContentsImpl::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) {
2784 RenderWidgetHostView* rwh_view = GetView()->CreateViewForWidget(rvh); 2764 RenderWidgetHostView* rwh_view = GetView()->CreateViewForWidget(rvh);
2785 // Can be NULL during tests. 2765 // Can be NULL during tests.
2786 if (rwh_view) 2766 if (rwh_view)
2787 rwh_view->SetSize(GetView()->GetContainerSize()); 2767 rwh_view->SetSize(GetView()->GetContainerSize());
2788 } 2768 }
2789 2769
2790 RenderViewHostImpl* WebContentsImpl::GetRenderViewHostImpl() { 2770 RenderViewHostImpl* WebContentsImpl::GetRenderViewHostImpl() {
2791 return static_cast<RenderViewHostImpl*>(GetRenderViewHost()); 2771 return static_cast<RenderViewHostImpl*>(GetRenderViewHost());
2792 } 2772 }
OLDNEW
« no previous file with comments | « content/browser/web_contents/web_contents_impl.h ('k') | content/browser/web_contents/web_contents_view_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698