summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjochen@chromium.org <jochen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-06 06:35:37 +0000
committerjochen@chromium.org <jochen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-06 06:35:37 +0000
commitee162d84652bb1dc914b12621722a9a3b706978f (patch)
tree273af9476a53d00545df00cd72c4efd85e27af4d
parent63b328fe08abc80c7202bda70c654b143895c322 (diff)
downloadchromium_src-ee162d84652bb1dc914b12621722a9a3b706978f.zip
chromium_src-ee162d84652bb1dc914b12621722a9a3b706978f.tar.gz
chromium_src-ee162d84652bb1dc914b12621722a9a3b706978f.tar.bz2
Split ViewType between chrome and content
BUG=89642 TEST=still works Review URL: http://codereview.chromium.org/8135026 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@104253 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/automation/testing_automation_provider.cc10
-rw-r--r--chrome/browser/extensions/extension_bookmark_manager_api.cc5
-rw-r--r--chrome/browser/extensions/extension_host.cc55
-rw-r--r--chrome/browser/extensions/extension_host.h10
-rw-r--r--chrome/browser/extensions/extension_host_mac.h4
-rw-r--r--chrome/browser/extensions/extension_host_mac.mm3
-rw-r--r--chrome/browser/extensions/extension_process_manager.cc41
-rw-r--r--chrome/browser/extensions/extension_process_manager.h4
-rw-r--r--chrome/browser/memory_details.cc11
-rw-r--r--chrome/browser/notifications/balloon_host.cc5
-rw-r--r--chrome/browser/notifications/balloon_host.h2
-rw-r--r--chrome/browser/tab_contents/background_contents.cc5
-rw-r--r--chrome/browser/tab_contents/background_contents.h2
-rw-r--r--chrome/browser/task_manager/task_manager.cc5
-rw-r--r--chrome/browser/task_manager/task_manager_resource_providers.cc3
-rw-r--r--chrome/browser/ui/webui/options/extension_settings_handler.cc6
-rw-r--r--chrome/chrome_common.gypi2
-rw-r--r--chrome/common/chrome_view_types.cc (renamed from content/common/view_types.cc)4
-rw-r--r--chrome/common/chrome_view_types.h47
-rw-r--r--chrome/common/extensions/extension_messages.h4
-rw-r--r--chrome/renderer/extensions/extension_helper.cc5
-rw-r--r--chrome/renderer/extensions/extension_helper.h8
-rw-r--r--chrome/renderer/extensions/extension_process_bindings.cc43
-rw-r--r--content/browser/renderer_host/render_view_host_delegate.h2
-rw-r--r--content/browser/tab_contents/interstitial_page.cc5
-rw-r--r--content/browser/tab_contents/interstitial_page.h2
-rw-r--r--content/browser/tab_contents/tab_contents.cc5
-rw-r--r--content/browser/tab_contents/tab_contents.h2
-rw-r--r--content/common/view_types.h27
-rw-r--r--content/content_common.gypi1
30 files changed, 198 insertions, 130 deletions
diff --git a/chrome/browser/automation/testing_automation_provider.cc b/chrome/browser/automation/testing_automation_provider.cc
index 1218488..e908da8 100644
--- a/chrome/browser/automation/testing_automation_provider.cc
+++ b/chrome/browser/automation/testing_automation_provider.cc
@@ -106,13 +106,13 @@
#include "chrome/common/pref_names.h"
#include "chrome/common/render_messages.h"
#include "chrome/common/url_constants.h"
+#include "chrome/common/chrome_view_types.h"
#include "content/browser/plugin_service.h"
#include "content/browser/renderer_host/render_process_host.h"
#include "content/browser/renderer_host/render_view_host.h"
#include "content/browser/tab_contents/interstitial_page.h"
#include "content/common/common_param_traits.h"
#include "content/common/notification_service.h"
-#include "content/common/view_types.h"
#include "net/base/cookie_store.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h"
#include "ui/base/events.h"
@@ -2911,16 +2911,16 @@ void TestingAutomationProvider::GetBrowserInfo(
item->Set("view", view);
std::string type;
switch (ex_host->extension_host_type()) {
- case ViewType::EXTENSION_BACKGROUND_PAGE:
+ case chrome::ViewType::EXTENSION_BACKGROUND_PAGE:
type = "EXTENSION_BACKGROUND_PAGE";
break;
- case ViewType::EXTENSION_POPUP:
+ case chrome::ViewType::EXTENSION_POPUP:
type = "EXTENSION_POPUP";
break;
- case ViewType::EXTENSION_INFOBAR:
+ case chrome::ViewType::EXTENSION_INFOBAR:
type = "EXTENSION_INFOBAR";
break;
- case ViewType::EXTENSION_DIALOG:
+ case chrome::ViewType::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 fb28876..af347e9 100644
--- a/chrome/browser/extensions/extension_bookmark_manager_api.cc
+++ b/chrome/browser/extensions/extension_bookmark_manager_api.cc
@@ -22,6 +22,7 @@
#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
#include "chrome/browser/ui/webui/chrome_url_data_manager.h"
#include "chrome/common/pref_names.h"
+#include "chrome/common/chrome_view_types.h"
#include "content/browser/renderer_host/render_view_host.h"
#include "content/browser/tab_contents/tab_contents.h"
#include "grit/generated_resources.h"
@@ -370,7 +371,7 @@ bool StartDragBookmarkManagerFunction::RunImpl() {
GetNodesFromArguments(model, args_.get(), 0, &nodes));
if (render_view_host_->delegate()->GetRenderViewType() ==
- ViewType::TAB_CONTENTS) {
+ content::ViewType::TAB_CONTENTS) {
TabContents* tab_contents =
dispatcher()->delegate()->GetAssociatedTabContents();
CHECK(tab_contents);
@@ -412,7 +413,7 @@ bool DropBookmarkManagerFunction::RunImpl() {
drop_index = drop_parent->child_count();
if (render_view_host_->delegate()->GetRenderViewType() ==
- ViewType::TAB_CONTENTS) {
+ content::ViewType::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 a13f668..0c885d7 100644
--- a/chrome/browser/extensions/extension_host.cc
+++ b/chrome/browser/extensions/extension_host.cc
@@ -33,6 +33,7 @@
#include "chrome/common/extensions/extension_messages.h"
#include "chrome/common/render_messages.h"
#include "chrome/common/url_constants.h"
+#include "chrome/common/chrome_view_types.h"
#include "content/browser/browsing_instance.h"
#include "content/browser/content_browser_client.h"
#include "content/browser/renderer_host/browser_render_process_host.h"
@@ -129,7 +130,7 @@ class ExtensionHost::ProcessCreationQueue {
ExtensionHost::ExtensionHost(const Extension* extension,
SiteInstance* site_instance,
const GURL& url,
- ViewType::Type host_type)
+ content::ViewType::Type host_type)
: extension_(extension),
extension_id_(extension->id()),
profile_(Profile::FromBrowserContext(
@@ -214,9 +215,9 @@ void ExtensionHost::CreateRenderViewSoon(RenderWidgetHostView* host_view) {
void ExtensionHost::CreateRenderViewNow() {
render_view_host_->CreateRenderView(string16());
- if (extension_host_type_ == ViewType::EXTENSION_POPUP ||
- extension_host_type_ == ViewType::EXTENSION_DIALOG ||
- extension_host_type_ == ViewType::EXTENSION_INFOBAR) {
+ if (extension_host_type_ == chrome::ViewType::EXTENSION_POPUP ||
+ extension_host_type_ == chrome::ViewType::EXTENSION_DIALOG ||
+ extension_host_type_ == chrome::ViewType::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.
@@ -357,9 +358,9 @@ void ExtensionHost::DisableScrollbarsForSmallWindows(
void ExtensionHost::DidStopLoading() {
bool notify = !did_stop_loading_;
did_stop_loading_ = true;
- if (extension_host_type_ == ViewType::EXTENSION_POPUP ||
- extension_host_type_ == ViewType::EXTENSION_DIALOG ||
- extension_host_type_ == ViewType::EXTENSION_INFOBAR) {
+ if (extension_host_type_ == chrome::ViewType::EXTENSION_POPUP ||
+ extension_host_type_ == chrome::ViewType::EXTENSION_DIALOG ||
+ extension_host_type_ == chrome::ViewType::EXTENSION_INFOBAR) {
#if defined(TOOLKIT_VIEWS)
if (view_.get())
view_->DidStopLoading();
@@ -370,16 +371,16 @@ void ExtensionHost::DidStopLoading() {
chrome::NOTIFICATION_EXTENSION_HOST_DID_STOP_LOADING,
Source<Profile>(profile_),
Details<ExtensionHost>(this));
- if (extension_host_type_ == ViewType::EXTENSION_BACKGROUND_PAGE) {
+ if (extension_host_type_ == chrome::ViewType::EXTENSION_BACKGROUND_PAGE) {
UMA_HISTOGRAM_TIMES("Extensions.BackgroundPageLoadTime",
since_created_.Elapsed());
- } else if (extension_host_type_ == ViewType::EXTENSION_DIALOG) {
+ } else if (extension_host_type_ == chrome::ViewType::EXTENSION_DIALOG) {
UMA_HISTOGRAM_TIMES("Extensions.DialogLoadTime",
since_created_.Elapsed());
- } else if (extension_host_type_ == ViewType::EXTENSION_POPUP) {
+ } else if (extension_host_type_ == chrome::ViewType::EXTENSION_POPUP) {
UMA_HISTOGRAM_TIMES("Extensions.PopupLoadTime",
since_created_.Elapsed());
- } else if (extension_host_type_ == ViewType::EXTENSION_INFOBAR) {
+ } else if (extension_host_type_ == chrome::ViewType::EXTENSION_INFOBAR) {
UMA_HISTOGRAM_TIMES("Extensions.InfobarLoadTime",
since_created_.Elapsed());
}
@@ -397,7 +398,7 @@ void ExtensionHost::DocumentAvailableInMainFrame(RenderViewHost* rvh) {
profile_->GetExtensionService()->SetBackgroundPageReady(extension_);
} else {
switch (extension_host_type_) {
- case ViewType::EXTENSION_INFOBAR:
+ case chrome::ViewType::EXTENSION_INFOBAR:
InsertInfobarCSS();
break;
default:
@@ -408,7 +409,7 @@ void ExtensionHost::DocumentAvailableInMainFrame(RenderViewHost* rvh) {
void ExtensionHost::DocumentOnLoadCompletedInMainFrame(RenderViewHost* rvh,
int32 page_id) {
- if (ViewType::EXTENSION_POPUP == GetRenderViewType()) {
+ if (chrome::ViewType::EXTENSION_POPUP == GetRenderViewType()) {
NotificationService::current()->Notify(
chrome::NOTIFICATION_EXTENSION_POPUP_VIEW_READY,
Source<Profile>(profile_),
@@ -477,10 +478,10 @@ void ExtensionHost::OnDialogClosed(IPC::Message* reply_msg,
}
void ExtensionHost::Close(RenderViewHost* render_view_host) {
- if (extension_host_type_ == ViewType::EXTENSION_POPUP ||
- extension_host_type_ == ViewType::EXTENSION_DIALOG ||
- extension_host_type_ == ViewType::EXTENSION_BACKGROUND_PAGE ||
- extension_host_type_ == ViewType::EXTENSION_INFOBAR) {
+ 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) {
NotificationService::current()->Notify(
chrome::NOTIFICATION_EXTENSION_HOST_VIEW_SHOULD_CLOSE,
Source<Profile>(profile_),
@@ -514,15 +515,15 @@ WebPreferences ExtensionHost::GetWebkitPrefs() {
webkit_prefs.loads_images_automatically = true;
webkit_prefs.javascript_enabled = true;
- if (extension_host_type_ == ViewType::EXTENSION_POPUP ||
- extension_host_type_ == ViewType::EXTENSION_DIALOG ||
- extension_host_type_ == ViewType::EXTENSION_BACKGROUND_PAGE ||
- extension_host_type_ == ViewType::EXTENSION_INFOBAR)
+ 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)
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_ == ViewType::EXTENSION_BACKGROUND_PAGE) {
+ if (extension_host_type_ == chrome::ViewType::EXTENSION_BACKGROUND_PAGE) {
webkit_prefs.experimental_webgl_enabled = false;
webkit_prefs.accelerated_compositing_enabled = false;
webkit_prefs.accelerated_2d_canvas_enabled = false;
@@ -537,7 +538,7 @@ RenderViewHostDelegate::View* ExtensionHost::GetViewDelegate() {
bool ExtensionHost::PreHandleKeyboardEvent(const NativeWebKeyboardEvent& event,
bool* is_keyboard_shortcut) {
- if (extension_host_type_ == ViewType::EXTENSION_POPUP &&
+ if (extension_host_type_ == chrome::ViewType::EXTENSION_POPUP &&
event.type == NativeWebKeyboardEvent::RawKeyDown &&
event.windowsKeyCode == ui::VKEY_ESCAPE) {
DCHECK(is_keyboard_shortcut != NULL);
@@ -547,7 +548,7 @@ bool ExtensionHost::PreHandleKeyboardEvent(const NativeWebKeyboardEvent& event,
}
void ExtensionHost::HandleKeyboardEvent(const NativeWebKeyboardEvent& event) {
- if (extension_host_type_ == ViewType::EXTENSION_POPUP) {
+ if (extension_host_type_ == chrome::ViewType::EXTENSION_POPUP) {
if (event.type == NativeWebKeyboardEvent::RawKeyDown &&
event.windowsKeyCode == ui::VKEY_ESCAPE) {
NotificationService::current()->Notify(
@@ -769,7 +770,7 @@ void ExtensionHost::GotFocus() {
void ExtensionHost::TakeFocus(bool reverse) {
}
-ViewType::Type ExtensionHost::GetRenderViewType() const {
+content::ViewType::Type ExtensionHost::GetRenderViewType() const {
return extension_host_type_;
}
@@ -794,8 +795,8 @@ void ExtensionHost::RenderViewCreated(RenderViewHost* render_view_host) {
if (view_.get())
view_->RenderViewCreated();
- if (extension_host_type_ == ViewType::EXTENSION_POPUP ||
- extension_host_type_ == ViewType::EXTENSION_INFOBAR) {
+ if (extension_host_type_ == chrome::ViewType::EXTENSION_POPUP ||
+ extension_host_type_ == chrome::ViewType::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 a0e100b..40b5c00 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, ViewType::Type host_type);
+ const GURL& url, content::ViewType::Type host_type);
virtual ~ExtensionHost();
#if defined(TOOLKIT_VIEWS)
@@ -84,7 +84,9 @@ class ExtensionHost : public RenderViewHostDelegate,
Profile* profile() const { return profile_; }
- ViewType::Type extension_host_type() const { return extension_host_type_; }
+ content::ViewType::Type extension_host_type() const {
+ return extension_host_type_;
+ }
// ExtensionFunctionDispatcher::Delegate
virtual TabContents* GetAssociatedTabContents() const OVERRIDE;
@@ -114,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 ViewType::Type GetRenderViewType() const OVERRIDE;
+ virtual content::ViewType::Type GetRenderViewType() const OVERRIDE;
virtual void RenderViewGone(RenderViewHost* render_view_host,
base::TerminationStatus status,
int error_code) OVERRIDE;
@@ -275,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.
- ViewType::Type extension_host_type_;
+ content::ViewType::Type 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 da46f16..b7dfe88 100644
--- a/chrome/browser/extensions/extension_host_mac.h
+++ b/chrome/browser/extensions/extension_host_mac.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -13,7 +13,7 @@ class RenderWidgetHostView;
class ExtensionHostMac : public ExtensionHost {
public:
ExtensionHostMac(const Extension* extension, SiteInstance* site_instance,
- const GURL& url, ViewType::Type host_type) :
+ const GURL& url, content::ViewType::Type 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 9c9234b..8b3ee43 100644
--- a/chrome/browser/extensions/extension_host_mac.mm
+++ b/chrome/browser/extensions/extension_host_mac.mm
@@ -7,6 +7,7 @@
#import "chrome/browser/ui/cocoa/chrome_event_processing_window.h"
#import "chrome/browser/ui/cocoa/extensions/extension_popup_controller.h"
#import "chrome/browser/ui/cocoa/info_bubble_window.h"
+#include "chrome/common/chrome_view_types.h"
#include "content/browser/renderer_host/render_widget_host_view_mac.h"
#include "content/common/native_web_keyboard_event.h"
@@ -51,7 +52,7 @@ void ExtensionHostMac::ShowCreatedWidgetInternal(
void ExtensionHostMac::UnhandledKeyboardEvent(
const NativeWebKeyboardEvent& event) {
if (event.skip_in_browser || event.type == NativeWebKeyboardEvent::Char ||
- extension_host_type() != ViewType::EXTENSION_POPUP) {
+ extension_host_type() != chrome::ViewType::EXTENSION_POPUP) {
return;
}
diff --git a/chrome/browser/extensions/extension_process_manager.cc b/chrome/browser/extensions/extension_process_manager.cc
index 600eeeb..8c90eec 100644
--- a/chrome/browser/extensions/extension_process_manager.cc
+++ b/chrome/browser/extensions/extension_process_manager.cc
@@ -20,6 +20,7 @@
#include "chrome/common/chrome_switches.h"
#include "chrome/common/extensions/extension.h"
#include "chrome/common/url_constants.h"
+#include "chrome/common/chrome_view_types.h"
#include "content/browser/browser_thread.h"
#include "content/browser/site_instance.h"
#include "content/browser/tab_contents/tab_contents.h"
@@ -34,10 +35,11 @@ class IncognitoExtensionProcessManager : public ExtensionProcessManager {
public:
explicit IncognitoExtensionProcessManager(Profile* profile);
virtual ~IncognitoExtensionProcessManager() {}
- virtual ExtensionHost* CreateViewHost(const Extension* extension,
- const GURL& url,
- Browser* browser,
- ViewType::Type view_type) OVERRIDE;
+ virtual ExtensionHost* CreateViewHost(
+ const Extension* extension,
+ const GURL& url,
+ Browser* browser,
+ content::ViewType::Type view_type) OVERRIDE;
virtual void CreateBackgroundHost(const Extension* extension,
const GURL& url);
virtual SiteInstance* GetSiteInstanceForURL(const GURL& url);
@@ -120,10 +122,11 @@ ExtensionHost* ExtensionProcessManager::CreateViewHost(
const Extension* extension,
const GURL& url,
Browser* browser,
- ViewType::Type view_type) {
+ content::ViewType::Type view_type) {
DCHECK(extension);
// A NULL browser may only be given for pop-up views.
- DCHECK(browser || (!browser && view_type == ViewType::EXTENSION_POPUP));
+ DCHECK(browser ||
+ (!browser && view_type == chrome::ViewType::EXTENSION_POPUP));
ExtensionHost* host =
#if defined(OS_MACOSX)
new ExtensionHostMac(extension, GetSiteInstanceForURL(url), url,
@@ -137,9 +140,10 @@ ExtensionHost* ExtensionProcessManager::CreateViewHost(
}
ExtensionHost* ExtensionProcessManager::CreateViewHost(
- const GURL& url, Browser* browser, ViewType::Type view_type) {
+ const GURL& url, Browser* browser, content::ViewType::Type view_type) {
// A NULL browser may only be given for pop-up views.
- DCHECK(browser || (!browser && view_type == ViewType::EXTENSION_POPUP));
+ DCHECK(browser ||
+ (!browser && view_type == chrome::ViewType::EXTENSION_POPUP));
Profile* profile =
Profile::FromBrowserContext(browsing_instance_->browser_context());
ExtensionService* service = profile->GetExtensionService();
@@ -153,27 +157,29 @@ ExtensionHost* ExtensionProcessManager::CreateViewHost(
ExtensionHost* ExtensionProcessManager::CreatePopupHost(
const Extension* extension, const GURL& url, Browser* browser) {
- return CreateViewHost(extension, url, browser, ViewType::EXTENSION_POPUP);
+ return CreateViewHost(
+ extension, url, browser, chrome::ViewType::EXTENSION_POPUP);
}
ExtensionHost* ExtensionProcessManager::CreatePopupHost(
const GURL& url, Browser* browser) {
- return CreateViewHost(url, browser, ViewType::EXTENSION_POPUP);
+ return CreateViewHost(url, browser, chrome::ViewType::EXTENSION_POPUP);
}
ExtensionHost* ExtensionProcessManager::CreateDialogHost(
const GURL& url, Browser* browser) {
- return CreateViewHost(url, browser, ViewType::EXTENSION_DIALOG);
+ return CreateViewHost(url, browser, chrome::ViewType::EXTENSION_DIALOG);
}
ExtensionHost* ExtensionProcessManager::CreateInfobarHost(
const Extension* extension, const GURL& url, Browser* browser) {
- return CreateViewHost(extension, url, browser, ViewType::EXTENSION_INFOBAR);
+ return CreateViewHost(
+ extension, url, browser, chrome::ViewType::EXTENSION_INFOBAR);
}
ExtensionHost* ExtensionProcessManager::CreateInfobarHost(
const GURL& url, Browser* browser) {
- return CreateViewHost(url, browser, ViewType::EXTENSION_INFOBAR);
+ return CreateViewHost(url, browser, chrome::ViewType::EXTENSION_INFOBAR);
}
void ExtensionProcessManager::CreateBackgroundHost(
@@ -190,10 +196,10 @@ void ExtensionProcessManager::CreateBackgroundHost(
ExtensionHost* host =
#if defined(OS_MACOSX)
new ExtensionHostMac(extension, GetSiteInstanceForURL(url), url,
- ViewType::EXTENSION_BACKGROUND_PAGE);
+ chrome::ViewType::EXTENSION_BACKGROUND_PAGE);
#else
new ExtensionHost(extension, GetSiteInstanceForURL(url), url,
- ViewType::EXTENSION_BACKGROUND_PAGE);
+ chrome::ViewType::EXTENSION_BACKGROUND_PAGE);
#endif
host->CreateRenderViewSoon(NULL); // create a RenderViewHost with no view
@@ -409,7 +415,8 @@ void ExtensionProcessManager::Observe(int type,
case chrome::NOTIFICATION_EXTENSION_HOST_VIEW_SHOULD_CLOSE: {
ExtensionHost* host = Details<ExtensionHost>(details).ptr();
- if (host->extension_host_type() == ViewType::EXTENSION_BACKGROUND_PAGE) {
+ if (host->extension_host_type() ==
+ chrome::ViewType::EXTENSION_BACKGROUND_PAGE) {
delete host;
// |host| should deregister itself from our structures.
CHECK(background_hosts_.find(host) == background_hosts_.end());
@@ -470,7 +477,7 @@ ExtensionHost* IncognitoExtensionProcessManager::CreateViewHost(
const Extension* extension,
const GURL& url,
Browser* browser,
- ViewType::Type view_type) {
+ content::ViewType::Type 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 73b1cdf..e146ce5 100644
--- a/chrome/browser/extensions/extension_process_manager.h
+++ b/chrome/browser/extensions/extension_process_manager.h
@@ -39,10 +39,10 @@ class ExtensionProcessManager : public NotificationObserver {
virtual ExtensionHost* CreateViewHost(const Extension* extension,
const GURL& url,
Browser* browser,
- ViewType::Type view_type);
+ content::ViewType::Type view_type);
ExtensionHost* CreateViewHost(const GURL& url,
Browser* browser,
- ViewType::Type view_type);
+ content::ViewType::Type 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 e228faa..8d7faf1 100644
--- a/chrome/browser/memory_details.cc
+++ b/chrome/browser/memory_details.cc
@@ -14,6 +14,7 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/common/extensions/extension.h"
#include "chrome/common/url_constants.h"
+#include "chrome/common/chrome_view_types.h"
#include "content/browser/browser_child_process_host.h"
#include "content/browser/browser_thread.h"
#include "content/browser/renderer_host/backing_store_manager.h"
@@ -163,11 +164,11 @@ void MemoryDetails::CollectChildInfoOnUIThread() {
RenderViewHostDelegate* host_delegate = host->delegate();
DCHECK(host_delegate);
GURL url = host_delegate->GetURL();
- ViewType::Type type = host_delegate->GetRenderViewType();
+ content::ViewType::Type type = host_delegate->GetRenderViewType();
if (host->enabled_bindings() & BindingsPolicy::WEB_UI) {
// TODO(erikkay) the type for devtools doesn't actually appear to
// be set.
- if (type == ViewType::DEV_TOOLS_UI)
+ if (type == content::ViewType::DEV_TOOLS_UI)
process.renderer_type = ChildProcessInfo::RENDERER_DEVTOOLS;
else
process.renderer_type = ChildProcessInfo::RENDERER_CHROME;
@@ -189,14 +190,14 @@ void MemoryDetails::CollectChildInfoOnUIThread() {
ChildProcessInfo::RENDERER_UNKNOWN) {
process.titles.push_back(UTF8ToUTF16(url.spec()));
switch (type) {
- case ViewType::BACKGROUND_CONTENTS:
+ case chrome::ViewType::BACKGROUND_CONTENTS:
process.renderer_type =
ChildProcessInfo::RENDERER_BACKGROUND_APP;
break;
- case ViewType::INTERSTITIAL_PAGE:
+ case content::ViewType::INTERSTITIAL_PAGE:
process.renderer_type = ChildProcessInfo::RENDERER_INTERSTITIAL;
break;
- case ViewType::NOTIFICATION:
+ case chrome::ViewType::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 fd30e64..3f39566 100644
--- a/chrome/browser/notifications/balloon_host.cc
+++ b/chrome/browser/notifications/balloon_host.cc
@@ -13,6 +13,7 @@
#include "chrome/common/extensions/extension_messages.h"
#include "chrome/common/render_messages.h"
#include "chrome/common/url_constants.h"
+#include "chrome/common/chrome_view_types.h"
#include "content/browser/renderer_host/browser_render_process_host.h"
#include "content/browser/renderer_host/render_view_host.h"
#include "content/browser/site_instance.h"
@@ -101,8 +102,8 @@ void BalloonHost::RenderViewGone(RenderViewHost* render_view_host,
Close(render_view_host);
}
-ViewType::Type BalloonHost::GetRenderViewType() const {
- return ViewType::NOTIFICATION;
+content::ViewType::Type BalloonHost::GetRenderViewType() const {
+ return chrome::ViewType::NOTIFICATION;
}
RenderViewHostDelegate::View* BalloonHost::GetViewDelegate() {
diff --git a/chrome/browser/notifications/balloon_host.h b/chrome/browser/notifications/balloon_host.h
index 921fbb0..62aff03 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 ViewType::Type GetRenderViewType() const OVERRIDE;
+ virtual content::ViewType::Type 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 6411833..ff05f28 100644
--- a/chrome/browser/tab_contents/background_contents.cc
+++ b/chrome/browser/tab_contents/background_contents.cc
@@ -12,6 +12,7 @@
#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/extensions/extension_constants.h"
#include "chrome/common/url_constants.h"
+#include "chrome/common/chrome_view_types.h"
#include "content/browser/browsing_instance.h"
#include "content/browser/renderer_host/render_view_host.h"
#include "content/browser/site_instance.h"
@@ -73,8 +74,8 @@ const GURL& BackgroundContents::GetURL() const {
return url_;
}
-ViewType::Type BackgroundContents::GetRenderViewType() const {
- return ViewType::BACKGROUND_CONTENTS;
+content::ViewType::Type BackgroundContents::GetRenderViewType() const {
+ return chrome::ViewType::BACKGROUND_CONTENTS;
}
void BackgroundContents::DidNavigate(
diff --git a/chrome/browser/tab_contents/background_contents.h b/chrome/browser/tab_contents/background_contents.h
index afad19f..e0632f3 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 ViewType::Type GetRenderViewType() const OVERRIDE;
+ virtual content::ViewType::Type 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 993eaf4..16e5bd30 100644
--- a/chrome/browser/task_manager/task_manager.cc
+++ b/chrome/browser/task_manager/task_manager.cc
@@ -25,6 +25,7 @@
#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/url_constants.h"
+#include "chrome/common/chrome_view_types.h"
#include "content/browser/browser_thread.h"
#include "content/browser/renderer_host/render_process_host.h"
#include "content/browser/renderer_host/resource_dispatcher_host.h"
@@ -1088,8 +1089,10 @@ int CountExtensionBackgroundPagesForProfile(Profile* profile) {
for (ExtensionProcessManager::const_iterator iter = manager->begin();
iter != manager->end();
++iter) {
- if ((*iter)->GetRenderViewType() == ViewType::EXTENSION_BACKGROUND_PAGE)
+ if ((*iter)->GetRenderViewType() ==
+ chrome::ViewType::EXTENSION_BACKGROUND_PAGE) {
count++;
+ }
}
return count;
}
diff --git a/chrome/browser/task_manager/task_manager_resource_providers.cc b/chrome/browser/task_manager/task_manager_resource_providers.cc
index 29431a5..dff29f1 100644
--- a/chrome/browser/task_manager/task_manager_resource_providers.cc
+++ b/chrome/browser/task_manager/task_manager_resource_providers.cc
@@ -36,6 +36,7 @@
#include "chrome/common/chrome_switches.h"
#include "chrome/common/extensions/extension.h"
#include "chrome/common/render_messages.h"
+#include "chrome/common/chrome_view_types.h"
#include "content/browser/browser_child_process_host.h"
#include "content/browser/browser_thread.h"
#include "content/browser/renderer_host/render_message_filter.h"
@@ -1083,7 +1084,7 @@ const Extension* TaskManagerExtensionProcessResource::GetExtension() const {
bool TaskManagerExtensionProcessResource::IsBackground() const {
return extension_host_->GetRenderViewType() ==
- ViewType::EXTENSION_BACKGROUND_PAGE;
+ chrome::ViewType::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 30c71bd..9943a75 100644
--- a/chrome/browser/ui/webui/options/extension_settings_handler.cc
+++ b/chrome/browser/ui/webui/options/extension_settings_handler.cc
@@ -25,6 +25,7 @@
#include "chrome/common/extensions/extension.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/url_constants.h"
+#include "chrome/common/chrome_view_types.h"
#include "content/browser/renderer_host/render_process_host.h"
#include "content/browser/renderer_host/render_view_host.h"
#include "content/browser/tab_contents/tab_contents.h"
@@ -733,9 +734,10 @@ void ExtensionSettingsHandler::GetActivePagesForExtensionProcess(
if (!widget || !widget->IsRenderView())
continue;
const RenderViewHost* host = static_cast<const RenderViewHost*>(widget);
+ int host_type = host->delegate()->GetRenderViewType();
if (host == deleting_rvh_ ||
- ViewType::EXTENSION_POPUP == host->delegate()->GetRenderViewType() ||
- ViewType::EXTENSION_DIALOG == host->delegate()->GetRenderViewType())
+ chrome::ViewType::EXTENSION_POPUP == host_type ||
+ chrome::ViewType::EXTENSION_DIALOG == host_type)
continue;
GURL url = host->delegate()->GetURL();
diff --git a/chrome/chrome_common.gypi b/chrome/chrome_common.gypi
index 095d258..1e0a23e 100644
--- a/chrome/chrome_common.gypi
+++ b/chrome/chrome_common.gypi
@@ -218,6 +218,8 @@
'common/time_format.h',
'common/url_constants.cc',
'common/url_constants.h',
+ 'common/chrome_view_types.cc',
+ 'common/chrome_view_types.h',
'common/visitedlink_common.cc',
'common/visitedlink_common.h',
'common/web_apps.cc',
diff --git a/content/common/view_types.cc b/chrome/common/chrome_view_types.cc
index ab02651..cc85c77 100644
--- a/content/common/view_types.cc
+++ b/chrome/common/chrome_view_types.cc
@@ -2,8 +2,9 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "content/common/view_types.h"
+#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";
@@ -11,3 +12,4 @@ 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";
+} // namespace chrome
diff --git a/chrome/common/chrome_view_types.h b/chrome/common/chrome_view_types.h
new file mode 100644
index 0000000..615ea08
--- /dev/null
+++ b/chrome/common/chrome_view_types.h
@@ -0,0 +1,47 @@
+// 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 CHROME_COMMON_CHROME_VIEW_TYPES_H_
+#define CHROME_COMMON_CHROME_VIEW_TYPES_H_
+#pragma once
+
+#include "base/basictypes.h"
+#include "content/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);
+};
+
+} // 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 ee69e1a..cb22831 100644
--- a/chrome/common/extensions/extension_messages.h
+++ b/chrome/common/extensions/extension_messages.h
@@ -17,8 +17,6 @@
#define IPC_MESSAGE_START ExtensionMsgStart
-IPC_ENUM_TRAITS(ViewType::Type)
-
// Parameters structure for ExtensionHostMsg_Request.
IPC_STRUCT_BEGIN(ExtensionHostMsg_Request_Params)
// Message name.
@@ -238,7 +236,7 @@ IPC_MESSAGE_CONTROL5(ExtensionMsg_UpdatePermissions,
// Tell the renderer which type this view is.
IPC_MESSAGE_ROUTED1(ExtensionMsg_NotifyRenderViewType,
- ViewType::Type /* view_type */)
+ content::ViewType::Type /* 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 3a6cf87..85f610b 100644
--- a/chrome/renderer/extensions/extension_helper.cc
+++ b/chrome/renderer/extensions/extension_helper.cc
@@ -12,6 +12,7 @@
#include "chrome/common/extensions/extension_messages.h"
#include "chrome/common/render_messages.h"
#include "chrome/common/url_constants.h"
+#include "chrome/common/chrome_view_types.h"
#include "chrome/renderer/extensions/chrome_v8_context.h"
#include "chrome/renderer/extensions/chrome_webstore_bindings.h"
#include "chrome/renderer/extensions/event_bindings.h"
@@ -52,7 +53,7 @@ ExtensionHelper::ExtensionHelper(RenderView* render_view,
content::RenderViewObserverTracker<ExtensionHelper>(render_view),
extension_dispatcher_(extension_dispatcher),
pending_app_icon_requests_(0),
- view_type_(ViewType::INVALID),
+ view_type_(content::ViewType::INVALID),
browser_window_id_(-1) {
}
@@ -257,7 +258,7 @@ void ExtensionHelper::OnGetApplicationInfo(int page_id) {
routing_id(), page_id, app_info));
}
-void ExtensionHelper::OnNotifyRendererViewType(ViewType::Type type) {
+void ExtensionHelper::OnNotifyRendererViewType(content::ViewType::Type type) {
view_type_ = type;
}
diff --git a/chrome/renderer/extensions/extension_helper.h b/chrome/renderer/extensions/extension_helper.h
index 40f6d6b..ef7f4ae 100644
--- a/chrome/renderer/extensions/extension_helper.h
+++ b/chrome/renderer/extensions/extension_helper.h
@@ -8,9 +8,9 @@
#include <map>
-#include "content/common/view_types.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/renderer/render_view.h"
class ExtensionDispatcher;
@@ -47,7 +47,7 @@ class ExtensionHelper
GURL requestor_url);
int browser_window_id() const { return browser_window_id_; }
- ViewType::Type view_type() const { return view_type_; }
+ content::ViewType::Type view_type() const { return view_type_; }
private:
// RenderViewObserver implementation.
@@ -71,7 +71,7 @@ class ExtensionHelper
const std::string& message);
void OnExecuteCode(const ExtensionMsg_ExecuteCode_Params& params);
void OnGetApplicationInfo(int page_id);
- void OnNotifyRendererViewType(ViewType::Type view_type);
+ void OnNotifyRendererViewType(content::ViewType::Type view_type);
void OnUpdateBrowserWindowId(int window_id);
void OnInlineWebstoreInstallResponse(
int install_id, bool success, const std::string& error);
@@ -107,7 +107,7 @@ class ExtensionHelper
int pending_app_icon_requests_;
// Type of view attached with RenderView.
- ViewType::Type view_type_;
+ content::ViewType::Type 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 ce45386..10b2890 100644
--- a/chrome/renderer/extensions/extension_process_bindings.cc
+++ b/chrome/renderer/extensions/extension_process_bindings.cc
@@ -25,6 +25,7 @@
#include "chrome/common/extensions/url_pattern.h"
#include "chrome/common/render_messages.h"
#include "chrome/common/url_constants.h"
+#include "chrome/common/chrome_view_types.h"
#include "content/public/renderer/render_view_visitor.h"
#include "chrome/renderer/chrome_render_process_observer.h"
#include "chrome/renderer/extensions/chrome_v8_context.h"
@@ -83,7 +84,7 @@ class ExtensionViewAccumulator : public content::RenderViewVisitor {
public:
ExtensionViewAccumulator(const std::string& extension_id,
int browser_window_id,
- ViewType::Type view_type)
+ content::ViewType::Type view_type)
: extension_id_(extension_id),
browser_window_id_(browser_window_id),
view_type_(view_type),
@@ -129,19 +130,20 @@ class ExtensionViewAccumulator : public content::RenderViewVisitor {
views_->Set(v8::Integer::New(index_), view_window);
index_++;
- if (view_type_ == ViewType::EXTENSION_BACKGROUND_PAGE)
+ if (view_type_ == chrome::ViewType::EXTENSION_BACKGROUND_PAGE)
return false; // There can be only one...
return true;
}
// Returns true is |type| "isa" |match|.
- static bool ViewTypeMatches(ViewType::Type type, ViewType::Type match) {
+ static bool ViewTypeMatches(content::ViewType::Type type,
+ content::ViewType::Type match) {
if (type == match)
return true;
// INVALID means match all.
- if (match == ViewType::INVALID)
+ if (match == content::ViewType::INVALID)
return true;
return false;
@@ -149,7 +151,7 @@ class ExtensionViewAccumulator : public content::RenderViewVisitor {
std::string extension_id_;
int browser_window_id_;
- ViewType::Type view_type_;
+ content::ViewType::Type view_type_;
v8::Local<v8::Array> views_;
int index_;
};
@@ -226,21 +228,22 @@ class ExtensionImpl : public ChromeV8Extension {
std::string view_type_string = *v8::String::Utf8Value(args[1]->ToString());
StringToUpperASCII(&view_type_string);
- // |view_type| == ViewType::INVALID means getting any type of views.
- ViewType::Type view_type = ViewType::INVALID;
- if (view_type_string == ViewType::kBackgroundPage) {
- view_type = ViewType::EXTENSION_BACKGROUND_PAGE;
- } else if (view_type_string == ViewType::kInfobar) {
- view_type = ViewType::EXTENSION_INFOBAR;
- } else if (view_type_string == ViewType::kNotification) {
- view_type = ViewType::NOTIFICATION;
- } else if (view_type_string == ViewType::kTabContents) {
- view_type = ViewType::TAB_CONTENTS;
- } else if (view_type_string == ViewType::kPopup) {
- view_type = ViewType::EXTENSION_POPUP;
- } else if (view_type_string == ViewType::kExtensionDialog) {
- view_type = ViewType::EXTENSION_DIALOG;
- } else if (view_type_string != ViewType::kAll) {
+ // |view_type| == content::ViewType::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) {
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 2fa528a..65bb4ac 100644
--- a/content/browser/renderer_host/render_view_host_delegate.h
+++ b/content/browser/renderer_host/render_view_host_delegate.h
@@ -208,7 +208,7 @@ class CONTENT_EXPORT RenderViewHostDelegate : public IPC::Channel::Listener {
virtual BackgroundContents* GetAsBackgroundContents();
// Return type of RenderView which is attached with this object.
- virtual ViewType::Type GetRenderViewType() const = 0;
+ virtual content::ViewType::Type 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 6f0f271..9e7db60 100644
--- a/content/browser/tab_contents/interstitial_page.cc
+++ b/content/browser/tab_contents/interstitial_page.cc
@@ -28,6 +28,7 @@
#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 "net/base/escape.h"
#include "net/url_request/url_request_context_getter.h"
@@ -529,8 +530,8 @@ void InterstitialPage::FocusThroughTabTraversal(bool reverse) {
render_view_host_->SetInitialFocus(reverse);
}
-ViewType::Type InterstitialPage::GetRenderViewType() const {
- return ViewType::INTERSTITIAL_PAGE;
+content::ViewType::Type InterstitialPage::GetRenderViewType() const {
+ return content::ViewType::INTERSTITIAL_PAGE;
}
void InterstitialPage::Disable() {
diff --git a/content/browser/tab_contents/interstitial_page.h b/content/browser/tab_contents/interstitial_page.h
index d3b4c70..2da3667 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 ViewType::Type GetRenderViewType() const;
+ virtual content::ViewType::Type 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 637b8ba..2d3cf8d 100644
--- a/content/browser/tab_contents/tab_contents.cc
+++ b/content/browser/tab_contents/tab_contents.cc
@@ -48,6 +48,7 @@
#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 "net/base/net_util.h"
#include "net/url_request/url_request_context_getter.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h"
@@ -1395,8 +1396,8 @@ TabContents* TabContents::GetAsTabContents() {
return this;
}
-ViewType::Type TabContents::GetRenderViewType() const {
- return ViewType::TAB_CONTENTS;
+content::ViewType::Type TabContents::GetRenderViewType() const {
+ return content::ViewType::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 4c9d70f..acdefbc 100644
--- a/content/browser/tab_contents/tab_contents.h
+++ b/content/browser/tab_contents/tab_contents.h
@@ -626,7 +626,7 @@ class CONTENT_EXPORT TabContents : public PageNavigator,
virtual RenderViewHostDelegate::RendererManagement*
GetRendererManagementDelegate() OVERRIDE;
virtual TabContents* GetAsTabContents() OVERRIDE;
- virtual ViewType::Type GetRenderViewType() const OVERRIDE;
+ virtual content::ViewType::Type 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
index 6859180..4a28c68 100644
--- a/content/common/view_types.h
+++ b/content/common/view_types.h
@@ -9,31 +9,22 @@
#include "base/basictypes.h"
#include "content/common/content_export.h"
+namespace content {
+
// Indicates different types of views
class CONTENT_EXPORT ViewType {
public:
- enum Type {
+ enum {
INVALID,
- BACKGROUND_CONTENTS,
TAB_CONTENTS,
- EXTENSION_BACKGROUND_PAGE,
- EXTENSION_POPUP,
- EXTENSION_INFOBAR,
- DEV_TOOLS_UI,
INTERSTITIAL_PAGE,
- NOTIFICATION,
- EXTENSION_DIALOG,
+ DEV_TOOLS_UI,
+
+ VIEW_TYPE_CONTENT_END
};
- // 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;
+ // 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.
@@ -42,4 +33,6 @@ class CONTENT_EXPORT 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 86b6862..5488f81 100644
--- a/content/content_common.gypi
+++ b/content/content_common.gypi
@@ -251,7 +251,6 @@
'common/utility_messages.h',
'common/view_messages.h',
'common/view_message_enums.h',
- 'common/view_types.cc',
'common/view_types.h',
'common/web_database_observer_impl.cc',
'common/web_database_observer_impl.h',