diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-12 15:53:56 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-12 15:53:56 +0000 |
commit | da4dfc470626ec77c6eb3ace17e0ef009bb7f32f (patch) | |
tree | 67889a0b4921c28adcb5f7389240379351bac80f | |
parent | 03e09864d6b5738fab87b3d1e5aaeca35b0d08b6 (diff) | |
download | chromium_src-da4dfc470626ec77c6eb3ace17e0ef009bb7f32f.zip chromium_src-da4dfc470626ec77c6eb3ace17e0ef009bb7f32f.tar.gz chromium_src-da4dfc470626ec77c6eb3ace17e0ef009bb7f32f.tar.bz2 |
Move view_types to content\public\common. Also update the enum values to match the convention that we're using for the Content API.
BUG=98716
Review URL: http://codereview.chromium.org/8232024
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@105083 0039d316-1c4b-4281-b951-d872f2087c98
30 files changed, 163 insertions, 187 deletions
diff --git a/chrome/browser/automation/testing_automation_provider.cc b/chrome/browser/automation/testing_automation_provider.cc index 288275f..3a4b637 100644 --- a/chrome/browser/automation/testing_automation_provider.cc +++ b/chrome/browser/automation/testing_automation_provider.cc @@ -2916,16 +2916,16 @@ void TestingAutomationProvider::GetBrowserInfo( item->Set("view", view); std::string type; switch (ex_host->extension_host_type()) { - case chrome::ViewType::EXTENSION_BACKGROUND_PAGE: + case chrome::VIEW_TYPE_EXTENSION_BACKGROUND_PAGE: type = "EXTENSION_BACKGROUND_PAGE"; break; - case chrome::ViewType::EXTENSION_POPUP: + case chrome::VIEW_TYPE_EXTENSION_POPUP: type = "EXTENSION_POPUP"; break; - case chrome::ViewType::EXTENSION_INFOBAR: + case chrome::VIEW_TYPE_EXTENSION_INFOBAR: type = "EXTENSION_INFOBAR"; break; - case chrome::ViewType::EXTENSION_DIALOG: + case chrome::VIEW_TYPE_EXTENSION_DIALOG: type = "EXTENSION_DIALOG"; break; default: diff --git a/chrome/browser/extensions/extension_bookmark_manager_api.cc b/chrome/browser/extensions/extension_bookmark_manager_api.cc index af347e9..10da193 100644 --- a/chrome/browser/extensions/extension_bookmark_manager_api.cc +++ b/chrome/browser/extensions/extension_bookmark_manager_api.cc @@ -371,7 +371,7 @@ bool StartDragBookmarkManagerFunction::RunImpl() { GetNodesFromArguments(model, args_.get(), 0, &nodes)); if (render_view_host_->delegate()->GetRenderViewType() == - content::ViewType::TAB_CONTENTS) { + content::VIEW_TYPE_TAB_CONTENTS) { TabContents* tab_contents = dispatcher()->delegate()->GetAssociatedTabContents(); CHECK(tab_contents); @@ -413,7 +413,7 @@ bool DropBookmarkManagerFunction::RunImpl() { drop_index = drop_parent->child_count(); if (render_view_host_->delegate()->GetRenderViewType() == - content::ViewType::TAB_CONTENTS) { + content::VIEW_TYPE_TAB_CONTENTS) { TabContents* tab_contents = dispatcher()->delegate()->GetAssociatedTabContents(); CHECK(tab_contents); diff --git a/chrome/browser/extensions/extension_host.cc b/chrome/browser/extensions/extension_host.cc index 0902ba7..0d4fa00 100644 --- a/chrome/browser/extensions/extension_host.cc +++ b/chrome/browser/extensions/extension_host.cc @@ -130,7 +130,7 @@ class ExtensionHost::ProcessCreationQueue { ExtensionHost::ExtensionHost(const Extension* extension, SiteInstance* site_instance, const GURL& url, - content::ViewType::Type host_type) + content::ViewType host_type) : extension_(extension), extension_id_(extension->id()), profile_(Profile::FromBrowserContext( @@ -215,9 +215,9 @@ void ExtensionHost::CreateRenderViewSoon(RenderWidgetHostView* host_view) { void ExtensionHost::CreateRenderViewNow() { render_view_host_->CreateRenderView(string16()); - if (extension_host_type_ == chrome::ViewType::EXTENSION_POPUP || - extension_host_type_ == chrome::ViewType::EXTENSION_DIALOG || - extension_host_type_ == chrome::ViewType::EXTENSION_INFOBAR) { + if (extension_host_type_ == chrome::VIEW_TYPE_EXTENSION_POPUP || + extension_host_type_ == chrome::VIEW_TYPE_EXTENSION_DIALOG || + extension_host_type_ == chrome::VIEW_TYPE_EXTENSION_INFOBAR) { // If the host is bound to a browser, then extract its window id. // Extensions hosted in ExternalTabContainer objects may not have // an associated browser. @@ -358,9 +358,9 @@ void ExtensionHost::DisableScrollbarsForSmallWindows( void ExtensionHost::DidStopLoading() { bool notify = !did_stop_loading_; did_stop_loading_ = true; - if (extension_host_type_ == chrome::ViewType::EXTENSION_POPUP || - extension_host_type_ == chrome::ViewType::EXTENSION_DIALOG || - extension_host_type_ == chrome::ViewType::EXTENSION_INFOBAR) { + if (extension_host_type_ == chrome::VIEW_TYPE_EXTENSION_POPUP || + extension_host_type_ == chrome::VIEW_TYPE_EXTENSION_DIALOG || + extension_host_type_ == chrome::VIEW_TYPE_EXTENSION_INFOBAR) { #if defined(TOOLKIT_VIEWS) if (view_.get()) view_->DidStopLoading(); @@ -371,16 +371,16 @@ void ExtensionHost::DidStopLoading() { chrome::NOTIFICATION_EXTENSION_HOST_DID_STOP_LOADING, Source<Profile>(profile_), Details<ExtensionHost>(this)); - if (extension_host_type_ == chrome::ViewType::EXTENSION_BACKGROUND_PAGE) { + if (extension_host_type_ == chrome::VIEW_TYPE_EXTENSION_BACKGROUND_PAGE) { UMA_HISTOGRAM_TIMES("Extensions.BackgroundPageLoadTime", since_created_.Elapsed()); - } else if (extension_host_type_ == chrome::ViewType::EXTENSION_DIALOG) { + } else if (extension_host_type_ == chrome::VIEW_TYPE_EXTENSION_DIALOG) { UMA_HISTOGRAM_TIMES("Extensions.DialogLoadTime", since_created_.Elapsed()); - } else if (extension_host_type_ == chrome::ViewType::EXTENSION_POPUP) { + } else if (extension_host_type_ == chrome::VIEW_TYPE_EXTENSION_POPUP) { UMA_HISTOGRAM_TIMES("Extensions.PopupLoadTime", since_created_.Elapsed()); - } else if (extension_host_type_ == chrome::ViewType::EXTENSION_INFOBAR) { + } else if (extension_host_type_ == chrome::VIEW_TYPE_EXTENSION_INFOBAR) { UMA_HISTOGRAM_TIMES("Extensions.InfobarLoadTime", since_created_.Elapsed()); } @@ -398,7 +398,7 @@ void ExtensionHost::DocumentAvailableInMainFrame(RenderViewHost* rvh) { profile_->GetExtensionService()->SetBackgroundPageReady(extension_); } else { switch (extension_host_type_) { - case chrome::ViewType::EXTENSION_INFOBAR: + case chrome::VIEW_TYPE_EXTENSION_INFOBAR: InsertInfobarCSS(); break; default: @@ -409,7 +409,7 @@ void ExtensionHost::DocumentAvailableInMainFrame(RenderViewHost* rvh) { void ExtensionHost::DocumentOnLoadCompletedInMainFrame(RenderViewHost* rvh, int32 page_id) { - if (chrome::ViewType::EXTENSION_POPUP == GetRenderViewType()) { + if (chrome::VIEW_TYPE_EXTENSION_POPUP == GetRenderViewType()) { NotificationService::current()->Notify( chrome::NOTIFICATION_EXTENSION_POPUP_VIEW_READY, Source<Profile>(profile_), @@ -478,10 +478,10 @@ void ExtensionHost::OnDialogClosed(IPC::Message* reply_msg, } void ExtensionHost::Close(RenderViewHost* render_view_host) { - if (extension_host_type_ == chrome::ViewType::EXTENSION_POPUP || - extension_host_type_ == chrome::ViewType::EXTENSION_DIALOG || - extension_host_type_ == chrome::ViewType::EXTENSION_BACKGROUND_PAGE || - extension_host_type_ == chrome::ViewType::EXTENSION_INFOBAR) { + if (extension_host_type_ == chrome::VIEW_TYPE_EXTENSION_POPUP || + extension_host_type_ == chrome::VIEW_TYPE_EXTENSION_DIALOG || + extension_host_type_ == chrome::VIEW_TYPE_EXTENSION_BACKGROUND_PAGE || + extension_host_type_ == chrome::VIEW_TYPE_EXTENSION_INFOBAR) { NotificationService::current()->Notify( chrome::NOTIFICATION_EXTENSION_HOST_VIEW_SHOULD_CLOSE, Source<Profile>(profile_), @@ -515,15 +515,15 @@ WebPreferences ExtensionHost::GetWebkitPrefs() { webkit_prefs.loads_images_automatically = true; webkit_prefs.javascript_enabled = true; - if (extension_host_type_ == chrome::ViewType::EXTENSION_POPUP || - extension_host_type_ == chrome::ViewType::EXTENSION_DIALOG || - extension_host_type_ == chrome::ViewType::EXTENSION_BACKGROUND_PAGE || - extension_host_type_ == chrome::ViewType::EXTENSION_INFOBAR) + if (extension_host_type_ == chrome::VIEW_TYPE_EXTENSION_POPUP || + extension_host_type_ == chrome::VIEW_TYPE_EXTENSION_DIALOG || + extension_host_type_ == chrome::VIEW_TYPE_EXTENSION_BACKGROUND_PAGE || + extension_host_type_ == chrome::VIEW_TYPE_EXTENSION_INFOBAR) webkit_prefs.allow_scripts_to_close_windows = true; // Disable anything that requires the GPU process for background pages. // See http://crbug.com/64512 and http://crbug.com/64841. - if (extension_host_type_ == chrome::ViewType::EXTENSION_BACKGROUND_PAGE) { + if (extension_host_type_ == chrome::VIEW_TYPE_EXTENSION_BACKGROUND_PAGE) { webkit_prefs.experimental_webgl_enabled = false; webkit_prefs.accelerated_compositing_enabled = false; webkit_prefs.accelerated_2d_canvas_enabled = false; @@ -538,7 +538,7 @@ RenderViewHostDelegate::View* ExtensionHost::GetViewDelegate() { bool ExtensionHost::PreHandleKeyboardEvent(const NativeWebKeyboardEvent& event, bool* is_keyboard_shortcut) { - if (extension_host_type_ == chrome::ViewType::EXTENSION_POPUP && + if (extension_host_type_ == chrome::VIEW_TYPE_EXTENSION_POPUP && event.type == NativeWebKeyboardEvent::RawKeyDown && event.windowsKeyCode == ui::VKEY_ESCAPE) { DCHECK(is_keyboard_shortcut != NULL); @@ -548,7 +548,7 @@ bool ExtensionHost::PreHandleKeyboardEvent(const NativeWebKeyboardEvent& event, } void ExtensionHost::HandleKeyboardEvent(const NativeWebKeyboardEvent& event) { - if (extension_host_type_ == chrome::ViewType::EXTENSION_POPUP) { + if (extension_host_type_ == chrome::VIEW_TYPE_EXTENSION_POPUP) { if (event.type == NativeWebKeyboardEvent::RawKeyDown && event.windowsKeyCode == ui::VKEY_ESCAPE) { NotificationService::current()->Notify( @@ -770,7 +770,7 @@ void ExtensionHost::GotFocus() { void ExtensionHost::TakeFocus(bool reverse) { } -content::ViewType::Type ExtensionHost::GetRenderViewType() const { +content::ViewType ExtensionHost::GetRenderViewType() const { return extension_host_type_; } @@ -795,8 +795,8 @@ void ExtensionHost::RenderViewCreated(RenderViewHost* render_view_host) { if (view_.get()) view_->RenderViewCreated(); - if (extension_host_type_ == chrome::ViewType::EXTENSION_POPUP || - extension_host_type_ == chrome::ViewType::EXTENSION_INFOBAR) { + if (extension_host_type_ == chrome::VIEW_TYPE_EXTENSION_POPUP || + extension_host_type_ == chrome::VIEW_TYPE_EXTENSION_INFOBAR) { render_view_host->EnablePreferredSizeMode( kPreferredSizeWidth | kPreferredSizeHeightThisIsSlow); } diff --git a/chrome/browser/extensions/extension_host.h b/chrome/browser/extensions/extension_host.h index 40b5c00..84f4b64 100644 --- a/chrome/browser/extensions/extension_host.h +++ b/chrome/browser/extensions/extension_host.h @@ -51,7 +51,7 @@ class ExtensionHost : public RenderViewHostDelegate, static void EnableDOMAutomation() { enable_dom_automation_ = true; } ExtensionHost(const Extension* extension, SiteInstance* site_instance, - const GURL& url, content::ViewType::Type host_type); + const GURL& url, content::ViewType host_type); virtual ~ExtensionHost(); #if defined(TOOLKIT_VIEWS) @@ -84,7 +84,7 @@ class ExtensionHost : public RenderViewHostDelegate, Profile* profile() const { return profile_; } - content::ViewType::Type extension_host_type() const { + content::ViewType extension_host_type() const { return extension_host_type_; } @@ -116,7 +116,7 @@ class ExtensionHost : public RenderViewHostDelegate, virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; virtual const GURL& GetURL() const OVERRIDE; virtual void RenderViewCreated(RenderViewHost* render_view_host) OVERRIDE; - virtual content::ViewType::Type GetRenderViewType() const OVERRIDE; + virtual content::ViewType GetRenderViewType() const OVERRIDE; virtual void RenderViewGone(RenderViewHost* render_view_host, base::TerminationStatus status, int error_code) OVERRIDE; @@ -277,7 +277,7 @@ class ExtensionHost : public RenderViewHostDelegate, // Only EXTENSION_INFOBAR, EXTENSION_POPUP, and EXTENSION_BACKGROUND_PAGE // are used here, others are not hosted by ExtensionHost. - content::ViewType::Type extension_host_type_; + content::ViewType extension_host_type_; // The relevant TabContents associated with this ExtensionHost, if any. TabContents* associated_tab_contents_; diff --git a/chrome/browser/extensions/extension_host_mac.h b/chrome/browser/extensions/extension_host_mac.h index b7dfe88..d688f9f4 100644 --- a/chrome/browser/extensions/extension_host_mac.h +++ b/chrome/browser/extensions/extension_host_mac.h @@ -13,7 +13,7 @@ class RenderWidgetHostView; class ExtensionHostMac : public ExtensionHost { public: ExtensionHostMac(const Extension* extension, SiteInstance* site_instance, - const GURL& url, content::ViewType::Type host_type) : + const GURL& url, content::ViewType host_type) : ExtensionHost(extension, site_instance, url, host_type) {} virtual ~ExtensionHostMac(); protected: diff --git a/chrome/browser/extensions/extension_host_mac.mm b/chrome/browser/extensions/extension_host_mac.mm index 8b3ee43..d5f16f8 100644 --- a/chrome/browser/extensions/extension_host_mac.mm +++ b/chrome/browser/extensions/extension_host_mac.mm @@ -52,7 +52,7 @@ void ExtensionHostMac::ShowCreatedWidgetInternal( void ExtensionHostMac::UnhandledKeyboardEvent( const NativeWebKeyboardEvent& event) { if (event.skip_in_browser || event.type == NativeWebKeyboardEvent::Char || - extension_host_type() != chrome::ViewType::EXTENSION_POPUP) { + extension_host_type() != chrome::VIEW_TYPE_EXTENSION_POPUP) { return; } diff --git a/chrome/browser/extensions/extension_process_manager.cc b/chrome/browser/extensions/extension_process_manager.cc index 61a6711..9cf5ba8 100644 --- a/chrome/browser/extensions/extension_process_manager.cc +++ b/chrome/browser/extensions/extension_process_manager.cc @@ -39,7 +39,7 @@ class IncognitoExtensionProcessManager : public ExtensionProcessManager { const Extension* extension, const GURL& url, Browser* browser, - content::ViewType::Type view_type) OVERRIDE; + content::ViewType view_type) OVERRIDE; virtual void CreateBackgroundHost(const Extension* extension, const GURL& url); virtual SiteInstance* GetSiteInstanceForURL(const GURL& url); @@ -122,11 +122,11 @@ ExtensionHost* ExtensionProcessManager::CreateViewHost( const Extension* extension, const GURL& url, Browser* browser, - content::ViewType::Type view_type) { + content::ViewType view_type) { DCHECK(extension); // A NULL browser may only be given for pop-up views. DCHECK(browser || - (!browser && view_type == chrome::ViewType::EXTENSION_POPUP)); + (!browser && view_type == chrome::VIEW_TYPE_EXTENSION_POPUP)); ExtensionHost* host = #if defined(OS_MACOSX) new ExtensionHostMac(extension, GetSiteInstanceForURL(url), url, @@ -140,10 +140,10 @@ ExtensionHost* ExtensionProcessManager::CreateViewHost( } ExtensionHost* ExtensionProcessManager::CreateViewHost( - const GURL& url, Browser* browser, content::ViewType::Type view_type) { + const GURL& url, Browser* browser, content::ViewType view_type) { // A NULL browser may only be given for pop-up views. DCHECK(browser || - (!browser && view_type == chrome::ViewType::EXTENSION_POPUP)); + (!browser && view_type == chrome::VIEW_TYPE_EXTENSION_POPUP)); Profile* profile = Profile::FromBrowserContext(browsing_instance_->browser_context()); ExtensionService* service = profile->GetExtensionService(); @@ -158,28 +158,28 @@ ExtensionHost* ExtensionProcessManager::CreateViewHost( ExtensionHost* ExtensionProcessManager::CreatePopupHost( const Extension* extension, const GURL& url, Browser* browser) { return CreateViewHost( - extension, url, browser, chrome::ViewType::EXTENSION_POPUP); + extension, url, browser, chrome::VIEW_TYPE_EXTENSION_POPUP); } ExtensionHost* ExtensionProcessManager::CreatePopupHost( const GURL& url, Browser* browser) { - return CreateViewHost(url, browser, chrome::ViewType::EXTENSION_POPUP); + return CreateViewHost(url, browser, chrome::VIEW_TYPE_EXTENSION_POPUP); } ExtensionHost* ExtensionProcessManager::CreateDialogHost( const GURL& url, Browser* browser) { - return CreateViewHost(url, browser, chrome::ViewType::EXTENSION_DIALOG); + return CreateViewHost(url, browser, chrome::VIEW_TYPE_EXTENSION_DIALOG); } ExtensionHost* ExtensionProcessManager::CreateInfobarHost( const Extension* extension, const GURL& url, Browser* browser) { return CreateViewHost( - extension, url, browser, chrome::ViewType::EXTENSION_INFOBAR); + extension, url, browser, chrome::VIEW_TYPE_EXTENSION_INFOBAR); } ExtensionHost* ExtensionProcessManager::CreateInfobarHost( const GURL& url, Browser* browser) { - return CreateViewHost(url, browser, chrome::ViewType::EXTENSION_INFOBAR); + return CreateViewHost(url, browser, chrome::VIEW_TYPE_EXTENSION_INFOBAR); } void ExtensionProcessManager::CreateBackgroundHost( @@ -196,10 +196,10 @@ void ExtensionProcessManager::CreateBackgroundHost( ExtensionHost* host = #if defined(OS_MACOSX) new ExtensionHostMac(extension, GetSiteInstanceForURL(url), url, - chrome::ViewType::EXTENSION_BACKGROUND_PAGE); + chrome::VIEW_TYPE_EXTENSION_BACKGROUND_PAGE); #else new ExtensionHost(extension, GetSiteInstanceForURL(url), url, - chrome::ViewType::EXTENSION_BACKGROUND_PAGE); + chrome::VIEW_TYPE_EXTENSION_BACKGROUND_PAGE); #endif host->CreateRenderViewSoon(NULL); // create a RenderViewHost with no view @@ -428,7 +428,7 @@ void ExtensionProcessManager::Observe(int type, case chrome::NOTIFICATION_EXTENSION_HOST_VIEW_SHOULD_CLOSE: { ExtensionHost* host = Details<ExtensionHost>(details).ptr(); if (host->extension_host_type() == - chrome::ViewType::EXTENSION_BACKGROUND_PAGE) { + chrome::VIEW_TYPE_EXTENSION_BACKGROUND_PAGE) { delete host; // |host| should deregister itself from our structures. CHECK(background_hosts_.find(host) == background_hosts_.end()); @@ -489,7 +489,7 @@ ExtensionHost* IncognitoExtensionProcessManager::CreateViewHost( const Extension* extension, const GURL& url, Browser* browser, - content::ViewType::Type view_type) { + content::ViewType view_type) { if (extension->incognito_split_mode()) { if (IsIncognitoEnabled(extension)) { return ExtensionProcessManager::CreateViewHost(extension, url, diff --git a/chrome/browser/extensions/extension_process_manager.h b/chrome/browser/extensions/extension_process_manager.h index 018ff7f..7ca82de 100644 --- a/chrome/browser/extensions/extension_process_manager.h +++ b/chrome/browser/extensions/extension_process_manager.h @@ -14,7 +14,7 @@ #include "base/memory/ref_counted.h" #include "content/common/notification_observer.h" #include "content/common/notification_registrar.h" -#include "content/common/view_types.h" +#include "content/public/common/view_types.h" class Browser; class BrowsingInstance; @@ -39,10 +39,10 @@ class ExtensionProcessManager : public NotificationObserver { virtual ExtensionHost* CreateViewHost(const Extension* extension, const GURL& url, Browser* browser, - content::ViewType::Type view_type); + content::ViewType view_type); ExtensionHost* CreateViewHost(const GURL& url, Browser* browser, - content::ViewType::Type view_type); + content::ViewType view_type); ExtensionHost* CreatePopupHost(const Extension* extension, const GURL& url, Browser* browser); diff --git a/chrome/browser/memory_details.cc b/chrome/browser/memory_details.cc index fd49b30..9f77ac5 100644 --- a/chrome/browser/memory_details.cc +++ b/chrome/browser/memory_details.cc @@ -164,11 +164,11 @@ void MemoryDetails::CollectChildInfoOnUIThread() { RenderViewHostDelegate* host_delegate = host->delegate(); DCHECK(host_delegate); GURL url = host_delegate->GetURL(); - content::ViewType::Type type = host_delegate->GetRenderViewType(); + content::ViewType type = host_delegate->GetRenderViewType(); if (host->enabled_bindings() & content::BINDINGS_POLICY_WEB_UI) { // TODO(erikkay) the type for devtools doesn't actually appear to // be set. - if (type == content::ViewType::DEV_TOOLS_UI) + if (type == content::VIEW_TYPE_DEV_TOOLS_UI) process.renderer_type = ChildProcessInfo::RENDERER_DEVTOOLS; else process.renderer_type = ChildProcessInfo::RENDERER_CHROME; @@ -190,14 +190,14 @@ void MemoryDetails::CollectChildInfoOnUIThread() { ChildProcessInfo::RENDERER_UNKNOWN) { process.titles.push_back(UTF8ToUTF16(url.spec())); switch (type) { - case chrome::ViewType::BACKGROUND_CONTENTS: + case chrome::VIEW_TYPE_BACKGROUND_CONTENTS: process.renderer_type = ChildProcessInfo::RENDERER_BACKGROUND_APP; break; - case content::ViewType::INTERSTITIAL_PAGE: + case content::VIEW_TYPE_INTERSTITIAL_PAGE: process.renderer_type = ChildProcessInfo::RENDERER_INTERSTITIAL; break; - case chrome::ViewType::NOTIFICATION: + case chrome::VIEW_TYPE_NOTIFICATION: process.renderer_type = ChildProcessInfo::RENDERER_NOTIFICATION; break; default: diff --git a/chrome/browser/notifications/balloon_host.cc b/chrome/browser/notifications/balloon_host.cc index 7d412ec..1c4ef20 100644 --- a/chrome/browser/notifications/balloon_host.cc +++ b/chrome/browser/notifications/balloon_host.cc @@ -102,8 +102,8 @@ void BalloonHost::RenderViewGone(RenderViewHost* render_view_host, Close(render_view_host); } -content::ViewType::Type BalloonHost::GetRenderViewType() const { - return chrome::ViewType::NOTIFICATION; +content::ViewType BalloonHost::GetRenderViewType() const { + return chrome::VIEW_TYPE_NOTIFICATION; } RenderViewHostDelegate::View* BalloonHost::GetViewDelegate() { diff --git a/chrome/browser/notifications/balloon_host.h b/chrome/browser/notifications/balloon_host.h index 62aff03..fc2488d 100644 --- a/chrome/browser/notifications/balloon_host.h +++ b/chrome/browser/notifications/balloon_host.h @@ -58,7 +58,7 @@ class BalloonHost : public RenderViewHostDelegate, virtual void RenderViewGone(RenderViewHost* render_view_host, base::TerminationStatus status, int error_code) OVERRIDE; - virtual content::ViewType::Type GetRenderViewType() const OVERRIDE; + virtual content::ViewType GetRenderViewType() const OVERRIDE; virtual RenderViewHostDelegate::View* GetViewDelegate() OVERRIDE; virtual void HandleMouseDown() OVERRIDE; virtual RendererPreferences GetRendererPrefs( diff --git a/chrome/browser/tab_contents/background_contents.cc b/chrome/browser/tab_contents/background_contents.cc index ff05f28..e016067 100644 --- a/chrome/browser/tab_contents/background_contents.cc +++ b/chrome/browser/tab_contents/background_contents.cc @@ -74,8 +74,8 @@ const GURL& BackgroundContents::GetURL() const { return url_; } -content::ViewType::Type BackgroundContents::GetRenderViewType() const { - return chrome::ViewType::BACKGROUND_CONTENTS; +content::ViewType BackgroundContents::GetRenderViewType() const { + return chrome::VIEW_TYPE_BACKGROUND_CONTENTS; } void BackgroundContents::DidNavigate( diff --git a/chrome/browser/tab_contents/background_contents.h b/chrome/browser/tab_contents/background_contents.h index e0632f3..e41199c 100644 --- a/chrome/browser/tab_contents/background_contents.h +++ b/chrome/browser/tab_contents/background_contents.h @@ -62,7 +62,7 @@ class BackgroundContents : public RenderViewHostDelegate, virtual BackgroundContents* GetAsBackgroundContents() OVERRIDE; virtual RenderViewHostDelegate::View* GetViewDelegate() OVERRIDE; virtual const GURL& GetURL() const OVERRIDE; - virtual content::ViewType::Type GetRenderViewType() const OVERRIDE; + virtual content::ViewType GetRenderViewType() const OVERRIDE; virtual void DidNavigate( RenderViewHost* render_view_host, const ViewHostMsg_FrameNavigate_Params& params) OVERRIDE; diff --git a/chrome/browser/task_manager/task_manager.cc b/chrome/browser/task_manager/task_manager.cc index 16e5bd30..dfe4964 100644 --- a/chrome/browser/task_manager/task_manager.cc +++ b/chrome/browser/task_manager/task_manager.cc @@ -1090,7 +1090,7 @@ int CountExtensionBackgroundPagesForProfile(Profile* profile) { iter != manager->end(); ++iter) { if ((*iter)->GetRenderViewType() == - chrome::ViewType::EXTENSION_BACKGROUND_PAGE) { + chrome::VIEW_TYPE_EXTENSION_BACKGROUND_PAGE) { count++; } } diff --git a/chrome/browser/task_manager/task_manager_resource_providers.cc b/chrome/browser/task_manager/task_manager_resource_providers.cc index 49cc7b0..f44192f 100644 --- a/chrome/browser/task_manager/task_manager_resource_providers.cc +++ b/chrome/browser/task_manager/task_manager_resource_providers.cc @@ -1091,7 +1091,7 @@ const Extension* TaskManagerExtensionProcessResource::GetExtension() const { bool TaskManagerExtensionProcessResource::IsBackground() const { return extension_host_->GetRenderViewType() == - chrome::ViewType::EXTENSION_BACKGROUND_PAGE; + chrome::VIEW_TYPE_EXTENSION_BACKGROUND_PAGE; } //////////////////////////////////////////////////////////////////////////////// diff --git a/chrome/browser/ui/webui/options/extension_settings_handler.cc b/chrome/browser/ui/webui/options/extension_settings_handler.cc index ccc5283..e0b2c98 100644 --- a/chrome/browser/ui/webui/options/extension_settings_handler.cc +++ b/chrome/browser/ui/webui/options/extension_settings_handler.cc @@ -787,8 +787,8 @@ void ExtensionSettingsHandler::GetActivePagesForExtensionProcess( const RenderViewHost* host = static_cast<const RenderViewHost*>(widget); int host_type = host->delegate()->GetRenderViewType(); if (host == deleting_rvh_ || - chrome::ViewType::EXTENSION_POPUP == host_type || - chrome::ViewType::EXTENSION_DIALOG == host_type) + chrome::VIEW_TYPE_EXTENSION_POPUP == host_type || + chrome::VIEW_TYPE_EXTENSION_DIALOG == host_type) continue; GURL url = host->delegate()->GetURL(); diff --git a/chrome/common/chrome_view_types.cc b/chrome/common/chrome_view_types.cc index cc85c77..99a7463 100644 --- a/chrome/common/chrome_view_types.cc +++ b/chrome/common/chrome_view_types.cc @@ -5,11 +5,11 @@ #include "chrome/common/chrome_view_types.h" namespace chrome { -const char* const ViewType::kTabContents = "TAB"; -const char* const ViewType::kBackgroundPage = "BACKGROUND"; -const char* const ViewType::kPopup = "POPUP"; -const char* const ViewType::kInfobar = "INFOBAR"; -const char* const ViewType::kNotification = "NOTIFICATION"; -const char* const ViewType::kExtensionDialog = "EXTENSION_DIALOG"; -const char* const ViewType::kAll = "ALL"; +const char kViewTypeTabContents[] = "TAB"; +const char kViewTypeBackgroundPage[] = "BACKGROUND"; +const char kViewTypePopup[] = "POPUP"; +const char kViewTypeInfobar[] = "INFOBAR"; +const char kViewTypeNotification[] = "NOTIFICATION"; +const char kViewTypeExtensionDialog[] = "EXTENSION_DIALOG"; +const char kViewTypeAll[] = "ALL"; } // namespace chrome diff --git a/chrome/common/chrome_view_types.h b/chrome/common/chrome_view_types.h index 615ea08..a5e5b6b 100644 --- a/chrome/common/chrome_view_types.h +++ b/chrome/common/chrome_view_types.h @@ -6,42 +6,32 @@ #define CHROME_COMMON_CHROME_VIEW_TYPES_H_ #pragma once -#include "base/basictypes.h" -#include "content/common/view_types.h" +#include "content/public/common/view_types.h" namespace chrome { -// Indicates different types of views -class ViewType { - public: - enum { - VIEW_TYPE_CHROME_START = content::ViewType::VIEW_TYPE_CONTENT_END, - - BACKGROUND_CONTENTS, - EXTENSION_BACKGROUND_PAGE, - EXTENSION_POPUP, - EXTENSION_INFOBAR, - NOTIFICATION, - EXTENSION_DIALOG, - }; - - // Constant strings corresponding to the Type enumeration values. Used - // when converting JS arguments. - static const char* const kTabContents; - static const char* const kBackgroundPage; - static const char* const kPopup; - static const char* const kInfobar; - static const char* const kNotification; - static const char* const kExtensionDialog; - static const char* const kAll; - - private: - // This class is for scoping only, so you shouldn't create an instance of it. - ViewType() {} - - DISALLOW_COPY_AND_ASSIGN(ViewType); +// Indicates different types of views. +enum ViewType { + VIEW_TYPE_CHROME_START = content::VIEW_TYPE_CONTENT_END, + + VIEW_TYPE_BACKGROUND_CONTENTS, + VIEW_TYPE_EXTENSION_BACKGROUND_PAGE, + VIEW_TYPE_EXTENSION_POPUP, + VIEW_TYPE_EXTENSION_INFOBAR, + VIEW_TYPE_NOTIFICATION, + VIEW_TYPE_EXTENSION_DIALOG, }; +// Constant strings corresponding to the Type enumeration values. Used +// when converting JS arguments. +extern const char kViewTypeTabContents[]; +extern const char kViewTypeBackgroundPage[]; +extern const char kViewTypePopup[]; +extern const char kViewTypeInfobar[]; +extern const char kViewTypeNotification[]; +extern const char kViewTypeExtensionDialog[]; +extern const char kViewTypeAll[]; + } // namespace chrome #endif // CHROME_COMMON_CHROME_VIEW_TYPES_H_ diff --git a/chrome/common/extensions/extension_messages.h b/chrome/common/extensions/extension_messages.h index 48dbc3c..f11ea16 100644 --- a/chrome/common/extensions/extension_messages.h +++ b/chrome/common/extensions/extension_messages.h @@ -12,7 +12,7 @@ #include "chrome/common/extensions/url_pattern.h" #include "chrome/common/extensions/url_pattern_set.h" #include "chrome/common/web_apps.h" -#include "content/common/view_types.h" +#include "content/public/common/view_types.h" #include "ipc/ipc_message_macros.h" #define IPC_MESSAGE_START ExtensionMsgStart @@ -236,7 +236,7 @@ IPC_MESSAGE_CONTROL5(ExtensionMsg_UpdatePermissions, // Tell the renderer which type this view is. IPC_MESSAGE_ROUTED1(ExtensionMsg_NotifyRenderViewType, - content::ViewType::Type /* view_type */) + content::ViewType /* view_type */) // Messages sent from the renderer to the browser. diff --git a/chrome/renderer/extensions/extension_helper.cc b/chrome/renderer/extensions/extension_helper.cc index 34bb2c9..f516603 100644 --- a/chrome/renderer/extensions/extension_helper.cc +++ b/chrome/renderer/extensions/extension_helper.cc @@ -54,7 +54,7 @@ ExtensionHelper::ExtensionHelper(content::RenderView* render_view, content::RenderViewObserverTracker<ExtensionHelper>(render_view), extension_dispatcher_(extension_dispatcher), pending_app_icon_requests_(0), - view_type_(content::ViewType::INVALID), + view_type_(content::VIEW_TYPE_INVALID), browser_window_id_(-1) { } @@ -259,7 +259,7 @@ void ExtensionHelper::OnGetApplicationInfo(int page_id) { routing_id(), page_id, app_info)); } -void ExtensionHelper::OnNotifyRendererViewType(content::ViewType::Type type) { +void ExtensionHelper::OnNotifyRendererViewType(content::ViewType type) { view_type_ = type; } diff --git a/chrome/renderer/extensions/extension_helper.h b/chrome/renderer/extensions/extension_helper.h index 261d638..b136e73 100644 --- a/chrome/renderer/extensions/extension_helper.h +++ b/chrome/renderer/extensions/extension_helper.h @@ -13,7 +13,7 @@ #include "base/memory/scoped_ptr.h" #include "content/public/renderer/render_view_observer.h" #include "content/public/renderer/render_view_observer_tracker.h" -#include "content/common/view_types.h" +#include "content/public/common/view_types.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebURLResponse.h" class ExtensionDispatcher; @@ -52,7 +52,7 @@ class ExtensionHelper GURL requestor_url); int browser_window_id() const { return browser_window_id_; } - content::ViewType::Type view_type() const { return view_type_; } + content::ViewType view_type() const { return view_type_; } private: // RenderViewObserver implementation. @@ -76,7 +76,7 @@ class ExtensionHelper const std::string& message); void OnExecuteCode(const ExtensionMsg_ExecuteCode_Params& params); void OnGetApplicationInfo(int page_id); - void OnNotifyRendererViewType(content::ViewType::Type view_type); + void OnNotifyRendererViewType(content::ViewType view_type); void OnUpdateBrowserWindowId(int window_id); void OnInlineWebstoreInstallResponse( int install_id, bool success, const std::string& error); @@ -114,7 +114,7 @@ class ExtensionHelper int pending_app_icon_requests_; // Type of view attached with RenderView. - content::ViewType::Type view_type_; + content::ViewType view_type_; // Id number of browser window which RenderView is attached to. int browser_window_id_; diff --git a/chrome/renderer/extensions/extension_process_bindings.cc b/chrome/renderer/extensions/extension_process_bindings.cc index d6c37e5..223ecd0 100644 --- a/chrome/renderer/extensions/extension_process_bindings.cc +++ b/chrome/renderer/extensions/extension_process_bindings.cc @@ -85,7 +85,7 @@ class ExtensionViewAccumulator : public content::RenderViewVisitor { public: ExtensionViewAccumulator(const std::string& extension_id, int browser_window_id, - content::ViewType::Type view_type) + content::ViewType view_type) : extension_id_(extension_id), browser_window_id_(browser_window_id), view_type_(view_type), @@ -131,20 +131,19 @@ class ExtensionViewAccumulator : public content::RenderViewVisitor { views_->Set(v8::Integer::New(index_), view_window); index_++; - if (view_type_ == chrome::ViewType::EXTENSION_BACKGROUND_PAGE) + if (view_type_ == chrome::VIEW_TYPE_EXTENSION_BACKGROUND_PAGE) return false; // There can be only one... return true; } // Returns true is |type| "isa" |match|. - static bool ViewTypeMatches(content::ViewType::Type type, - content::ViewType::Type match) { + static bool ViewTypeMatches(content::ViewType type, content::ViewType match) { if (type == match) return true; // INVALID means match all. - if (match == content::ViewType::INVALID) + if (match == content::VIEW_TYPE_INVALID) return true; return false; @@ -152,7 +151,7 @@ class ExtensionViewAccumulator : public content::RenderViewVisitor { std::string extension_id_; int browser_window_id_; - content::ViewType::Type view_type_; + content::ViewType view_type_; v8::Local<v8::Array> views_; int index_; }; @@ -229,22 +228,22 @@ class ExtensionImpl : public ChromeV8Extension { std::string view_type_string = *v8::String::Utf8Value(args[1]->ToString()); StringToUpperASCII(&view_type_string); - // |view_type| == content::ViewType::INVALID means getting any type of + // |view_type| == content::VIEW_TYPE_INVALID means getting any type of // views. - content::ViewType::Type view_type = content::ViewType::INVALID; - if (view_type_string == chrome::ViewType::kBackgroundPage) { - view_type = chrome::ViewType::EXTENSION_BACKGROUND_PAGE; - } else if (view_type_string == chrome::ViewType::kInfobar) { - view_type = chrome::ViewType::EXTENSION_INFOBAR; - } else if (view_type_string == chrome::ViewType::kNotification) { - view_type = chrome::ViewType::NOTIFICATION; - } else if (view_type_string == chrome::ViewType::kTabContents) { - view_type = content::ViewType::TAB_CONTENTS; - } else if (view_type_string == chrome::ViewType::kPopup) { - view_type = chrome::ViewType::EXTENSION_POPUP; - } else if (view_type_string == chrome::ViewType::kExtensionDialog) { - view_type = chrome::ViewType::EXTENSION_DIALOG; - } else if (view_type_string != chrome::ViewType::kAll) { + content::ViewType view_type = content::VIEW_TYPE_INVALID; + if (view_type_string == chrome::kViewTypeBackgroundPage) { + view_type = chrome::VIEW_TYPE_EXTENSION_BACKGROUND_PAGE; + } else if (view_type_string == chrome::kViewTypeInfobar) { + view_type = chrome::VIEW_TYPE_EXTENSION_INFOBAR; + } else if (view_type_string == chrome::kViewTypeNotification) { + view_type = chrome::VIEW_TYPE_NOTIFICATION; + } else if (view_type_string == chrome::kViewTypeTabContents) { + view_type = content::VIEW_TYPE_TAB_CONTENTS; + } else if (view_type_string == chrome::kViewTypePopup) { + view_type = chrome::VIEW_TYPE_EXTENSION_POPUP; + } else if (view_type_string == chrome::kViewTypeExtensionDialog) { + view_type = chrome::VIEW_TYPE_EXTENSION_DIALOG; + } else if (view_type_string != chrome::kViewTypeAll) { return v8::Undefined(); } diff --git a/content/browser/renderer_host/render_view_host_delegate.h b/content/browser/renderer_host/render_view_host_delegate.h index f917ad7..8b1126d 100644 --- a/content/browser/renderer_host/render_view_host_delegate.h +++ b/content/browser/renderer_host/render_view_host_delegate.h @@ -16,8 +16,8 @@ #include "base/string16.h" #include "base/values.h" #include "content/common/content_export.h" -#include "content/common/view_types.h" #include "content/common/window_container_type.h" +#include "content/public/common/view_types.h" #include "ipc/ipc_channel.h" #include "net/base/load_states.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebDragOperation.h" @@ -209,7 +209,7 @@ class CONTENT_EXPORT RenderViewHostDelegate : public IPC::Channel::Listener { virtual BackgroundContents* GetAsBackgroundContents(); // Return type of RenderView which is attached with this object. - virtual content::ViewType::Type GetRenderViewType() const = 0; + virtual content::ViewType GetRenderViewType() const = 0; // The RenderView is being constructed (message sent to the renderer process // to construct a RenderView). Now is a good time to send other setup events diff --git a/content/browser/tab_contents/interstitial_page.cc b/content/browser/tab_contents/interstitial_page.cc index 538ad8a..eb322c2 100644 --- a/content/browser/tab_contents/interstitial_page.cc +++ b/content/browser/tab_contents/interstitial_page.cc @@ -27,8 +27,8 @@ #include "content/common/notification_source.h" #include "content/common/page_transition_types.h" #include "content/common/view_messages.h" -#include "content/common/view_types.h" #include "content/public/common/bindings_policy.h" +#include "content/public/common/view_types.h" #include "net/base/escape.h" #include "net/url_request/url_request_context_getter.h" @@ -530,8 +530,8 @@ void InterstitialPage::FocusThroughTabTraversal(bool reverse) { render_view_host_->SetInitialFocus(reverse); } -content::ViewType::Type InterstitialPage::GetRenderViewType() const { - return content::ViewType::INTERSTITIAL_PAGE; +content::ViewType InterstitialPage::GetRenderViewType() const { + return content::VIEW_TYPE_INTERSTITIAL_PAGE; } void InterstitialPage::Disable() { diff --git a/content/browser/tab_contents/interstitial_page.h b/content/browser/tab_contents/interstitial_page.h index 2da3667..b0d33c8 100644 --- a/content/browser/tab_contents/interstitial_page.h +++ b/content/browser/tab_contents/interstitial_page.h @@ -102,7 +102,7 @@ class CONTENT_EXPORT InterstitialPage : public NotificationObserver, // Called when tab traversing. void FocusThroughTabTraversal(bool reverse); - virtual content::ViewType::Type GetRenderViewType() const; + virtual content::ViewType GetRenderViewType() const; // See description above field. void set_reload_on_dont_proceed(bool value) { diff --git a/content/browser/tab_contents/tab_contents.cc b/content/browser/tab_contents/tab_contents.cc index b2572a6..1f66529 100644 --- a/content/browser/tab_contents/tab_contents.cc +++ b/content/browser/tab_contents/tab_contents.cc @@ -47,8 +47,8 @@ #include "content/common/notification_service.h" #include "content/common/url_constants.h" #include "content/common/view_messages.h" -#include "content/common/view_types.h" #include "content/public/common/bindings_policy.h" +#include "content/public/common/view_types.h" #include "net/base/net_util.h" #include "net/url_request/url_request_context_getter.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" @@ -1384,8 +1384,8 @@ TabContents* TabContents::GetAsTabContents() { return this; } -content::ViewType::Type TabContents::GetRenderViewType() const { - return content::ViewType::TAB_CONTENTS; +content::ViewType TabContents::GetRenderViewType() const { + return content::VIEW_TYPE_TAB_CONTENTS; } void TabContents::RenderViewCreated(RenderViewHost* render_view_host) { diff --git a/content/browser/tab_contents/tab_contents.h b/content/browser/tab_contents/tab_contents.h index 8d4848b..4108b92 100644 --- a/content/browser/tab_contents/tab_contents.h +++ b/content/browser/tab_contents/tab_contents.h @@ -618,7 +618,7 @@ class CONTENT_EXPORT TabContents : public PageNavigator, virtual RenderViewHostDelegate::RendererManagement* GetRendererManagementDelegate() OVERRIDE; virtual TabContents* GetAsTabContents() OVERRIDE; - virtual content::ViewType::Type GetRenderViewType() const OVERRIDE; + virtual content::ViewType GetRenderViewType() const OVERRIDE; virtual void RenderViewCreated(RenderViewHost* render_view_host) OVERRIDE; virtual void RenderViewReady(RenderViewHost* render_view_host) OVERRIDE; virtual void RenderViewGone(RenderViewHost* render_view_host, diff --git a/content/common/view_types.h b/content/common/view_types.h deleted file mode 100644 index 4a28c68..0000000 --- a/content/common/view_types.h +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CONTENT_COMMON_VIEW_TYPES_H_ -#define CONTENT_COMMON_VIEW_TYPES_H_ -#pragma once - -#include "base/basictypes.h" -#include "content/common/content_export.h" - -namespace content { - -// Indicates different types of views -class CONTENT_EXPORT ViewType { - public: - enum { - INVALID, - TAB_CONTENTS, - INTERSTITIAL_PAGE, - DEV_TOOLS_UI, - - VIEW_TYPE_CONTENT_END - }; - - // Use this type to clarify that a ViewType type should be used. - typedef int Type; - - private: - // This class is for scoping only, so you shouldn't create an instance of it. - ViewType() {} - - DISALLOW_COPY_AND_ASSIGN(ViewType); -}; - -} // namespace content - -#endif // CONTENT_COMMON_VIEW_TYPES_H_ diff --git a/content/content_common.gypi b/content/content_common.gypi index d245faf..33a8745e1 100644 --- a/content/content_common.gypi +++ b/content/content_common.gypi @@ -30,6 +30,7 @@ 'sources': [ 'public/common/bindings_policy.h', 'public/common/resource_dispatcher_delegate.h', + 'public/common/view_types.h', 'common/appcache/appcache_backend_proxy.cc', 'common/appcache/appcache_backend_proxy.h', 'common/appcache/appcache_dispatcher.cc', @@ -249,7 +250,6 @@ 'common/utility_messages.h', 'common/view_messages.h', 'common/view_message_enums.h', - 'common/view_types.h', 'common/web_database_observer_impl.cc', 'common/web_database_observer_impl.h', 'common/webblobregistry_impl.cc', diff --git a/content/public/common/view_types.h b/content/public/common/view_types.h new file mode 100644 index 0000000..499be02 --- /dev/null +++ b/content/public/common/view_types.h @@ -0,0 +1,25 @@ +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CONTENT_PUBLIC_COMMON_VIEW_TYPES_H_ +#define CONTENT_PUBLIC_COMMON_VIEW_TYPES_H_ +#pragma once + +namespace content { + +// Indicates different types of views. +enum ViewTypeValues { + VIEW_TYPE_INVALID, + VIEW_TYPE_TAB_CONTENTS, + VIEW_TYPE_INTERSTITIAL_PAGE, + VIEW_TYPE_DEV_TOOLS_UI, + + VIEW_TYPE_CONTENT_END +}; + +typedef int ViewType; + +} // namespace content + +#endif // CONTENT_PUBLIC_COMMON_VIEW_TYPES_H_ |