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

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

Issue 10409088: Get rid of the RenderViewType concept in content, since it was only used by Chrome. Store the enum… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: review comments 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 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 SessionStorageNamespace* session_storage_namespace) { 244 SessionStorageNamespace* session_storage_namespace) {
245 return new WebContentsImpl( 245 return new WebContentsImpl(
246 browser_context, 246 browser_context,
247 site_instance, 247 site_instance,
248 routing_id, 248 routing_id,
249 static_cast<const WebContentsImpl*>(base_web_contents), 249 static_cast<const WebContentsImpl*>(base_web_contents),
250 NULL, 250 NULL,
251 static_cast<SessionStorageNamespaceImpl*>(session_storage_namespace)); 251 static_cast<SessionStorageNamespaceImpl*>(session_storage_namespace));
252 } 252 }
253 253
254 WebContents* WebContents::FromRenderViewHost(RenderViewHost* rvh) { 254 WebContents* WebContents::FromRenderViewHost(const RenderViewHost* rvh) {
255 return rvh->GetDelegate()->GetAsWebContents(); 255 return rvh->GetDelegate()->GetAsWebContents();
256 } 256 }
257 257
258 } 258 }
259 259
260 // WebContentsImpl ------------------------------------------------------------- 260 // WebContentsImpl -------------------------------------------------------------
261 261
262 WebContentsImpl::WebContentsImpl( 262 WebContentsImpl::WebContentsImpl(
263 content::BrowserContext* browser_context, 263 content::BrowserContext* browser_context,
264 SiteInstance* site_instance, 264 SiteInstance* site_instance,
(...skipping 23 matching lines...) Expand all
288 #endif 288 #endif
289 is_showing_before_unload_dialog_(false), 289 is_showing_before_unload_dialog_(false),
290 opener_web_ui_type_(WebUI::kNoWebUI), 290 opener_web_ui_type_(WebUI::kNoWebUI),
291 closed_by_user_gesture_(false), 291 closed_by_user_gesture_(false),
292 minimum_zoom_percent_( 292 minimum_zoom_percent_(
293 static_cast<int>(content::kMinimumZoomFactor * 100)), 293 static_cast<int>(content::kMinimumZoomFactor * 100)),
294 maximum_zoom_percent_( 294 maximum_zoom_percent_(
295 static_cast<int>(content::kMaximumZoomFactor * 100)), 295 static_cast<int>(content::kMaximumZoomFactor * 100)),
296 temporary_zoom_settings_(false), 296 temporary_zoom_settings_(false),
297 content_restrictions_(0), 297 content_restrictions_(0),
298 view_type_(content::VIEW_TYPE_INVALID),
299 color_chooser_(NULL) { 298 color_chooser_(NULL) {
300 render_manager_.Init(browser_context, site_instance, routing_id); 299 render_manager_.Init(browser_context, site_instance, routing_id);
301 300
302 view_.reset(content::GetContentClient()->browser()-> 301 view_.reset(content::GetContentClient()->browser()->
303 OverrideCreateWebContentsView(this)); 302 OverrideCreateWebContentsView(this));
304 if (!view_.get()) { 303 if (!view_.get()) {
305 content::WebContentsViewDelegate* delegate = 304 content::WebContentsViewDelegate* delegate =
306 content::GetContentClient()->browser()->GetWebContentsViewDelegate( 305 content::GetContentClient()->browser()->GetWebContentsViewDelegate(
307 this); 306 this);
308 view_.reset(CreateWebContentsView(this, delegate)); 307 view_.reset(CreateWebContentsView(this, delegate));
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after
628 } 627 }
629 628
630 const NavigationController& WebContentsImpl::GetController() const { 629 const NavigationController& WebContentsImpl::GetController() const {
631 return controller_; 630 return controller_;
632 } 631 }
633 632
634 content::BrowserContext* WebContentsImpl::GetBrowserContext() const { 633 content::BrowserContext* WebContentsImpl::GetBrowserContext() const {
635 return controller_.GetBrowserContext(); 634 return controller_.GetBrowserContext();
636 } 635 }
637 636
638 void WebContentsImpl::SetViewType(content::ViewType type) {
639 view_type_ = type;
640 }
641
642 content::ViewType WebContentsImpl::GetViewType() const {
643 return view_type_;
644 }
645
646 const GURL& WebContentsImpl::GetURL() const { 637 const GURL& WebContentsImpl::GetURL() const {
647 // We may not have a navigation entry yet 638 // We may not have a navigation entry yet
648 NavigationEntry* entry = controller_.GetActiveEntry(); 639 NavigationEntry* entry = controller_.GetActiveEntry();
649 return entry ? entry->GetVirtualURL() : GURL::EmptyGURL(); 640 return entry ? entry->GetVirtualURL() : GURL::EmptyGURL();
650 } 641 }
651 642
652 643
653 const base::PropertyBag* WebContentsImpl::GetPropertyBag() const { 644 const base::PropertyBag* WebContentsImpl::GetPropertyBag() const {
654 return &property_bag_; 645 return &property_bag_;
655 } 646 }
(...skipping 1396 matching lines...) Expand 10 before | Expand all | Expand 10 after
2052 2043
2053 content::RendererPreferences WebContentsImpl::GetRendererPrefs( 2044 content::RendererPreferences WebContentsImpl::GetRendererPrefs(
2054 content::BrowserContext* browser_context) const { 2045 content::BrowserContext* browser_context) const {
2055 return renderer_preferences_; 2046 return renderer_preferences_;
2056 } 2047 }
2057 2048
2058 WebContents* WebContentsImpl::GetAsWebContents() { 2049 WebContents* WebContentsImpl::GetAsWebContents() {
2059 return this; 2050 return this;
2060 } 2051 }
2061 2052
2062 content::ViewType WebContentsImpl::GetRenderViewType() const {
2063 return view_type_;
2064 }
2065
2066 gfx::Rect WebContentsImpl::GetRootWindowResizerRect() const { 2053 gfx::Rect WebContentsImpl::GetRootWindowResizerRect() const {
2067 if (delegate_) 2054 if (delegate_)
2068 return delegate_->GetRootWindowResizerRect(); 2055 return delegate_->GetRootWindowResizerRect();
2069 return gfx::Rect(); 2056 return gfx::Rect();
2070 } 2057 }
2071 2058
2072 void WebContentsImpl::RenderViewCreated(RenderViewHost* render_view_host) { 2059 void WebContentsImpl::RenderViewCreated(RenderViewHost* render_view_host) {
2073 // Don't send notifications if we are just creating a swapped-out RVH for 2060 // Don't send notifications if we are just creating a swapped-out RVH for
2074 // the opener chain. These won't be used for view-source or WebUI, so it's 2061 // the opener chain. These won't be used for view-source or WebUI, so it's
2075 // ok to return early. 2062 // ok to return early.
(...skipping 723 matching lines...) Expand 10 before | Expand all | Expand 10 after
2799 void WebContentsImpl::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { 2786 void WebContentsImpl::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) {
2800 RenderWidgetHostView* rwh_view = GetView()->CreateViewForWidget(rvh); 2787 RenderWidgetHostView* rwh_view = GetView()->CreateViewForWidget(rvh);
2801 // Can be NULL during tests. 2788 // Can be NULL during tests.
2802 if (rwh_view) 2789 if (rwh_view)
2803 rwh_view->SetSize(GetView()->GetContainerSize()); 2790 rwh_view->SetSize(GetView()->GetContainerSize());
2804 } 2791 }
2805 2792
2806 RenderViewHostImpl* WebContentsImpl::GetRenderViewHostImpl() { 2793 RenderViewHostImpl* WebContentsImpl::GetRenderViewHostImpl() {
2807 return static_cast<RenderViewHostImpl*>(GetRenderViewHost()); 2794 return static_cast<RenderViewHostImpl*>(GetRenderViewHost());
2808 } 2795 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698