diff options
author | aa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-14 06:44:03 +0000 |
---|---|---|
committer | aa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-14 06:44:03 +0000 |
commit | c8160f231fb0ab3827bf90b65c5573b6c339c165 (patch) | |
tree | 68e29c6432e8190cbb65520d8d18cacd62df4cad /chrome/browser | |
parent | 72439465e27275cd043ec0506771ca35c2e52793 (diff) | |
download | chromium_src-c8160f231fb0ab3827bf90b65c5573b6c339c165.zip chromium_src-c8160f231fb0ab3827bf90b65c5573b6c339c165.tar.gz chromium_src-c8160f231fb0ab3827bf90b65c5573b6c339c165.tar.bz2 |
Remove VIEW_TYPE_WEB_CONTENTS and make default view type INVALID.
The view type enum is supposed to represent the 'type of view' in the user
sense, so 'tab', 'background page', 'popup', etc. A 'web contents' is not
a type of view, it's an implementation detail of many different view
types.
This was essentially resulting in too many WebContents instances being
treated as tabs.
Review URL: https://chromiumcodereview.appspot.com/10387110
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@136835 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
7 files changed, 14 insertions, 10 deletions
diff --git a/chrome/browser/bookmarks/bookmark_manager_extension_api.cc b/chrome/browser/bookmarks/bookmark_manager_extension_api.cc index 550c31f..406a6e0 100644 --- a/chrome/browser/bookmarks/bookmark_manager_extension_api.cc +++ b/chrome/browser/bookmarks/bookmark_manager_extension_api.cc @@ -386,7 +386,7 @@ bool StartDragBookmarkManagerFunction::RunImpl() { GetNodesFromArguments(model, args_.get(), 0, &nodes)); if (render_view_host_->GetDelegate()->GetRenderViewType() == - content::VIEW_TYPE_WEB_CONTENTS) { + chrome::VIEW_TYPE_TAB_CONTENTS) { WebContents* web_contents = dispatcher()->delegate()->GetAssociatedWebContents(); CHECK(web_contents); @@ -428,7 +428,7 @@ bool DropBookmarkManagerFunction::RunImpl() { drop_index = drop_parent->child_count(); if (render_view_host_->GetDelegate()->GetRenderViewType() == - content::VIEW_TYPE_WEB_CONTENTS) { + chrome::VIEW_TYPE_TAB_CONTENTS) { WebContents* web_contents = dispatcher()->delegate()->GetAssociatedWebContents(); CHECK(web_contents); diff --git a/chrome/browser/extensions/api/web_navigation/web_navigation_api.cc b/chrome/browser/extensions/api/web_navigation/web_navigation_api.cc index 69b4135..e797819 100644 --- a/chrome/browser/extensions/api/web_navigation/web_navigation_api.cc +++ b/chrome/browser/extensions/api/web_navigation/web_navigation_api.cc @@ -18,6 +18,7 @@ #include "chrome/browser/tab_contents/retargeting_details.h" #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" #include "chrome/common/chrome_notification_types.h" +#include "chrome/common/chrome_view_type.h" #include "chrome/common/url_constants.h" #include "content/public/browser/resource_request_details.h" #include "content/public/browser/navigation_details.h" @@ -448,7 +449,7 @@ void WebNavigationEventRouter::Retargeting(const RetargetingDetails* details) { // If you hit this DCHECK(), please add reproduction steps to // http://crbug.com/109464. DCHECK(details->source_web_contents->GetViewType() != - content::VIEW_TYPE_WEB_CONTENTS); + chrome::VIEW_TYPE_TAB_CONTENTS); return; } const FrameNavigationState& frame_navigation_state = diff --git a/chrome/browser/geolocation/chrome_geolocation_permission_context.cc b/chrome/browser/geolocation/chrome_geolocation_permission_context.cc index c9a3ff8..4d2465b 100644 --- a/chrome/browser/geolocation/chrome_geolocation_permission_context.cc +++ b/chrome/browser/geolocation/chrome_geolocation_permission_context.cc @@ -22,6 +22,7 @@ #include "chrome/browser/tab_contents/tab_util.h" #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" #include "chrome/common/chrome_notification_types.h" +#include "chrome/common/chrome_view_type.h" #include "chrome/common/extensions/extension.h" #include "chrome/common/pref_names.h" #include "content/public/browser/browser_thread.h" @@ -624,7 +625,7 @@ void ChromeGeolocationPermissionContext::RequestGeolocationPermission( WebContents* web_contents = tab_util::GetWebContentsByID(render_process_id, render_view_id); if (!web_contents || web_contents->GetViewType() != - content::VIEW_TYPE_WEB_CONTENTS) { + chrome::VIEW_TYPE_TAB_CONTENTS) { // The tab may have gone away, or the request may not be from a tab at all. // TODO(mpcomplete): the request could be from a background page or // extension popup (tab_contents will have a different ViewType). But why do diff --git a/chrome/browser/speech/chrome_speech_recognition_manager_delegate.cc b/chrome/browser/speech/chrome_speech_recognition_manager_delegate.cc index 5a84d2c..0f697ea 100644 --- a/chrome/browser/speech/chrome_speech_recognition_manager_delegate.cc +++ b/chrome/browser/speech/chrome_speech_recognition_manager_delegate.cc @@ -14,6 +14,7 @@ #include "chrome/browser/prefs/pref_service.h" #include "chrome/browser/profiles/profile_manager.h" #include "chrome/browser/tab_contents/tab_util.h" +#include "chrome/common/chrome_view_type.h" #include "chrome/common/pref_names.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/render_view_host.h" @@ -235,7 +236,7 @@ void ChromeSpeechRecognitionManagerDelegate::CheckRenderViewType( const content::RenderViewHost* render_view_host = content::RenderViewHost::FromID(render_process_id, render_view_id); - // For host delegates other than VIEW_TYPE_WEB_CONTENTS we can't reliably show + // For host delegates other than VIEW_TYPE_TAB_CONTENTS we can't reliably show // a popup, including the speech input bubble. In these cases for privacy // reasons we don't want to start recording if the user can't be properly // notified. An example of this is trying to show the speech input bubble @@ -245,7 +246,7 @@ void ChromeSpeechRecognitionManagerDelegate::CheckRenderViewType( const bool allowed = (render_view_host != NULL && render_view_host->GetDelegate() != NULL && render_view_host->GetDelegate()->GetRenderViewType() == - content::VIEW_TYPE_WEB_CONTENTS); + chrome::VIEW_TYPE_TAB_CONTENTS); BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, base::Bind(callback, session_id, allowed)); } diff --git a/chrome/browser/speech/chrome_speech_recognition_manager_delegate.h b/chrome/browser/speech/chrome_speech_recognition_manager_delegate.h index 94c8fdd..3c4726a 100644 --- a/chrome/browser/speech/chrome_speech_recognition_manager_delegate.h +++ b/chrome/browser/speech/chrome_speech_recognition_manager_delegate.h @@ -48,7 +48,7 @@ class ChromeSpeechRecognitionManagerDelegate private: class OptionalRequestInfo; - // Checks for VIEW_TYPE_WEB_CONTENTS host in the UI thread and notifies back + // Checks for VIEW_TYPE_TAB_CONTENTS host in the UI thread and notifies back // the result in the IO thread through |callback|. static void CheckRenderViewType( int session_id, diff --git a/chrome/browser/task_manager/task_manager_resource_providers.cc b/chrome/browser/task_manager/task_manager_resource_providers.cc index b252812..d68c9df 100644 --- a/chrome/browser/task_manager/task_manager_resource_providers.cc +++ b/chrome/browser/task_manager/task_manager_resource_providers.cc @@ -1323,11 +1323,9 @@ bool TaskManagerExtensionProcessResourceProvider:: // Don't add WebContents (those are handled by // TaskManagerTabContentsResourceProvider) or background contents (handled // by TaskManagerBackgroundResourceProvider). - // TODO(benwells): create specific chrome::VIEW_TYPE_TAB_CONTENTS for - // tab contents, as VIEW_TYPE_WEB_CONTENTS is the default. content::ViewType view_type = render_view_host->GetDelegate()->GetRenderViewType(); - return (view_type != content::VIEW_TYPE_WEB_CONTENTS && + return (view_type != chrome::VIEW_TYPE_TAB_CONTENTS && view_type != chrome::VIEW_TYPE_BACKGROUND_CONTENTS); } diff --git a/chrome/browser/ui/tab_contents/tab_contents_wrapper.cc b/chrome/browser/ui/tab_contents/tab_contents_wrapper.cc index c2003a8..2d4dca2 100644 --- a/chrome/browser/ui/tab_contents/tab_contents_wrapper.cc +++ b/chrome/browser/ui/tab_contents/tab_contents_wrapper.cc @@ -47,6 +47,7 @@ #include "chrome/browser/ui/sync/tab_contents_wrapper_synced_tab_delegate.h" #include "chrome/browser/ui/tab_contents/core_tab_helper.h" #include "chrome/common/chrome_switches.h" +#include "chrome/common/chrome_view_type.h" #include "content/public/browser/web_contents.h" using content::WebContents; @@ -68,6 +69,8 @@ TabContentsWrapper::TabContentsWrapper(WebContents* contents) DCHECK(contents); DCHECK(!GetCurrentWrapperForContents(contents)); + web_contents_->SetViewType(chrome::VIEW_TYPE_TAB_CONTENTS); + // Stash this in the property bag so it can be retrieved without having to // go to a Browser. property_accessor()->SetProperty(contents->GetPropertyBag(), this); |