diff options
author | aa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-21 03:02:34 +0000 |
---|---|---|
committer | aa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-21 03:02:34 +0000 |
commit | 1c321ee57a522e891d91a41a09bd900f0afd6f0d (patch) | |
tree | bb6e35526d52b50d8e37216e8605c7b4aa08c86a | |
parent | e2a374f50043586ff684e0720bbbd99b9aa15c07 (diff) | |
download | chromium_src-1c321ee57a522e891d91a41a09bd900f0afd6f0d.zip chromium_src-1c321ee57a522e891d91a41a09bd900f0afd6f0d.tar.gz chromium_src-1c321ee57a522e891d91a41a09bd900f0afd6f0d.tar.bz2 |
Move Extension into extensions namespace
BUG=117262
TBR=aa@chromium.org
Review URL: https://chromiumcodereview.appspot.com/10375021
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@138074 0039d316-1c4b-4281-b951-d872f2087c98
459 files changed, 1644 insertions, 963 deletions
diff --git a/chrome/browser/app_controller_mac.mm b/chrome/browser/app_controller_mac.mm index e3ae37c..4631613 100644 --- a/chrome/browser/app_controller_mac.mm +++ b/chrome/browser/app_controller_mac.mm @@ -925,7 +925,7 @@ const AEEventClass kAECloudPrintUninstallClass = 'GCPu'; BackgroundApplicationListModel applications(profile); DCHECK(tag >= 0 && tag < static_cast<int>(applications.size())); - const Extension* extension = applications.GetExtension(tag); + const extensions::Extension* extension = applications.GetExtension(tag); BackgroundModeManager::LaunchBackgroundApplication(profile, extension); } @@ -1239,7 +1239,8 @@ const AEEventClass kAECloudPrintUninstallClass = 'GCPu'; NSString* menuStr = l10n_util::GetNSStringWithFixup(IDS_BACKGROUND_APPS_MAC); scoped_nsobject<NSMenu> appMenu([[NSMenu alloc] initWithTitle:menuStr]); - for (ExtensionList::const_iterator cursor = applications.begin(); + for (extensions::ExtensionList::const_iterator cursor = + applications.begin(); cursor != applications.end(); ++cursor, ++position) { DCHECK_EQ(applications.GetPosition(*cursor), position); diff --git a/chrome/browser/autocomplete/keyword_provider.cc b/chrome/browser/autocomplete/keyword_provider.cc index 1f70105..ba2028b 100644 --- a/chrome/browser/autocomplete/keyword_provider.cc +++ b/chrome/browser/autocomplete/keyword_provider.cc @@ -172,7 +172,7 @@ string16 KeywordProvider::GetKeywordForText( // Don't provide a keyword for inactive/disabled extension keywords. if (template_url->IsExtensionKeyword()) { - const Extension* extension = profile_->GetExtensionService()-> + const extensions::Extension* extension = profile_->GetExtensionService()-> GetExtensionById(template_url->GetExtensionId(), false); if (!extension || (profile_->IsOffTheRecord() && @@ -249,7 +249,7 @@ void KeywordProvider::Start(const AutocompleteInput& input, // we're incognito), or disabled. if (profile_ && template_url->IsExtensionKeyword()) { ExtensionService* service = profile_->GetExtensionService(); - const Extension* extension = service->GetExtensionById( + const extensions::Extension* extension = service->GetExtensionById( template_url->GetExtensionId(), false); bool enabled = extension && (!profile_->IsOffTheRecord() || diff --git a/chrome/browser/automation/automation_provider_json.cc b/chrome/browser/automation/automation_provider_json.cc index 2350ed3..6b27e46 100644 --- a/chrome/browser/automation/automation_provider_json.cc +++ b/chrome/browser/automation/automation_provider_json.cc @@ -14,6 +14,7 @@ #include "chrome/browser/profiles/profile.h" #include "chrome/common/automation_id.h" #include "chrome/common/automation_messages.h" +#include "chrome/common/extensions/extension.h" #include "content/public/browser/web_contents.h" using automation::Error; @@ -181,7 +182,7 @@ bool GetExtensionFromJSONArgsHelper( const std::string& key, Profile* profile, bool include_disabled, - const Extension** extension, + const extensions::Extension** extension, std::string* error) { std::string id; if (!args->GetString(key, &id)) { @@ -200,7 +201,7 @@ bool GetExtensionFromJSONArgsHelper( id.c_str()); return false; } - const Extension* installed_extension = + const extensions::Extension* installed_extension = service->GetExtensionById(id, include_disabled); if (!installed_extension) { *error = "Extension is disabled or has crashed."; @@ -216,7 +217,7 @@ bool GetExtensionFromJSONArgs( base::DictionaryValue* args, const std::string& key, Profile* profile, - const Extension** extension, + const extensions::Extension** extension, std::string* error) { return GetExtensionFromJSONArgsHelper( args, key, profile, true /* include_disabled */, extension, error); @@ -226,7 +227,7 @@ bool GetEnabledExtensionFromJSONArgs( base::DictionaryValue* args, const std::string& key, Profile* profile, - const Extension** extension, + const extensions::Extension** extension, std::string* error) { return GetExtensionFromJSONArgsHelper( args, key, profile, false /* include_disabled */, extension, error); diff --git a/chrome/browser/automation/automation_provider_json.h b/chrome/browser/automation/automation_provider_json.h index d2ced1b..34680a5 100644 --- a/chrome/browser/automation/automation_provider_json.h +++ b/chrome/browser/automation/automation_provider_json.h @@ -16,7 +16,6 @@ class AutomationId; class AutomationProvider; class Browser; -class Extension; class Profile; namespace base { @@ -29,6 +28,10 @@ class RenderViewHost; class WebContents; } +namespace extensions { +class Extension; +} + namespace IPC { class Message; } @@ -114,7 +117,7 @@ bool GetExtensionFromJSONArgs( base::DictionaryValue* args, const std::string& key, Profile* profile, - const Extension** extension, + const extensions::Extension** extension, std::string* error) WARN_UNUSED_RESULT; // Gets the enabled extension specified by the given dictionary |args|. |args| @@ -125,7 +128,7 @@ bool GetEnabledExtensionFromJSONArgs( base::DictionaryValue* args, const std::string& key, Profile* profile, - const Extension** extension, + const extensions::Extension** extension, std::string* error) WARN_UNUSED_RESULT; #endif // CHROME_BROWSER_AUTOMATION_AUTOMATION_PROVIDER_JSON_H_ diff --git a/chrome/browser/automation/automation_provider_observers.cc b/chrome/browser/automation/automation_provider_observers.cc index 339e575..700311b 100644 --- a/chrome/browser/automation/automation_provider_observers.cc +++ b/chrome/browser/automation/automation_provider_observers.cc @@ -555,7 +555,8 @@ void ExtensionUninstallObserver::Observe( } case chrome::NOTIFICATION_EXTENSION_UNINSTALL_NOT_ALLOWED: { - const Extension* extension = content::Details<Extension>(details).ptr(); + const extensions::Extension* extension = + content::Details<extensions::Extension>(details).ptr(); if (id_ == extension->id()) { scoped_ptr<DictionaryValue> return_value(new DictionaryValue); return_value->SetBoolean("success", false); @@ -615,11 +616,12 @@ void ExtensionReadyNotificationObserver::Observe( return; break; case chrome::NOTIFICATION_EXTENSION_LOADED: { - const Extension* loaded_extension = - content::Details<const Extension>(details).ptr(); + const extensions::Extension* loaded_extension = + content::Details<const extensions::Extension>(details).ptr(); // Only track an internal or unpacked extension load. - Extension::Location location = loaded_extension->location(); - if (location != Extension::INTERNAL && location != Extension::LOAD) + extensions::Extension::Location location = loaded_extension->location(); + if (location != extensions::Extension::INTERNAL && + location != extensions::Extension::LOAD) return; extension_ = loaded_extension; if (!DidExtensionViewsStopLoading(manager_)) @@ -731,7 +733,8 @@ void ExtensionsUpdatedObserver::Observe( // An extension has either completed update installation and is now // loaded, or else the install has been skipped because it is // either not allowed or else has been disabled. - const Extension* extension = content::Details<Extension>(details).ptr(); + const extensions::Extension* extension = + content::Details<extensions::Extension>(details).ptr(); in_progress_updates_.erase(extension->id()); break; } @@ -1876,7 +1879,7 @@ std::vector<DictionaryValue*>* GetAppInfoFromExtensions( DictionaryValue* app_info = new DictionaryValue(); AppLauncherHandler::CreateAppInfo(*ext, NULL, ext_service, app_info); app_info->SetBoolean("is_component_extension", - (*ext)->location() == Extension::COMPONENT); + (*ext)->location() == extensions::Extension::COMPONENT); // Convert the launch_type integer into a more descriptive string. int launch_type; diff --git a/chrome/browser/automation/automation_provider_observers.h b/chrome/browser/automation/automation_provider_observers.h index d8e0d56..0e88d83 100644 --- a/chrome/browser/automation/automation_provider_observers.h +++ b/chrome/browser/automation/automation_provider_observers.h @@ -56,7 +56,6 @@ class AutomationProvider; class BalloonCollection; class Browser; -class Extension; class ExtensionProcessManager; class ExtensionService; class InfoBarTabHelper; @@ -81,6 +80,10 @@ class RenderViewHost; class WebContents; } +namespace extensions { +class Extension; +} + namespace history { class TopSites; } @@ -364,7 +367,7 @@ class ExtensionReadyNotificationObserver ExtensionService* service_; base::WeakPtr<AutomationProvider> automation_; scoped_ptr<IPC::Message> reply_message_; - const Extension* extension_; + const extensions::Extension* extension_; DISALLOW_COPY_AND_ASSIGN(ExtensionReadyNotificationObserver); }; diff --git a/chrome/browser/automation/automation_util.cc b/chrome/browser/automation/automation_util.cc index f1ea241..12bf075 100644 --- a/chrome/browser/automation/automation_util.cc +++ b/chrome/browser/automation/automation_util.cc @@ -438,7 +438,7 @@ AutomationId GetIdForExtensionView( return AutomationId(type, id); } -AutomationId GetIdForExtension(const Extension* extension) { +AutomationId GetIdForExtension(const extensions::Extension* extension) { return AutomationId(AutomationId::kTypeExtension, extension->id()); } @@ -526,11 +526,11 @@ bool GetRenderViewForId( bool GetExtensionForId( const AutomationId& id, Profile* profile, - const Extension** extension) { + const extensions::Extension** extension) { if (id.type() != AutomationId::kTypeExtension) return false; ExtensionService* service = profile->GetExtensionService(); - const Extension* installed_extension = + const extensions::Extension* installed_extension = service->GetInstalledExtension(id.id()); if (installed_extension) *extension = installed_extension; @@ -550,7 +550,7 @@ bool DoesObjectWithIdExist(const AutomationId& id, Profile* profile) { return GetExtensionRenderViewForId(id, profile, &rvh); } case AutomationId::kTypeExtension: { - const Extension* extension; + const extensions::Extension* extension; return GetExtensionForId(id, profile, &extension); } default: diff --git a/chrome/browser/automation/automation_util.h b/chrome/browser/automation/automation_util.h index c33fd72..942a08b 100644 --- a/chrome/browser/automation/automation_util.h +++ b/chrome/browser/automation/automation_util.h @@ -13,7 +13,6 @@ class AutomationId; class AutomationProvider; class Browser; -class Extension; class GURL; class Profile; class TabContentsWrapper; @@ -27,6 +26,10 @@ namespace base { class DictionaryValue; } +namespace extensions { +class Extension; +} + namespace IPC { class Message; } @@ -96,7 +99,7 @@ AutomationId GetIdForExtensionView( const content::RenderViewHost* render_view_host); // Returns a valid automation ID for the extension. -AutomationId GetIdForExtension(const Extension* extension); +AutomationId GetIdForExtension(const extensions::Extension* extension); // Gets the tab for the given ID. Returns true on success. bool GetTabForId(const AutomationId& id, content::WebContents** tab); @@ -109,7 +112,7 @@ bool GetRenderViewForId(const AutomationId& id, // Gets the extension for the given ID. Returns true on success. bool GetExtensionForId(const AutomationId& id, Profile* profile, - const Extension** extension); + const extensions::Extension** extension); // Returns whether the given ID refers to an actual automation entity. bool DoesObjectWithIdExist(const AutomationId& id, Profile* profile); diff --git a/chrome/browser/automation/testing_automation_provider.cc b/chrome/browser/automation/testing_automation_provider.cc index 073d986..8480c30 100644 --- a/chrome/browser/automation/testing_automation_provider.cc +++ b/chrome/browser/automation/testing_automation_provider.cc @@ -187,6 +187,8 @@ using content::Referrer; using content::RenderViewHost; using content::SSLStatus; using content::WebContents; +using extensions::Extension; +using extensions::ExtensionList; namespace { @@ -3998,9 +4000,8 @@ ListValue* GetAPIPermissions(const Extension* ext) { // Sample json input: { "command": "GetExtensionsInfo" } // See GetExtensionsInfo() in chrome/test/pyautolib/pyauto.py for sample json // output. -void TestingAutomationProvider::GetExtensionsInfo( - DictionaryValue* args, - IPC::Message* reply_message) { +void TestingAutomationProvider::GetExtensionsInfo(DictionaryValue* args, + IPC::Message* reply_message) { AutomationJSONReply reply(this, reply_message); Browser* browser; std::string error_msg; @@ -4046,9 +4047,11 @@ void TestingAutomationProvider::GetExtensionsInfo( Extension::Location location = extension->location(); extension_value->SetBoolean("is_component", location == Extension::COMPONENT); - extension_value->SetBoolean("is_internal", location == Extension::INTERNAL); + extension_value->SetBoolean("is_internal", + location == Extension::INTERNAL); extension_value->SetBoolean("is_user_installed", - location == Extension::INTERNAL || location == Extension::LOAD); + location == Extension::INTERNAL || + location == Extension::LOAD); extension_value->SetBoolean("is_enabled", service->IsExtensionEnabled(id)); extension_value->SetBoolean("allowed_in_incognito", service->IsIncognitoEnabled(id)); @@ -4151,7 +4154,8 @@ void TestingAutomationProvider::SetExtensionStateById( AutomationJSONReply(this, reply_message).SendSuccess(NULL); } } else { - service->DisableExtension(extension->id(), Extension::DISABLE_USER_ACTION); + service->DisableExtension(extension->id(), + Extension::DISABLE_USER_ACTION); AutomationJSONReply(this, reply_message).SendSuccess(NULL); } diff --git a/chrome/browser/background/background_application_list_model.cc b/chrome/browser/background/background_application_list_model.cc index a414cf1..6965c6b 100644 --- a/chrome/browser/background/background_application_list_model.cc +++ b/chrome/browser/background/background_application_list_model.cc @@ -27,6 +27,11 @@ #include "ui/base/l10n/l10n_util_collator.h" #include "ui/gfx/image/image.h" +using extensions::Extension; +using extensions::ExtensionList; +using extensions::UnloadedExtensionInfo; +using extensions::UpdatedExtensionPermissionsInfo; + class ExtensionNameComparator { public: explicit ExtensionNameComparator(icu::Collator* collator); @@ -228,7 +233,8 @@ BackgroundApplicationListModel::FindApplication( } BackgroundApplicationListModel::Application* -BackgroundApplicationListModel::FindApplication(const Extension* extension) { +BackgroundApplicationListModel::FindApplication( + const Extension* extension) { const std::string& id = extension->id(); ApplicationMap::iterator found = applications_.find(id); return (found == applications_.end()) ? NULL : found->second; diff --git a/chrome/browser/background/background_application_list_model.h b/chrome/browser/background/background_application_list_model.h index 8722bc8a..c4f6a45 100644 --- a/chrome/browser/background/background_application_list_model.h +++ b/chrome/browser/background/background_application_list_model.h @@ -31,8 +31,9 @@ class BackgroundApplicationListModel : public content::NotificationObserver { public: // Invoked when data that the model associates with the extension, such as // the Icon, has changed. - virtual void OnApplicationDataChanged(const Extension* extension, - Profile* profile); + virtual void OnApplicationDataChanged( + const extensions::Extension* extension, + Profile* profile); // Invoked when the model detects a previously unknown extension and/or when // it no longer detects a previously known extension. @@ -58,26 +59,26 @@ class BackgroundApplicationListModel : public content::NotificationObserver { // releasing it if the associated background application is unloaded. // NOTE: All icons are currently sized as // ExtensionIconSet::EXTENSION_ICON_BITTY. - const SkBitmap* GetIcon(const Extension* extension); + const SkBitmap* GetIcon(const extensions::Extension* extension); // Return the position of |extension| within this list model. - int GetPosition(const Extension* extension) const; + int GetPosition(const extensions::Extension* extension) const; // Return the extension at the specified |position| in this list model. - const Extension* GetExtension(int position) const; + const extensions::Extension* GetExtension(int position) const; // Returns true if the passed extension is a background app. - static bool IsBackgroundApp(const Extension& extension, + static bool IsBackgroundApp(const extensions::Extension& extension, Profile* profile); // Dissociate observer from this model. void RemoveObserver(Observer* observer); - ExtensionList::const_iterator begin() const { + extensions::ExtensionList::const_iterator begin() const { return extensions_.begin(); } - ExtensionList::const_iterator end() const { + extensions::ExtensionList::const_iterator end() const { return extensions_.end(); } @@ -94,16 +95,17 @@ class BackgroundApplicationListModel : public content::NotificationObserver { typedef std::map<std::string, Application*> ApplicationMap; // Identifies and caches data related to the extension. - void AssociateApplicationData(const Extension* extension); + void AssociateApplicationData(const extensions::Extension* extension); // Clears cached data related to |extension|. - void DissociateApplicationData(const Extension* extension); + void DissociateApplicationData(const extensions::Extension* extension); // Returns the Application associated with |extension| or NULL. - const Application* FindApplication(const Extension* extension) const; + const Application* FindApplication( + const extensions::Extension* extension) const; // Returns the Application associated with |extension| or NULL. - Application* FindApplication(const Extension* extension); + Application* FindApplication(const extensions::Extension* extension); // content::NotificationObserver implementation. virtual void Observe(int type, @@ -112,29 +114,30 @@ class BackgroundApplicationListModel : public content::NotificationObserver { // Notifies observers that some of the data associated with this background // application, e. g. the Icon, has changed. - void SendApplicationDataChangedNotifications(const Extension* extension); + void SendApplicationDataChangedNotifications( + const extensions::Extension* extension); // Notifies observers that at least one background application has been added // or removed. void SendApplicationListChangedNotifications(); // Invoked by Observe for NOTIFICATION_EXTENSION_LOADED. - void OnExtensionLoaded(const Extension* extension); + void OnExtensionLoaded(const extensions::Extension* extension); // Invoked by Observe for NOTIFICATION_EXTENSION_UNLOADED. - void OnExtensionUnloaded(const Extension* extension); + void OnExtensionUnloaded(const extensions::Extension* extension); // Invoked by Observe for NOTIFICATION_EXTENSION_PERMISSIONS_UPDATED. void OnExtensionPermissionsUpdated( - const Extension* extension, - UpdatedExtensionPermissionsInfo::Reason reason, + const extensions::Extension* extension, + extensions::UpdatedExtensionPermissionsInfo::Reason reason, const ExtensionPermissionSet* permissions); // Refresh the list of background applications and generate notifications. void Update(); ApplicationMap applications_; - ExtensionList extensions_; + extensions::ExtensionList extensions_; ObserverList<Observer> observers_; Profile* profile_; content::NotificationRegistrar registrar_; diff --git a/chrome/browser/background/background_application_list_model_unittest.cc b/chrome/browser/background/background_application_list_model_unittest.cc index fea9d20..982badf 100644 --- a/chrome/browser/background/background_application_list_model_unittest.cc +++ b/chrome/browser/background/background_application_list_model_unittest.cc @@ -30,6 +30,8 @@ // operations to produce a repeatable sequence. #define RANDOM_SEED (0x33F7A7A7) +using extensions::Extension; + // For ExtensionService interface when it requires a path that is not used. FilePath bogus_file_path() { return FilePath(FILE_PATH_LITERAL("//foobar_nonexistent")); diff --git a/chrome/browser/background/background_contents_service.cc b/chrome/browser/background/background_contents_service.cc index 3cfaeab..909ef7a 100644 --- a/chrome/browser/background/background_contents_service.cc +++ b/chrome/browser/background/background_contents_service.cc @@ -37,6 +37,8 @@ using content::SiteInstance; using content::WebContents; +using extensions::Extension; +using extensions::UnloadedExtensionInfo; namespace { @@ -55,7 +57,8 @@ void ScheduleCloseBalloon(const std::string& extension_id) { class CrashNotificationDelegate : public NotificationDelegate { public: - CrashNotificationDelegate(Profile* profile, const Extension* extension) + CrashNotificationDelegate(Profile* profile, + const Extension* extension) : profile_(profile), is_hosted_app_(extension->is_hosted_app()), extension_id_(extension->id()) { @@ -366,8 +369,8 @@ void BackgroundContentsService::LoadBackgroundContentsFromPrefs( for (DictionaryValue::key_iterator it = contents->begin_keys(); it != contents->end_keys(); ++it) { // Check to make sure that the parent extension is still enabled. - const Extension* extension = extensions_service->GetExtensionById( - *it, false); + const Extension* extension = extensions_service-> + GetExtensionById(*it, false); if (!extension) { // We should never reach here - it should not be possible for an app // to become uninstalled without the associated BackgroundContents being diff --git a/chrome/browser/background/background_mode_manager.cc b/chrome/browser/background/background_mode_manager.cc index 8d7a288..69bd254 100644 --- a/chrome/browser/background/background_mode_manager.cc +++ b/chrome/browser/background/background_mode_manager.cc @@ -42,6 +42,8 @@ #include "ui/base/resource/resource_bundle.h" using content::UserMetricsAction; +using extensions::Extension; +using extensions::UpdatedExtensionPermissionsInfo; BackgroundModeManager::BackgroundModeData::BackgroundModeData( int command_id, @@ -80,7 +82,8 @@ void BackgroundModeManager::BackgroundModeData::ExecuteCommand(int item) { break; default: // Launch the app associated with this item. - const Extension* extension = applications_->GetExtension(item); + const Extension* extension = applications_-> + GetExtension(item); BackgroundModeManager::LaunchBackgroundApplication(profile_, extension); break; } @@ -109,7 +112,8 @@ void BackgroundModeManager::BackgroundModeData::BuildProfileMenu( menu->AddItemWithStringId(IDC_MinimumLabelValue, IDS_BACKGROUND_APP_NOT_INSTALLED); } else { - for (ExtensionList::const_iterator cursor = applications_->begin(); + for (extensions::ExtensionList::const_iterator cursor = + applications_->begin(); cursor != applications_->end(); ++cursor, ++position) { const SkBitmap* icon = applications_->GetIcon(*cursor); diff --git a/chrome/browser/background/background_mode_manager.h b/chrome/browser/background/background_mode_manager.h index c972048..be5f5fe 100644 --- a/chrome/browser/background/background_mode_manager.h +++ b/chrome/browser/background/background_mode_manager.h @@ -20,13 +20,16 @@ class Browser; class CommandLine; -class Extension; class PrefService; class Profile; class ProfileInfoCache; class StatusIcon; class StatusTray; +namespace extensions { +class Extension; +} + // BackgroundModeManager is responsible for switching Chrome into and out of // "background mode" and for providing UI for the user to exit Chrome when there // are no open browser windows. @@ -56,7 +59,7 @@ class BackgroundModeManager virtual void RegisterProfile(Profile* profile); static void LaunchBackgroundApplication(Profile* profile, - const Extension* extension); + const extensions::Extension* extension); // For testing purposes. int NumberOfBackgroundModeData(); @@ -153,7 +156,7 @@ class BackgroundModeManager const content::NotificationDetails& details) OVERRIDE; // BackgroundApplicationListModel::Observer implementation. - virtual void OnApplicationDataChanged(const Extension* extension, + virtual void OnApplicationDataChanged(const extensions::Extension* extension, Profile* profile) OVERRIDE; virtual void OnApplicationListChanged(Profile* profile) OVERRIDE; @@ -177,7 +180,7 @@ class BackgroundModeManager // Invoked when an extension is installed so we can ensure that // launch-on-startup is enabled if appropriate. |extension| can be NULL when // called from unit tests. - void OnBackgroundAppInstalled(const Extension* extension); + void OnBackgroundAppInstalled(const extensions::Extension* extension); // Called to make sure that our launch-on-startup mode is properly set. // (virtual so we can override for tests). @@ -185,7 +188,7 @@ class BackgroundModeManager // Invoked when a background app is installed so we can display a // platform-specific notification to the user. - void DisplayAppInstalledNotification(const Extension* extension); + void DisplayAppInstalledNotification(const extensions::Extension* extension); // Invoked to put Chrome in KeepAlive mode - chrome runs in the background // and has a status bar icon. diff --git a/chrome/browser/background/background_mode_manager_aura.cc b/chrome/browser/background/background_mode_manager_aura.cc index 223c8ea..d66b6a4 100644 --- a/chrome/browser/background/background_mode_manager_aura.cc +++ b/chrome/browser/background/background_mode_manager_aura.cc @@ -4,6 +4,7 @@ #include "chrome/browser/background/background_mode_manager.h" +#include "chrome/common/extensions/extension.h" #include "grit/generated_resources.h" #include "ui/base/l10n/l10n_util.h" @@ -14,7 +15,7 @@ void BackgroundModeManager::EnableLaunchOnStartup(bool should_launch) { } void BackgroundModeManager::DisplayAppInstalledNotification( - const Extension* extension) { + const extensions::Extension* extension) { NOTIMPLEMENTED(); } diff --git a/chrome/browser/background/background_mode_manager_chromeos.cc b/chrome/browser/background/background_mode_manager_chromeos.cc index cee80ae..a5be498 100644 --- a/chrome/browser/background/background_mode_manager_chromeos.cc +++ b/chrome/browser/background/background_mode_manager_chromeos.cc @@ -4,6 +4,7 @@ #include "chrome/browser/background/background_mode_manager.h" +#include "chrome/common/extensions/extension.h" #include "grit/generated_resources.h" #include "ui/base/l10n/l10n_util.h" @@ -12,7 +13,7 @@ void BackgroundModeManager::EnableLaunchOnStartup(bool should_launch) { } void BackgroundModeManager::DisplayAppInstalledNotification( - const Extension* extension) { + const extensions::Extension* extension) { // No need to display anything on ChromeOS because all extensions run all // the time anyway. } diff --git a/chrome/browser/background/background_mode_manager_gtk.cc b/chrome/browser/background/background_mode_manager_gtk.cc index 890b437..c61a302 100644 --- a/chrome/browser/background/background_mode_manager_gtk.cc +++ b/chrome/browser/background/background_mode_manager_gtk.cc @@ -22,6 +22,7 @@ #include "ui/base/l10n/l10n_util.h" using content::BrowserThread; +using extensions::Extension; namespace { diff --git a/chrome/browser/background/background_mode_manager_mac.mm b/chrome/browser/background/background_mode_manager_mac.mm index a0e15cc..03c3366 100644 --- a/chrome/browser/background/background_mode_manager_mac.mm +++ b/chrome/browser/background/background_mode_manager_mac.mm @@ -74,7 +74,7 @@ void BackgroundModeManager::EnableLaunchOnStartup(bool should_launch) { } void BackgroundModeManager::DisplayAppInstalledNotification( - const Extension* extension) { + const extensions::Extension* extension) { // TODO(atwilson): Display a platform-appropriate notification here. // http://crbug.com/74970 } diff --git a/chrome/browser/background/background_mode_manager_win.cc b/chrome/browser/background/background_mode_manager_win.cc index 3322d866..33b79e2 100644 --- a/chrome/browser/background/background_mode_manager_win.cc +++ b/chrome/browser/background/background_mode_manager_win.cc @@ -33,7 +33,7 @@ void BackgroundModeManager::EnableLaunchOnStartup(bool should_launch) { } void BackgroundModeManager::DisplayAppInstalledNotification( - const Extension* extension) { + const extensions::Extension* extension) { // Create a status tray notification balloon explaining to the user that // a background app has been installed. CreateStatusTrayIcon(); diff --git a/chrome/browser/bookmarks/bookmark_extension_api.cc b/chrome/browser/bookmarks/bookmark_extension_api.cc index 20d7f3a..2543977 100644 --- a/chrome/browser/bookmarks/bookmark_extension_api.cc +++ b/chrome/browser/bookmarks/bookmark_extension_api.cc @@ -43,6 +43,7 @@ namespace keys = bookmark_extension_api_constants; using base::TimeDelta; using content::BrowserThread; using content::WebContents; + typedef QuotaLimitHeuristic::Bucket Bucket; typedef QuotaLimitHeuristic::Config Config; typedef QuotaLimitHeuristic::BucketList BucketList; @@ -92,7 +93,7 @@ void BookmarksFunction::Run() { if (success) { content::NotificationService::current()->Notify( chrome::NOTIFICATION_EXTENSION_BOOKMARKS_API_INVOKED, - content::Source<const Extension>(GetExtension()), + content::Source<const extensions::Extension>(GetExtension()), content::Details<const BookmarksFunction>(this)); } SendResponse(success); diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc index 1c5efe5..c031d11 100644 --- a/chrome/browser/chrome_content_browser_client.cc +++ b/chrome/browser/chrome_content_browser_client.cc @@ -153,6 +153,7 @@ using content::QuotaPermissionContext; using content::RenderViewHost; using content::SiteInstance; using content::WebContents; +using extensions::Extension; using webkit_glue::WebPreferences; namespace { diff --git a/chrome/browser/chromeos/accessibility/accessibility_util.cc b/chrome/browser/chromeos/accessibility/accessibility_util.cc index 480ba53..9704d35 100644 --- a/chrome/browser/chromeos/accessibility/accessibility_util.cc +++ b/chrome/browser/chromeos/accessibility/accessibility_util.cc @@ -18,6 +18,7 @@ #include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile_manager.h" #include "chrome/browser/speech/extension_api/tts_extension_api_platform.h" +#include "chrome/common/extensions/extension.h" #include "chrome/common/extensions/extension_messages.h" #include "chrome/common/extensions/extension_resource.h" #include "chrome/common/extensions/user_script.h" @@ -116,7 +117,7 @@ void EnableSpokenFeedback(bool enabled, content::WebUI* login_web_ui) { FilePath path = FilePath(extension_misc::kAccessExtensionPath) .AppendASCII(extension_misc::kChromeVoxDirectoryName); if (enabled) { // Load ChromeVox - const Extension* extension = + const extensions::Extension* extension = extension_service->component_loader()->Add(IDR_CHROMEVOX_MANIFEST, path); diff --git a/chrome/browser/chromeos/enterprise_extension_observer.cc b/chrome/browser/chromeos/enterprise_extension_observer.cc index c8e61ef..740fc38 100644 --- a/chrome/browser/chromeos/enterprise_extension_observer.cc +++ b/chrome/browser/chromeos/enterprise_extension_observer.cc @@ -34,8 +34,10 @@ void EnterpriseExtensionObserver::Observe( if (content::Source<Profile>(source).ptr() != profile_) { return; } - Extension* extension = content::Details<Extension>(details).ptr(); - if (extension->location() != Extension::EXTERNAL_POLICY_DOWNLOAD) { + extensions::Extension* extension = + content::Details<extensions::Extension>(details).ptr(); + if (extension->location() != + extensions::Extension::EXTERNAL_POLICY_DOWNLOAD) { return; } BrowserThread::PostTask( diff --git a/chrome/browser/chromeos/extensions/external_filesystem_apitest.cc b/chrome/browser/chromeos/extensions/external_filesystem_apitest.cc index 69ec32d..1ec43c6 100644 --- a/chrome/browser/chromeos/extensions/external_filesystem_apitest.cc +++ b/chrome/browser/chromeos/extensions/external_filesystem_apitest.cc @@ -160,10 +160,11 @@ class FileSystemExtensionApiTest : public ExtensionApiTest { // Loads the extension, which temporarily starts the lazy background page // to dispatch the onInstalled event. We wait until it shuts down again. - const Extension* LoadExtensionAndWait(const std::string& test_name) { + const extensions::Extension* LoadExtensionAndWait( + const std::string& test_name) { BackgroundObserver page_complete; FilePath extdir = test_data_dir_.AppendASCII(test_name); - const Extension* extension = LoadExtension(extdir); + const extensions::Extension* extension = LoadExtension(extdir); if (extension) page_complete.WaitUntilClosed(); return extension; diff --git a/chrome/browser/chromeos/extensions/file_browser_event_router.cc b/chrome/browser/chromeos/extensions/file_browser_event_router.cc index ba82050..1bbf6cc 100644 --- a/chrome/browser/chromeos/extensions/file_browser_event_router.cc +++ b/chrome/browser/chromeos/extensions/file_browser_event_router.cc @@ -429,7 +429,7 @@ void FileBrowserEventRouter::DispatchFolderChangeEvent( for (ExtensionUsageRegistry::const_iterator iter = extensions.begin(); iter != extensions.end(); ++iter) { - GURL target_origin_url(Extension::GetBaseURLFromExtensionId( + GURL target_origin_url(extensions::Extension::GetBaseURLFromExtensionId( iter->first)); GURL base_url = fileapi::GetFileSystemRootURI(target_origin_url, fileapi::kFileSystemTypeExternal); diff --git a/chrome/browser/chromeos/extensions/file_browser_private_api.cc b/chrome/browser/chromeos/extensions/file_browser_private_api.cc index b97fa81..674025c 100644 --- a/chrome/browser/chromeos/extensions/file_browser_private_api.cc +++ b/chrome/browser/chromeos/extensions/file_browser_private_api.cc @@ -66,6 +66,7 @@ using content::BrowserThread; using content::ChildProcessSecurityPolicy; using content::SiteInstance; using content::WebContents; +using extensions::Extension; using file_handler_util::FileTaskExecutor; using gdata::GDataOperationRegistry; diff --git a/chrome/browser/chromeos/extensions/file_handler_util.cc b/chrome/browser/chromeos/extensions/file_handler_util.cc index 3feb7cb..9802c25 100644 --- a/chrome/browser/chromeos/extensions/file_handler_util.cc +++ b/chrome/browser/chromeos/extensions/file_handler_util.cc @@ -39,6 +39,7 @@ using content::BrowserThread; using content::ChildProcessSecurityPolicy; using content::SiteInstance; using content::WebContents; +using extensions::Extension; namespace file_handler_util { namespace { diff --git a/chrome/browser/chromeos/extensions/file_handler_util.h b/chrome/browser/chromeos/extensions/file_handler_util.h index d38cb6b..6ef6760 100644 --- a/chrome/browser/chromeos/extensions/file_handler_util.h +++ b/chrome/browser/chromeos/extensions/file_handler_util.h @@ -99,7 +99,7 @@ class FileTaskExecutor : public base::RefCountedThreadSafe<FileTaskExecutor> { class ExecuteTasksFileSystemCallbackDispatcher; void RequestFileEntryOnFileThread( const GURL& handler_base_url, - const scoped_refptr<const Extension>& handler, + const scoped_refptr<const extensions::Extension>& handler, int handler_pid, const std::vector<GURL>& file_urls); @@ -118,7 +118,7 @@ class FileTaskExecutor : public base::RefCountedThreadSafe<FileTaskExecutor> { // will be given to the handler extension host process. void InitHandlerHostFileAccessPermissions( const FileDefinitionList& file_list, - const Extension* handler_extension, + const extensions::Extension* handler_extension, const std::string& action_id); // Registers file permissions from |handler_host_permissions_| with // ChildProcessSecurityPolicy for process with id |handler_pid|. diff --git a/chrome/browser/chromeos/extensions/file_manager_util.cc b/chrome/browser/chromeos/extensions/file_manager_util.cc index 38439424..9509d86 100644 --- a/chrome/browser/chromeos/extensions/file_manager_util.cc +++ b/chrome/browser/chromeos/extensions/file_manager_util.cc @@ -463,7 +463,7 @@ void OpenFileBrowser(const FilePath& path, if (!service) return; - const Extension* extension = + const extensions::Extension* extension = service->GetExtensionById(kFileBrowserDomain, false); if (!extension) return; diff --git a/chrome/browser/chromeos/kiosk_mode/kiosk_mode_screensaver.cc b/chrome/browser/chromeos/kiosk_mode/kiosk_mode_screensaver.cc index caa1581..4063852 100644 --- a/chrome/browser/chromeos/kiosk_mode/kiosk_mode_screensaver.cc +++ b/chrome/browser/chromeos/kiosk_mode/kiosk_mode_screensaver.cc @@ -21,6 +21,8 @@ #include "content/public/browser/browser_thread.h" #include "content/public/browser/notification_service.h" +using extensions::Extension; + namespace chromeos { typedef base::Callback<void( diff --git a/chrome/browser/chromeos/kiosk_mode/kiosk_mode_screensaver.h b/chrome/browser/chromeos/kiosk_mode/kiosk_mode_screensaver.h index 449539f..701c18b 100644 --- a/chrome/browser/chromeos/kiosk_mode/kiosk_mode_screensaver.h +++ b/chrome/browser/chromeos/kiosk_mode/kiosk_mode_screensaver.h @@ -13,9 +13,12 @@ #include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_registrar.h" -class Extension; class Profile; +namespace extensions { +class Extension; +} + namespace chromeos { class KioskModeScreensaver : public PowerManagerClient::Observer, @@ -45,7 +48,7 @@ class KioskModeScreensaver : public PowerManagerClient::Observer, // Called back on the UI thread to Setup the screensaver with the now unpacked // and loaded extension. - void SetupScreensaver(scoped_refptr<Extension> extension, + void SetupScreensaver(scoped_refptr<extensions::Extension> extension, Profile* default_profile, const FilePath& extension_base_path); diff --git a/chrome/browser/chromeos/offline/offline_load_page.cc b/chrome/browser/chromeos/offline/offline_load_page.cc index ac107da..183c4a2 100644 --- a/chrome/browser/chromeos/offline/offline_load_page.cc +++ b/chrome/browser/chromeos/offline/offline_load_page.cc @@ -98,7 +98,7 @@ std::string OfflineLoadPage::GetHTMLContents() { Profile* profile = Profile::FromBrowserContext( web_contents_->GetBrowserContext()); DCHECK(profile); - const Extension* extension = NULL; + const extensions::Extension* extension = NULL; ExtensionService* extensions_service = profile->GetExtensionService(); // Extension service does not exist in test. if (extensions_service) @@ -138,7 +138,7 @@ void OfflineLoadPage::OnDontProceed() { } void OfflineLoadPage::GetAppOfflineStrings( - const Extension* app, + const extensions::Extension* app, const string16& failed_url, DictionaryValue* strings) const { strings->SetString("title", app->name()); diff --git a/chrome/browser/chromeos/offline/offline_load_page.h b/chrome/browser/chromeos/offline/offline_load_page.h index 1e5a78f..52fab74 100644 --- a/chrome/browser/chromeos/offline/offline_load_page.h +++ b/chrome/browser/chromeos/offline/offline_load_page.h @@ -14,8 +14,6 @@ #include "googleurl/src/gurl.h" #include "net/base/network_change_notifier.h" -class Extension; - namespace base { class DictionaryValue; } @@ -25,6 +23,10 @@ class InterstitialPage; class WebContents; } +namespace extensions { +class Extension; +} + namespace chromeos { // OfflineLoadPage class shows the interstitial page that is shown @@ -67,7 +69,7 @@ class OfflineLoadPage : public content::InterstitialPageDelegate, // Retrieves template strings of the offline page for app and // normal site. - void GetAppOfflineStrings(const Extension* app, + void GetAppOfflineStrings(const extensions::Extension* app, const string16& faield_url, base::DictionaryValue* strings) const; void GetNormalOfflineStrings(const string16& faield_url, diff --git a/chrome/browser/component_updater/component_unpacker.cc b/chrome/browser/component_updater/component_unpacker.cc index a15d13a..ec697ac 100644 --- a/chrome/browser/component_updater/component_unpacker.cc +++ b/chrome/browser/component_updater/component_unpacker.cc @@ -20,6 +20,7 @@ #include "crypto/signature_verifier.h" using crypto::SecureHash; +using extensions::Extension; namespace { // This class makes sure that the CRX digital signature is valid diff --git a/chrome/browser/component_updater/component_updater_service.cc b/chrome/browser/component_updater/component_updater_service.cc index 99df4d6..33e08ec 100644 --- a/chrome/browser/component_updater/component_updater_service.cc +++ b/chrome/browser/component_updater/component_updater_service.cc @@ -37,6 +37,7 @@ using content::BrowserThread; using content::UtilityProcessHost; using content::UtilityProcessHostClient; +using extensions::Extension; // The component updater is designed to live until process shutdown, so // base::Bind() calls are not refcounted. diff --git a/chrome/browser/content_settings/content_settings_platform_app_provider.cc b/chrome/browser/content_settings/content_settings_platform_app_provider.cc index 53e0386..f95b470 100644 --- a/chrome/browser/content_settings/content_settings_platform_app_provider.cc +++ b/chrome/browser/content_settings/content_settings_platform_app_provider.cc @@ -16,6 +16,8 @@ #include "content/public/browser/notification_details.h" #include "content/public/browser/notification_service.h" +using extensions::UnloadedExtensionInfo; + namespace content_settings { PlatformAppProvider::PlatformAppProvider(ExtensionService* extension_service) @@ -64,7 +66,8 @@ void PlatformAppProvider::Observe(int type, break; } case chrome::NOTIFICATION_EXTENSION_LOADED: { - const Extension* extension = content::Details<Extension>(details).ptr(); + const extensions::Extension* extension = + content::Details<extensions::Extension>(details).ptr(); if (extension->plugins().size() > 0) SetContentSettingForExtension(extension, CONTENT_SETTING_ALLOW); break; @@ -88,7 +91,7 @@ void PlatformAppProvider::ShutdownOnUIThread() { } void PlatformAppProvider::SetContentSettingForExtension( - const Extension* extension, + const extensions::Extension* extension, ContentSetting setting) { scoped_ptr<ContentSettingsPattern::BuilderInterface> pattern_builder( ContentSettingsPattern::CreateBuilder(false)); diff --git a/chrome/browser/content_settings/content_settings_platform_app_provider.h b/chrome/browser/content_settings/content_settings_platform_app_provider.h index 2d93a9e..d481273 100644 --- a/chrome/browser/content_settings/content_settings_platform_app_provider.h +++ b/chrome/browser/content_settings/content_settings_platform_app_provider.h @@ -13,9 +13,12 @@ #include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_registrar.h" -class Extension; class ExtensionService; +namespace extensions { +class Extension; +} + namespace content_settings { // A content settings provider which disables certain plugins for platform apps. @@ -49,7 +52,7 @@ class PlatformAppProvider : public ObservableProvider, const content::NotificationSource& source, const content::NotificationDetails& details) OVERRIDE; private: - void SetContentSettingForExtension(const Extension* extension, + void SetContentSettingForExtension(const extensions::Extension* extension, ContentSetting setting); OriginIdentifierValueMap value_map_; diff --git a/chrome/browser/download/chrome_download_manager_delegate.cc b/chrome/browser/download/chrome_download_manager_delegate.cc index 00580825..aad682d 100644 --- a/chrome/browser/download/chrome_download_manager_delegate.cc +++ b/chrome/browser/download/chrome_download_manager_delegate.cc @@ -114,7 +114,7 @@ bool ChromeDownloadManagerDelegate::IsExtensionDownload( if (item->PromptUserForSaveLocation()) return false; - if (item->GetMimeType() == Extension::kMimeType || + if (item->GetMimeType() == extensions::Extension::kMimeType || UserScript::IsURLUserScript(item->GetURL(), item->GetMimeType())) { return true; } else { @@ -212,7 +212,7 @@ bool ChromeDownloadManagerDelegate::ShouldOpenFileBasedOnExtension( FilePath::StringType extension = path.Extension(); if (extension.empty()) return false; - if (Extension::IsExtension(path)) + if (extensions::Extension::IsExtension(path)) return false; DCHECK(extension[0] == FilePath::kExtensionSeparator); extension.erase(0, 1); diff --git a/chrome/browser/download/download_browsertest.cc b/chrome/browser/download/download_browsertest.cc index d6e2d5b..097c951 100644 --- a/chrome/browser/download/download_browsertest.cc +++ b/chrome/browser/download/download_browsertest.cc @@ -70,6 +70,7 @@ using content::DownloadManager; using content::DownloadPersistentStoreInfo; using content::DownloadUrlParameters; using content::WebContents; +using extensions::Extension; namespace { diff --git a/chrome/browser/download/download_shelf_context_menu.cc b/chrome/browser/download/download_shelf_context_menu.cc index 952bc7d..991479e 100644 --- a/chrome/browser/download/download_shelf_context_menu.cc +++ b/chrome/browser/download/download_shelf_context_menu.cc @@ -18,6 +18,7 @@ #include "ui/base/l10n/l10n_util.h" using content::DownloadItem; +using extensions::Extension; DownloadShelfContextMenu::~DownloadShelfContextMenu() {} diff --git a/chrome/browser/extensions/alert_apitest.cc b/chrome/browser/extensions/alert_apitest.cc index d9388bf..c2b8fc3 100644 --- a/chrome/browser/extensions/alert_apitest.cc +++ b/chrome/browser/extensions/alert_apitest.cc @@ -16,7 +16,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionApiTest, AlertBasic) { ASSERT_TRUE(RunExtensionTest("alert")) << message_; - const Extension* extension = GetSingleLoadedExtension(); + const extensions::Extension* extension = GetSingleLoadedExtension(); ExtensionHost* host = browser()->profile()->GetExtensionProcessManager()-> GetBackgroundHostForExtension(extension->id()); ASSERT_TRUE(host); diff --git a/chrome/browser/extensions/all_urls_apitest.cc b/chrome/browser/extensions/all_urls_apitest.cc index cf353ce..e22e8ec 100644 --- a/chrome/browser/extensions/all_urls_apitest.cc +++ b/chrome/browser/extensions/all_urls_apitest.cc @@ -23,10 +23,10 @@ IN_PROC_BROWSER_TEST_F(AllUrlsApiTest, WhitelistedExtension) { .AppendASCII("execute_script"); // Then add the two extensions to the whitelist. - Extension::ScriptingWhitelist whitelist; - whitelist.push_back(Extension::GenerateIdForPath(extension_dir1)); - whitelist.push_back(Extension::GenerateIdForPath(extension_dir2)); - Extension::SetScriptingWhitelist(whitelist); + extensions::Extension::ScriptingWhitelist whitelist; + whitelist.push_back(extensions::Extension::GenerateIdForPath(extension_dir1)); + whitelist.push_back(extensions::Extension::GenerateIdForPath(extension_dir2)); + extensions::Extension::SetScriptingWhitelist(whitelist); // Then load extensions. ExtensionService* service = browser()->profile()->GetExtensionService(); diff --git a/chrome/browser/extensions/api/alarms/alarms_api_unittest.cc b/chrome/browser/extensions/api/alarms/alarms_api_unittest.cc index 4103fb5..33c2592 100644 --- a/chrome/browser/extensions/api/alarms/alarms_api_unittest.cc +++ b/chrome/browser/extensions/api/alarms/alarms_api_unittest.cc @@ -49,7 +49,8 @@ class ExtensionAlarmsTest : public BrowserWithTestWindowTest { alarm_delegate_ = new AlarmDelegate(); alarm_manager_->set_delegate(alarm_delegate_); - extension_ = utils::CreateEmptyExtensionWithLocation(Extension::LOAD); + extension_ = utils::CreateEmptyExtensionWithLocation( + extensions::Extension::LOAD); } base::Value* RunFunctionWithExtension( @@ -117,7 +118,7 @@ class ExtensionAlarmsTest : public BrowserWithTestWindowTest { protected: AlarmManager* alarm_manager_; AlarmDelegate* alarm_delegate_; - scoped_refptr<Extension> extension_; + scoped_refptr<extensions::Extension> extension_; }; TEST_F(ExtensionAlarmsTest, Create) { diff --git a/chrome/browser/extensions/api/app/app_api.h b/chrome/browser/extensions/api/app/app_api.h index 864dece..306c158 100644 --- a/chrome/browser/extensions/api/app/app_api.h +++ b/chrome/browser/extensions/api/app/app_api.h @@ -8,11 +8,12 @@ #include "chrome/browser/extensions/extension_function.h" -class Extension; class Profile; namespace extensions { +class Extension; + class AppNotifyFunction : public SyncExtensionFunction { public: DECLARE_EXTENSION_FUNCTION_NAME("experimental.app.notify"); diff --git a/chrome/browser/extensions/api/commands/extension_command_service.cc b/chrome/browser/extensions/api/commands/extension_command_service.cc index 593e4b5..949ed96 100644 --- a/chrome/browser/extensions/api/commands/extension_command_service.cc +++ b/chrome/browser/extensions/api/commands/extension_command_service.cc @@ -14,6 +14,8 @@ #include "chrome/common/pref_names.h" #include "content/public/browser/notification_service.h" +using extensions::Extension; + namespace { const char kExtension[] = "extension"; diff --git a/chrome/browser/extensions/api/commands/extension_command_service.h b/chrome/browser/extensions/api/commands/extension_command_service.h index 51ec0a1..1bb908b 100644 --- a/chrome/browser/extensions/api/commands/extension_command_service.h +++ b/chrome/browser/extensions/api/commands/extension_command_service.h @@ -88,7 +88,7 @@ class ExtensionCommandService : public ProfileKeyedService, // free, it will be taken by this extension. If not, that keybinding request // is ignored. |user_pref| is the PrefService used to record the new // keybinding assignment. - void AssignInitialKeybindings(const Extension* extension); + void AssignInitialKeybindings(const extensions::Extension* extension); // Removes all keybindings for a given extension by its |extension_id|. void RemoveKeybindingPrefs(std::string extension_id); diff --git a/chrome/browser/extensions/api/context_menu/context_menu_apitest.cc b/chrome/browser/extensions/api/context_menu/context_menu_apitest.cc index 094df01..0b8d2a1 100644 --- a/chrome/browser/extensions/api/context_menu/context_menu_apitest.cc +++ b/chrome/browser/extensions/api/context_menu/context_menu_apitest.cc @@ -24,7 +24,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ContextMenusFromMultipleContexts) { ASSERT_TRUE(test_server()->Start()); ASSERT_TRUE(RunExtensionTest("context_menus/add_from_multiple_contexts")) << message_; - const Extension* extension = GetSingleLoadedExtension(); + const extensions::Extension* extension = GetSingleLoadedExtension(); ASSERT_TRUE(extension) << message_; { diff --git a/chrome/browser/extensions/api/cookies/cookies_api.cc b/chrome/browser/extensions/api/cookies/cookies_api.cc index f36ea1a..e2cb2b0 100644 --- a/chrome/browser/extensions/api/cookies/cookies_api.cc +++ b/chrome/browser/extensions/api/cookies/cookies_api.cc @@ -290,7 +290,7 @@ void GetAllCookiesFunction::GetAllCookiesOnIOThread() { void GetAllCookiesFunction::GetAllCookiesCallback( const net::CookieList& cookie_list) { - const Extension* extension = GetExtension(); + const extensions::Extension* extension = GetExtension(); if (extension) { ListValue* matching_list = new ListValue(); cookies_helpers::AppendMatchingCookiesToList( diff --git a/chrome/browser/extensions/api/cookies/cookies_helpers.cc b/chrome/browser/extensions/api/cookies/cookies_helpers.cc index 8322d2d..2a1c281 100644 --- a/chrome/browser/extensions/api/cookies/cookies_helpers.cc +++ b/chrome/browser/extensions/api/cookies/cookies_helpers.cc @@ -202,4 +202,4 @@ bool MatchFilter::MatchesDomain(const std::string& domain) { } } // namespace cookies_helpers -} // namespace extensions +} // namespace extension diff --git a/chrome/browser/extensions/api/cookies/cookies_helpers.h b/chrome/browser/extensions/api/cookies/cookies_helpers.h index 464cfad..3ece5ba 100644 --- a/chrome/browser/extensions/api/cookies/cookies_helpers.h +++ b/chrome/browser/extensions/api/cookies/cookies_helpers.h @@ -16,7 +16,6 @@ #include "net/cookies/cookie_monster.h" class Browser; -class Extension; class Profile; namespace base { @@ -25,6 +24,9 @@ class ListValue; } namespace extensions { + +class Extension; + namespace cookies_helpers { // Returns either the original profile or the incognito profile, based on the diff --git a/chrome/browser/extensions/api/dns/dns_apitest.cc b/chrome/browser/extensions/api/dns/dns_apitest.cc index 6824507..b3746dc 100644 --- a/chrome/browser/extensions/api/dns/dns_apitest.cc +++ b/chrome/browser/extensions/api/dns/dns_apitest.cc @@ -100,7 +100,7 @@ const std::string DnsApiTest::kAddress = "9.8.7.6"; IN_PROC_BROWSER_TEST_F(DnsApiTest, DnsResolveIPLiteral) { scoped_refptr<extensions::DnsResolveFunction> resolve_function( new extensions::DnsResolveFunction()); - scoped_refptr<Extension> empty_extension(CreateEmptyExtension()); + scoped_refptr<extensions::Extension> empty_extension(CreateEmptyExtension()); resolve_function->set_extension(empty_extension.get()); resolve_function->set_has_callback(true); @@ -122,7 +122,7 @@ IN_PROC_BROWSER_TEST_F(DnsApiTest, DnsResolveIPLiteral) { IN_PROC_BROWSER_TEST_F(DnsApiTest, DnsResolveHostname) { scoped_refptr<extensions::DnsResolveFunction> resolve_function( new extensions::DnsResolveFunction()); - scoped_refptr<Extension> empty_extension(CreateEmptyExtension()); + scoped_refptr<extensions::Extension> empty_extension(CreateEmptyExtension()); resolve_function->set_extension(empty_extension.get()); resolve_function->set_has_callback(true); diff --git a/chrome/browser/extensions/api/extension_action/browser_action_apitest.cc b/chrome/browser/extensions/api/extension_action/browser_action_apitest.cc index 0043c26..5f7070c 100644 --- a/chrome/browser/extensions/api/extension_action/browser_action_apitest.cc +++ b/chrome/browser/extensions/api/extension_action/browser_action_apitest.cc @@ -26,6 +26,7 @@ #include "ui/gfx/size.h" using content::WebContents; +using extensions::Extension; class BrowserActionApiTest : public ExtensionApiTest { public: diff --git a/chrome/browser/extensions/api/extension_action/page_action_apitest.cc b/chrome/browser/extensions/api/extension_action/page_action_apitest.cc index 7591077..a221047 100644 --- a/chrome/browser/extensions/api/extension_action/page_action_apitest.cc +++ b/chrome/browser/extensions/api/extension_action/page_action_apitest.cc @@ -17,6 +17,8 @@ #include "chrome/test/base/ui_test_utils.h" #include "content/public/browser/web_contents.h" +using extensions::Extension; + IN_PROC_BROWSER_TEST_F(ExtensionApiTest, PageAction) { ASSERT_TRUE(test_server()->Start()); ASSERT_TRUE(RunExtensionTest("page_action/basics")) << message_; diff --git a/chrome/browser/extensions/api/extension_action/page_as_browser_action_apitest.cc b/chrome/browser/extensions/api/extension_action/page_as_browser_action_apitest.cc index 9d810e9..6beb603 100644 --- a/chrome/browser/extensions/api/extension_action/page_as_browser_action_apitest.cc +++ b/chrome/browser/extensions/api/extension_action/page_as_browser_action_apitest.cc @@ -24,6 +24,8 @@ // These are a mash-up of the tests from from page_actions_apitest.cc and // browser_actions_apitest.cc. +using extensions::Extension; + namespace { class PageAsBrowserActionApiTest : public ExtensionApiTest { diff --git a/chrome/browser/extensions/api/permissions/permissions_api.cc b/chrome/browser/extensions/api/permissions/permissions_api.cc index e481c27..2c2f391 100644 --- a/chrome/browser/extensions/api/permissions/permissions_api.cc +++ b/chrome/browser/extensions/api/permissions/permissions_api.cc @@ -75,7 +75,7 @@ bool RemovePermissionsFunction::RunImpl() { if (!permissions.get()) return false; - const Extension* extension = GetExtension(); + const extensions::Extension* extension = GetExtension(); ExtensionPermissionsInfo* info = ExtensionPermissionsInfo::GetInstance(); // Make sure they're only trying to remove permissions supported by this API. diff --git a/chrome/browser/extensions/api/permissions/permissions_api.h b/chrome/browser/extensions/api/permissions/permissions_api.h index 97bf0ac..c954cc7 100644 --- a/chrome/browser/extensions/api/permissions/permissions_api.h +++ b/chrome/browser/extensions/api/permissions/permissions_api.h @@ -13,7 +13,6 @@ #include "chrome/browser/extensions/extension_install_ui.h" #include "chrome/common/extensions/extension_permission_set.h" -class Extension; class ExtensionPermissionSet; class ExtensionService; diff --git a/chrome/browser/extensions/api/runtime/runtime_api.h b/chrome/browser/extensions/api/runtime/runtime_api.h index b9e868b..1ff000d 100644 --- a/chrome/browser/extensions/api/runtime/runtime_api.h +++ b/chrome/browser/extensions/api/runtime/runtime_api.h @@ -8,12 +8,13 @@ #include "chrome/browser/extensions/extension_function.h" -class Extension; class ExtensionHost; class Profile; namespace extensions { +class Extension; + class RuntimeEventRouter { public: // Dispatches the onInstalled event to the given extension. diff --git a/chrome/browser/extensions/api/socket/socket_apitest.cc b/chrome/browser/extensions/api/socket/socket_apitest.cc index 8cdaef41..4143b3a 100644 --- a/chrome/browser/extensions/api/socket/socket_apitest.cc +++ b/chrome/browser/extensions/api/socket/socket_apitest.cc @@ -14,6 +14,8 @@ #include "chrome/test/base/ui_test_utils.h" #include "net/test/test_server.h" +using extensions::Extension; + namespace utils = extension_function_test_utils; namespace { diff --git a/chrome/browser/extensions/api/terminal/terminal_extension_helper.cc b/chrome/browser/extensions/api/terminal/terminal_extension_helper.cc index cdbaea7..8cfe0154 100644 --- a/chrome/browser/extensions/api/terminal/terminal_extension_helper.cc +++ b/chrome/browser/extensions/api/terminal/terminal_extension_helper.cc @@ -12,7 +12,7 @@ namespace { const char kCroshExtensionEntryPoint[] = "/html/crosh.html"; -const Extension* GetTerminalExtension(Profile* profile) { +const extensions::Extension* GetTerminalExtension(Profile* profile) { // Search order for terminal extensions. // We prefer hterm-dev, then hterm, then the builtin crosh extension. static const char* kPossibleAppIds[] = { @@ -26,7 +26,7 @@ const Extension* GetTerminalExtension(Profile* profile) { ExtensionService* service = profile->GetExtensionService(); for (size_t x = 0; x < arraysize(kPossibleAppIds); ++x) { - const Extension* extension = service->GetExtensionById( + const extensions::Extension* extension = service->GetExtensionById( kPossibleAppIds[x], false); if (extension) return extension; @@ -38,7 +38,7 @@ const Extension* GetTerminalExtension(Profile* profile) { } // namespace GURL TerminalExtensionHelper::GetCroshExtensionURL(Profile* profile) { - const Extension* extension = GetTerminalExtension(profile); + const extensions::Extension* extension = GetTerminalExtension(profile); if (!extension) return GURL(); diff --git a/chrome/browser/extensions/api/terminal/terminal_extension_helper.h b/chrome/browser/extensions/api/terminal/terminal_extension_helper.h index ff82306..481f5a8 100644 --- a/chrome/browser/extensions/api/terminal/terminal_extension_helper.h +++ b/chrome/browser/extensions/api/terminal/terminal_extension_helper.h @@ -10,7 +10,6 @@ #include "googleurl/src/gurl.h" -class Extension; class Profile; class TerminalExtensionHelper { diff --git a/chrome/browser/extensions/api/web_navigation/web_navigation_apitest.cc b/chrome/browser/extensions/api/web_navigation/web_navigation_apitest.cc index 1152fcf..fef3a5b 100644 --- a/chrome/browser/extensions/api/web_navigation/web_navigation_apitest.cc +++ b/chrome/browser/extensions/api/web_navigation/web_navigation_apitest.cc @@ -189,7 +189,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionApiTest, WebNavigationUserAction) { ResultCatcher catcher; ExtensionService* service = browser()->profile()->GetExtensionService(); - const Extension* extension = + const extensions::Extension* extension = service->GetExtensionById(last_loaded_extension_id_, false); GURL url = extension->GetResourceURL("userAction/a.html"); @@ -227,7 +227,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionApiTest, WebNavigationRequestOpenTab) { ResultCatcher catcher; ExtensionService* service = browser()->profile()->GetExtensionService(); - const Extension* extension = + const extensions::Extension* extension = service->GetExtensionById(last_loaded_extension_id_, false); GURL url = extension->GetResourceURL("requestOpenTab/a.html"); diff --git a/chrome/browser/extensions/api/web_request/web_request_api.cc b/chrome/browser/extensions/api/web_request/web_request_api.cc index 20616a8..0dbe7e4 100644 --- a/chrome/browser/extensions/api/web_request/web_request_api.cc +++ b/chrome/browser/extensions/api/web_request/web_request_api.cc @@ -51,6 +51,7 @@ using content::BrowserMessageFilter; using content::BrowserThread; using content::ResourceRequestInfo; +using extensions::Extension; namespace helpers = extension_web_request_api_helpers; namespace keys = extension_web_request_api_constants; diff --git a/chrome/browser/extensions/api/web_request/web_request_apitest.cc b/chrome/browser/extensions/api/web_request/web_request_apitest.cc index 63de52c..45a4ca9 100644 --- a/chrome/browser/extensions/api/web_request/web_request_apitest.cc +++ b/chrome/browser/extensions/api/web_request/web_request_apitest.cc @@ -105,7 +105,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionWebRequestApiTest, WebRequestNewTab) { ResultCatcher catcher; ExtensionService* service = browser()->profile()->GetExtensionService(); - const Extension* extension = + const extensions::Extension* extension = service->GetExtensionById(last_loaded_extension_id_, false); GURL url = extension->GetResourceURL("newTab/a.html"); diff --git a/chrome/browser/extensions/app_background_page_apitest.cc b/chrome/browser/extensions/app_background_page_apitest.cc index 69cbc95..9a9a58c 100644 --- a/chrome/browser/extensions/app_background_page_apitest.cc +++ b/chrome/browser/extensions/app_background_page_apitest.cc @@ -20,6 +20,8 @@ #include "content/test/test_notification_tracker.h" #include "net/base/mock_host_resolver.h" +using extensions::Extension; + class AppBackgroundPageApiTest : public ExtensionApiTest { public: void SetUpCommandLine(CommandLine* command_line) OVERRIDE { diff --git a/chrome/browser/extensions/app_notification_browsertest.cc b/chrome/browser/extensions/app_notification_browsertest.cc index bb833ab..87d4fec 100644 --- a/chrome/browser/extensions/app_notification_browsertest.cc +++ b/chrome/browser/extensions/app_notification_browsertest.cc @@ -54,7 +54,7 @@ IN_PROC_BROWSER_TEST_F(AppNotificationTest, SaveClientId) { Interceptor interceptor; AppNotifyChannelSetup::SetInterceptorForTests(&interceptor); - const Extension* app = + const extensions::Extension* app = LoadExtension(test_data_dir_.AppendASCII("app_notifications")); ASSERT_TRUE(app != NULL); diff --git a/chrome/browser/extensions/app_notification_storage.cc b/chrome/browser/extensions/app_notification_storage.cc index 42f11b2..b279170 100644 --- a/chrome/browser/extensions/app_notification_storage.cc +++ b/chrome/browser/extensions/app_notification_storage.cc @@ -131,7 +131,7 @@ bool LevelDbAppNotificationStorage::GetExtensionIds( scoped_ptr<leveldb::Iterator> iter(db_->NewIterator(read_options_)); for (iter->SeekToFirst(); iter->Valid(); iter->Next()) { std::string key = iter->key().ToString(); - if (Extension::IdIsValid(key)) + if (extensions::Extension::IdIsValid(key)) result->insert(key); } diff --git a/chrome/browser/extensions/app_process_apitest.cc b/chrome/browser/extensions/app_process_apitest.cc index a769286..c8d2774 100644 --- a/chrome/browser/extensions/app_process_apitest.cc +++ b/chrome/browser/extensions/app_process_apitest.cc @@ -30,6 +30,7 @@ using content::NavigationController; using content::RenderViewHost; using content::WebContents; +using extensions::Extension; // Simulates a page calling window.open on an URL, and waits for the navigation. static void WindowOpenHelper(Browser* browser, diff --git a/chrome/browser/extensions/app_shortcut_manager.cc b/chrome/browser/extensions/app_shortcut_manager.cc index bec3e3d..4d8fb70 100644 --- a/chrome/browser/extensions/app_shortcut_manager.cc +++ b/chrome/browser/extensions/app_shortcut_manager.cc @@ -17,6 +17,8 @@ #include "skia/ext/image_operations.h" #include "ui/base/resource/resource_bundle.h" +using extensions::Extension; + namespace { // Allow tests to disable shortcut creation, to prevent developers' desktops // becoming overrun with shortcuts. diff --git a/chrome/browser/extensions/app_shortcut_manager.h b/chrome/browser/extensions/app_shortcut_manager.h index d97bbcc2..8868591 100644 --- a/chrome/browser/extensions/app_shortcut_manager.h +++ b/chrome/browser/extensions/app_shortcut_manager.h @@ -36,7 +36,7 @@ class AppShortcutManager : public ImageLoadingTracker::Observer, static void SetShortcutCreationDisabledForTesting(bool disabled); private: // Install the shortcuts for an application. - void InstallApplicationShortcuts(const Extension* extension); + void InstallApplicationShortcuts(const extensions::Extension* extension); content::NotificationRegistrar registrar_; Profile* profile_; diff --git a/chrome/browser/extensions/app_sync_bundle.h b/chrome/browser/extensions/app_sync_bundle.h index fd84b57..d3d444d 100644 --- a/chrome/browser/extensions/app_sync_bundle.h +++ b/chrome/browser/extensions/app_sync_bundle.h @@ -17,13 +17,14 @@ #include "sync/api/syncable_service.h" class SyncChangeProcessor; -class Extension; class ExtensionService; class ExtensionSet; class SyncErrorFactory; namespace extensions { +class Extension; + // Bundle of app specific sync stuff. class AppSyncBundle { public: diff --git a/chrome/browser/extensions/app_sync_data.h b/chrome/browser/extensions/app_sync_data.h index 3bdd335..d6c390f 100644 --- a/chrome/browser/extensions/app_sync_data.h +++ b/chrome/browser/extensions/app_sync_data.h @@ -10,7 +10,6 @@ #include "chrome/common/string_ordinal.h" #include "sync/api/sync_change.h" -class Extension; class SyncData; namespace sync_pb { class AppSpecifics; @@ -18,6 +17,7 @@ class AppSpecifics; namespace extensions { +class Extension; class ExtensionSyncData; // A class that encapsulates the synced properties of an Application. diff --git a/chrome/browser/extensions/apps_promo.cc b/chrome/browser/extensions/apps_promo.cc index b9d4365..70f0f64 100644 --- a/chrome/browser/extensions/apps_promo.cc +++ b/chrome/browser/extensions/apps_promo.cc @@ -202,7 +202,7 @@ AppsPromo::AppsPromo(PrefService* prefs) AppsPromo::~AppsPromo() {} -bool AppsPromo::ShouldShowPromo(const ExtensionIdSet& installed_ids, +bool AppsPromo::ShouldShowPromo(const extensions::ExtensionIdSet& installed_ids, bool* just_expired) { *just_expired = false; @@ -253,7 +253,8 @@ bool AppsPromo::ShouldShowPromo(const ExtensionIdSet& installed_ids, return false; } -bool AppsPromo::ShouldShowAppLauncher(const ExtensionIdSet& installed_ids) { +bool AppsPromo::ShouldShowAppLauncher( + const extensions::ExtensionIdSet& installed_ids) { // On Chrome OS the default apps are installed via a separate mechanism that // is always enabled. Therefore we always show the launcher. #if defined(OS_CHROMEOS) diff --git a/chrome/browser/extensions/apps_promo.h b/chrome/browser/extensions/apps_promo.h index b132a39..3b25f5f 100644 --- a/chrome/browser/extensions/apps_promo.h +++ b/chrome/browser/extensions/apps_promo.h @@ -88,7 +88,7 @@ class AppsPromo { // Gets the set of old default apps that may have been installed by previous // versions of Chrome. - const ExtensionIdSet& old_default_apps() const { + const extensions::ExtensionIdSet& old_default_apps() const { return old_default_app_ids_; } @@ -101,10 +101,10 @@ class AppsPromo { void HidePromo(); // Returns true if the app launcher should be displayed on the NTP. - bool ShouldShowAppLauncher(const ExtensionIdSet& installed_ids); + bool ShouldShowAppLauncher(const extensions::ExtensionIdSet& installed_ids); // Returns true if the apps promo should be displayed in the launcher. - bool ShouldShowPromo(const ExtensionIdSet& installed_ids, + bool ShouldShowPromo(const extensions::ExtensionIdSet& installed_ids, bool* just_expired); private: @@ -136,7 +136,7 @@ class AppsPromo { // The set of default extensions. Initialized to a static list in the // constructor. - ExtensionIdSet old_default_app_ids_; + extensions::ExtensionIdSet old_default_app_ids_; DISALLOW_COPY_AND_ASSIGN(AppsPromo); }; diff --git a/chrome/browser/extensions/apps_promo_unittest.cc b/chrome/browser/extensions/apps_promo_unittest.cc index e4e470c..b9e2e5e 100644 --- a/chrome/browser/extensions/apps_promo_unittest.cc +++ b/chrome/browser/extensions/apps_promo_unittest.cc @@ -57,7 +57,8 @@ void ExtensionAppsPromo::SetUp() { #if !defined(OS_CHROMEOS) TEST_F(ExtensionAppsPromo, HappyPath) { - const ExtensionIdSet& default_app_ids = apps_promo()->old_default_apps(); + const extensions::ExtensionIdSet& default_app_ids = + apps_promo()->old_default_apps(); EXPECT_GT(default_app_ids.size(), 0u); @@ -68,7 +69,7 @@ TEST_F(ExtensionAppsPromo, HappyPath) { // The app launcher and promo should not be shown if there are no extensions // installed and no promo is set. - ExtensionIdSet installed_ids; + extensions::ExtensionIdSet installed_ids; bool promo_just_expired = false; EXPECT_FALSE(AppsPromo::IsPromoSupportedForLocale()); EXPECT_FALSE(apps_promo()->ShouldShowAppLauncher(installed_ids)); diff --git a/chrome/browser/extensions/chrome_app_api_browsertest.cc b/chrome/browser/extensions/chrome_app_api_browsertest.cc index 865c44e..c0b3eae 100644 --- a/chrome/browser/extensions/chrome_app_api_browsertest.cc +++ b/chrome/browser/extensions/chrome_app_api_browsertest.cc @@ -21,6 +21,8 @@ #include "googleurl/src/gurl.h" #include "net/base/mock_host_resolver.h" +using extensions::Extension; + class ChromeAppAPITest : public ExtensionBrowserTest { protected: bool IsAppInstalled() { return IsAppInstalled(L""); } diff --git a/chrome/browser/extensions/component_loader.h b/chrome/browser/extensions/component_loader.h index e6b24b9..f0be4c2 100644 --- a/chrome/browser/extensions/component_loader.h +++ b/chrome/browser/extensions/component_loader.h @@ -15,12 +15,13 @@ #include "chrome/browser/prefs/pref_change_registrar.h" #include "content/public/browser/notification_observer.h" -class Extension; class ExtensionServiceInterface; class PrefService; namespace extensions { +class Extension; + // For registering, loading, and unloading component extensions. class ComponentLoader : public content::NotificationObserver { public: diff --git a/chrome/browser/extensions/component_loader_unittest.cc b/chrome/browser/extensions/component_loader_unittest.cc index 2830c8b..e076ba1 100644 --- a/chrome/browser/extensions/component_loader_unittest.cc +++ b/chrome/browser/extensions/component_loader_unittest.cc @@ -16,6 +16,8 @@ #include "chrome/test/base/testing_pref_service.h" #include "testing/gtest/include/gtest/gtest.h" +using extensions::Extension; + namespace { class MockExtensionService : public TestExtensionService { diff --git a/chrome/browser/extensions/content_script_apitest.cc b/chrome/browser/extensions/content_script_apitest.cc index 0e75dc7..0d1c901 100644 --- a/chrome/browser/extensions/content_script_apitest.cc +++ b/chrome/browser/extensions/content_script_apitest.cc @@ -125,7 +125,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ContentScriptExtensionAPIs) { CommandLine::ForCurrentProcess()->AppendSwitch( switches::kEnableExperimentalExtensionApis); - const Extension* extension = LoadExtension( + const extensions::Extension* extension = LoadExtension( test_data_dir_.AppendASCII("content_scripts/extension_api")); ResultCatcher catcher; diff --git a/chrome/browser/extensions/convert_user_script.cc b/chrome/browser/extensions/convert_user_script.cc index f73dc3b..92fadbd 100644 --- a/chrome/browser/extensions/convert_user_script.cc +++ b/chrome/browser/extensions/convert_user_script.cc @@ -24,6 +24,8 @@ #include "crypto/sha2.h" #include "googleurl/src/gurl.h" +using extensions::Extension; + namespace keys = extension_manifest_keys; namespace values = extension_manifest_values; diff --git a/chrome/browser/extensions/convert_user_script.h b/chrome/browser/extensions/convert_user_script.h index 8a8933a..109a4ce 100644 --- a/chrome/browser/extensions/convert_user_script.h +++ b/chrome/browser/extensions/convert_user_script.h @@ -11,10 +11,13 @@ #include "base/memory/ref_counted.h" #include "base/string16.h" -class Extension; class FilePath; class GURL; +namespace extensions { +class Extension; +} + // Wraps the specified user script in an extension. The extension is created // unpacked in the system temp dir. Returns a valid extension that the caller // should take ownership on success, or NULL and |error| on failure. @@ -22,7 +25,7 @@ class GURL; // NOTE: This function does file IO and should not be called on the UI thread. // NOTE: The caller takes ownership of the directory at extension->path() on the // returned object. -scoped_refptr<Extension> ConvertUserScriptToExtension( +scoped_refptr<extensions::Extension> ConvertUserScriptToExtension( const FilePath& user_script, const GURL& original_url, string16* error); #endif // CHROME_BROWSER_EXTENSIONS_CONVERT_USER_SCRIPT_H_ diff --git a/chrome/browser/extensions/convert_user_script_unittest.cc b/chrome/browser/extensions/convert_user_script_unittest.cc index 1ab3a9b..cafdbe8 100644 --- a/chrome/browser/extensions/convert_user_script_unittest.cc +++ b/chrome/browser/extensions/convert_user_script_unittest.cc @@ -16,6 +16,8 @@ #include "chrome/common/extensions/extension.h" #include "testing/gtest/include/gtest/gtest.h" +using extensions::Extension; + namespace { static void AddPattern(URLPatternSet* extent, const std::string& pattern) { diff --git a/chrome/browser/extensions/convert_web_app.cc b/chrome/browser/extensions/convert_web_app.cc index bafb5d9..bd36cb5 100644 --- a/chrome/browser/extensions/convert_web_app.cc +++ b/chrome/browser/extensions/convert_web_app.cc @@ -32,6 +32,7 @@ namespace keys = extension_manifest_keys; using base::Time; +using extensions::Extension; namespace { diff --git a/chrome/browser/extensions/convert_web_app.h b/chrome/browser/extensions/convert_web_app.h index 0ce2814..4aecb5d 100644 --- a/chrome/browser/extensions/convert_web_app.h +++ b/chrome/browser/extensions/convert_web_app.h @@ -10,12 +10,15 @@ #include "base/memory/ref_counted.h" -class Extension; namespace base { class Time; } +namespace extensions { +class Extension; +} + struct WebApplicationInfo; // Generates a version number for an extension from a time. The goal is to make @@ -36,7 +39,7 @@ std::string ConvertTimeToExtensionVersion(const base::Time& time); // NOTE: This function does file IO and should not be called on the UI thread. // NOTE: The caller takes ownership of the directory at extension->path() on the // returned object. -scoped_refptr<Extension> ConvertWebAppToExtension( +scoped_refptr<extensions::Extension> ConvertWebAppToExtension( const WebApplicationInfo& web_app_info, const base::Time& create_time); diff --git a/chrome/browser/extensions/convert_web_app_browsertest.cc b/chrome/browser/extensions/convert_web_app_browsertest.cc index 3210d58..7ec70b9 100644 --- a/chrome/browser/extensions/convert_web_app_browsertest.cc +++ b/chrome/browser/extensions/convert_web_app_browsertest.cc @@ -24,7 +24,7 @@ class ExtensionFromWebAppTest } std::string expected_extension_id_; - const Extension* installed_extension_; + const extensions::Extension* installed_extension_; private: // InProcessBrowserTest @@ -37,8 +37,8 @@ class ExtensionFromWebAppTest const content::NotificationSource& source, const content::NotificationDetails& details) { if (type == chrome::NOTIFICATION_EXTENSION_INSTALLED) { - const Extension* extension = - content::Details<const Extension>(details).ptr(); + const extensions::Extension* extension = + content::Details<const extensions::Extension>(details).ptr(); if (extension->id() == expected_extension_id_) { installed_extension_ = extension; MessageLoopForUI::current()->Quit(); diff --git a/chrome/browser/extensions/convert_web_app_unittest.cc b/chrome/browser/extensions/convert_web_app_unittest.cc index 640b31b..4a8b257 100644 --- a/chrome/browser/extensions/convert_web_app_unittest.cc +++ b/chrome/browser/extensions/convert_web_app_unittest.cc @@ -105,7 +105,7 @@ TEST(ExtensionFromWebApp, Basic) { web_app.icons.push_back(GetIconInfo(icon_url, sizes[i])); } - scoped_refptr<Extension> extension = ConvertWebAppToExtension( + scoped_refptr<extensions::Extension> extension = ConvertWebAppToExtension( web_app, GetTestTime(1978, 12, 11, 0, 0, 0, 0)); ASSERT_TRUE(extension.get()); @@ -148,7 +148,7 @@ TEST(ExtensionFromWebApp, Minimal) { web_app.title = ASCIIToUTF16("Gearpad"); web_app.app_url = GURL("http://aaronboodman.com/gearpad/"); - scoped_refptr<Extension> extension = ConvertWebAppToExtension( + scoped_refptr<extensions::Extension> extension = ConvertWebAppToExtension( web_app, GetTestTime(1978, 12, 11, 0, 0, 0, 0)); ASSERT_TRUE(extension.get()); diff --git a/chrome/browser/extensions/crx_installer.cc b/chrome/browser/extensions/crx_installer.cc index 687a777..4a26f21 100644 --- a/chrome/browser/extensions/crx_installer.cc +++ b/chrome/browser/extensions/crx_installer.cc @@ -49,6 +49,7 @@ using content::BrowserThread; using content::UserMetricsAction; +using extensions::Extension; using extensions::PermissionsUpdater; // static diff --git a/chrome/browser/extensions/crx_installer.h b/chrome/browser/extensions/crx_installer.h index c5acf80..e8d9114 100644 --- a/chrome/browser/extensions/crx_installer.h +++ b/chrome/browser/extensions/crx_installer.h @@ -90,8 +90,10 @@ class CrxInstaller const FilePath& source_file() const { return source_file_; } - Extension::Location install_source() const { return install_source_; } - void set_install_source(Extension::Location source) { + extensions::Extension::Location install_source() const { + return install_source_; + } + void set_install_source(extensions::Extension::Location source) { install_source_ = source; } @@ -109,13 +111,13 @@ class CrxInstaller void set_allow_silent_install(bool val) { allow_silent_install_ = val; } bool is_gallery_install() const { - return (creation_flags_ & Extension::FROM_WEBSTORE) > 0; + return (creation_flags_ & extensions::Extension::FROM_WEBSTORE) > 0; } void set_is_gallery_install(bool val) { if (val) - creation_flags_ |= Extension::FROM_WEBSTORE; + creation_flags_ |= extensions::Extension::FROM_WEBSTORE; else - creation_flags_ &= ~Extension::FROM_WEBSTORE; + creation_flags_ &= ~extensions::Extension::FROM_WEBSTORE; } // The original download URL should be set when the WebstoreInstaller is @@ -167,14 +169,14 @@ class CrxInstaller // Called after OnUnpackSuccess as a last check to see whether the install // should complete. - bool AllowInstall(const Extension* extension, string16* error); + bool AllowInstall(const extensions::Extension* extension, string16* error); // SandboxedExtensionUnpackerClient virtual void OnUnpackFailure(const string16& error_message) OVERRIDE; virtual void OnUnpackSuccess(const FilePath& temp_dir, const FilePath& extension_dir, const base::DictionaryValue* original_manifest, - const Extension* extension) OVERRIDE; + const extensions::Extension* extension) OVERRIDE; // Returns true if we can skip confirmation because the install was // whitelisted. @@ -193,7 +195,7 @@ class CrxInstaller void ReportFailureFromUIThread(const string16& error); void ReportSuccessFromFileThread(); void ReportSuccessFromUIThread(); - void NotifyCrxInstallComplete(const Extension* extension); + void NotifyCrxInstallComplete(const extensions::Extension* extension); // The file we're installing. FilePath source_file_; @@ -207,7 +209,7 @@ class CrxInstaller // The location the installation came from (bundled with Chromium, registry, // manual install, etc). This metadata is saved with the installation if // successful. Defaults to INTERNAL. - Extension::Location install_source_; + extensions::Extension::Location install_source_; // Indicates whether the user has already approved the extension to be // installed. If true, |expected_manifest_| and |expected_id_| must match @@ -248,7 +250,7 @@ class CrxInstaller // The extension we're installing. We own this and either pass it off to // ExtensionService on success, or delete it on failure. - scoped_refptr<const Extension> extension_; + scoped_refptr<const extensions::Extension> extension_; // The ordinal of the NTP apps page |extension_| will be shown on. StringOrdinal page_ordinal_; diff --git a/chrome/browser/extensions/crx_installer_browsertest.cc b/chrome/browser/extensions/crx_installer_browsertest.cc index efaaf0a..8a0c4bd 100644 --- a/chrome/browser/extensions/crx_installer_browsertest.cc +++ b/chrome/browser/extensions/crx_installer_browsertest.cc @@ -32,11 +32,13 @@ class MockInstallUI : public ExtensionInstallUI { bool confirmation_requested() { return confirmation_requested_; } // Overriding some of the ExtensionInstallUI API. - void ConfirmInstall(Delegate* delegate, const Extension* extension) { + void ConfirmInstall(Delegate* delegate, + const extensions::Extension* extension) { confirmation_requested_ = true; delegate->InstallUIProceed(); } - void OnInstallSuccess(const Extension* extension, SkBitmap* icon) { + void OnInstallSuccess(const extensions::Extension* extension, + SkBitmap* icon) { MessageLoopForUI::current()->Quit(); } void OnInstallFailure(const string16& error) { diff --git a/chrome/browser/extensions/default_apps.cc b/chrome/browser/extensions/default_apps.cc index 71d0c2d..0d7821c 100644 --- a/chrome/browser/extensions/default_apps.cc +++ b/chrome/browser/extensions/default_apps.cc @@ -12,6 +12,7 @@ #include "chrome/browser/prefs/pref_service.h" #include "chrome/browser/profiles/profile.h" #include "chrome/common/chrome_switches.h" +#include "chrome/common/extensions/extension.h" #include "chrome/common/pref_names.h" #include "ui/base/l10n/l10n_util.h" @@ -117,8 +118,8 @@ void RegisterUserPrefs(PrefService* prefs) { Provider::Provider(Profile* profile, VisitorInterface* service, ExternalExtensionLoader* loader, - Extension::Location crx_location, - Extension::Location download_location, + extensions::Extension::Location crx_location, + extensions::Extension::Location download_location, int creation_flags) : ExternalExtensionProviderImpl(service, loader, crx_location, download_location, creation_flags), diff --git a/chrome/browser/extensions/default_apps.h b/chrome/browser/extensions/default_apps.h index 2904114..254fa86 100644 --- a/chrome/browser/extensions/default_apps.h +++ b/chrome/browser/extensions/default_apps.h @@ -12,6 +12,10 @@ class PrefService; class Profile; +namespace extensions { +class Extension; +} + // Functions and types related to installing default apps. namespace default_apps { @@ -36,8 +40,8 @@ class Provider : public ExternalExtensionProviderImpl { Provider(Profile* profile, VisitorInterface* service, ExternalExtensionLoader* loader, - Extension::Location crx_location, - Extension::Location download_location, + extensions::Extension::Location crx_location, + extensions::Extension::Location download_location, int creation_flags); // ExternalExtensionProviderImpl overrides: diff --git a/chrome/browser/extensions/execute_code_in_tab_function.cc b/chrome/browser/extensions/execute_code_in_tab_function.cc index d50afc6..9786b9c 100644 --- a/chrome/browser/extensions/execute_code_in_tab_function.cc +++ b/chrome/browser/extensions/execute_code_in_tab_function.cc @@ -157,7 +157,7 @@ void ExecuteCodeInTabFunction::OnExecuteCodeFinished(bool success, void ExecuteCodeInTabFunction::DidLoadFile(bool success, const std::string& data) { std::string function_name = name(); - const Extension* extension = GetExtension(); + const extensions::Extension* extension = GetExtension(); // Check if the file is CSS and needs localization. if (success && @@ -231,7 +231,7 @@ bool ExecuteCodeInTabFunction::Execute(const std::string& code_string) { return false; } - const Extension* extension = GetExtension(); + const extensions::Extension* extension = GetExtension(); if (!extension) { SendResponse(false); return false; diff --git a/chrome/browser/extensions/extension_activity_log.cc b/chrome/browser/extensions/extension_activity_log.cc index 85ad4d2..ea9a048 100644 --- a/chrome/browser/extensions/extension_activity_log.cc +++ b/chrome/browser/extensions/extension_activity_log.cc @@ -23,7 +23,7 @@ ExtensionActivityLog* ExtensionActivityLog::GetInstance() { } void ExtensionActivityLog::AddObserver( - const Extension* extension, + const extensions::Extension* extension, ExtensionActivityLog::Observer* observer) { base::AutoLock scoped_lock(lock_); @@ -35,7 +35,7 @@ void ExtensionActivityLog::AddObserver( } void ExtensionActivityLog::RemoveObserver( - const Extension* extension, + const extensions::Extension* extension, ExtensionActivityLog::Observer* observer) { base::AutoLock scoped_lock(lock_); @@ -43,8 +43,9 @@ void ExtensionActivityLog::RemoveObserver( observers_[extension]->RemoveObserver(observer); } } - -bool ExtensionActivityLog::HasObservers(const Extension* extension) const { +// Extension* +bool ExtensionActivityLog::HasObservers( + const extensions::Extension* extension) const { base::AutoLock scoped_lock(lock_); // We also return true if extension activity logging is enabled since in that @@ -52,7 +53,7 @@ bool ExtensionActivityLog::HasObservers(const Extension* extension) const { return observers_.count(extension) > 0 || log_activity_to_stdout_; } -void ExtensionActivityLog::Log(const Extension* extension, +void ExtensionActivityLog::Log(const extensions::Extension* extension, Activity activity, const std::string& msg) const { base::AutoLock scoped_lock(lock_); diff --git a/chrome/browser/extensions/extension_activity_log.h b/chrome/browser/extensions/extension_activity_log.h index 1c18077..ffef1d6 100644 --- a/chrome/browser/extensions/extension_activity_log.h +++ b/chrome/browser/extensions/extension_activity_log.h @@ -12,7 +12,9 @@ #include "base/observer_list_threadsafe.h" #include "base/synchronization/lock.h" +namespace extensions { class Extension; +} // A utility for tracing interesting activity for each extension. class ExtensionActivityLog { @@ -25,7 +27,7 @@ class ExtensionActivityLog { // Observers can listen for activity events. class Observer { public: - virtual void OnExtensionActivity(const Extension* extension, + virtual void OnExtensionActivity(const extensions::Extension* extension, Activity activity, const std::string& msg) = 0; }; @@ -34,14 +36,15 @@ class ExtensionActivityLog { static ExtensionActivityLog* GetInstance(); // Add/remove observer. - void AddObserver(const Extension* extension, Observer* observer); - void RemoveObserver(const Extension* extension, Observer* observer); + void AddObserver(const extensions::Extension* extension, Observer* observer); + void RemoveObserver(const extensions::Extension* extension, + Observer* observer); // Check for the existence observer list by extension_id. - bool HasObservers(const Extension* extension) const; + bool HasObservers(const extensions::Extension* extension) const; // Log |activity| for |extension|. - void Log(const Extension* extension, + void Log(const extensions::Extension* extension, Activity activity, const std::string& msg) const; @@ -59,7 +62,8 @@ class ExtensionActivityLog { bool log_activity_to_stdout_; typedef ObserverListThreadSafe<Observer> ObserverList; - typedef std::map<const Extension*, scoped_refptr<ObserverList> > ObserverMap; + typedef std::map<const extensions::Extension*, scoped_refptr<ObserverList> > + ObserverMap; // A map of extensions to activity observers for that extension. ObserverMap observers_; diff --git a/chrome/browser/extensions/extension_apitest.cc b/chrome/browser/extensions/extension_apitest.cc index cce2618..6678901 100644 --- a/chrome/browser/extensions/extension_apitest.cc +++ b/chrome/browser/extensions/extension_apitest.cc @@ -174,7 +174,7 @@ bool ExtensionApiTest::RunExtensionTestImpl(const char* extension_name, DCHECK(!std::string(extension_name).empty() || !page_url.empty()) << "extension_name and page_url cannot both be empty"; - const Extension* extension = NULL; + const extensions::Extension* extension = NULL; if (!std::string(extension_name).empty()) { FilePath extension_path = test_data_dir_.AppendASCII(extension_name); if (load_as_component) { @@ -226,15 +226,15 @@ bool ExtensionApiTest::RunExtensionTestImpl(const char* extension_name, } // Test that exactly one extension is loaded, and return it. -const Extension* ExtensionApiTest::GetSingleLoadedExtension() { +const extensions::Extension* ExtensionApiTest::GetSingleLoadedExtension() { ExtensionService* service = browser()->profile()->GetExtensionService(); - const Extension* extension = NULL; + const extensions::Extension* extension = NULL; for (ExtensionSet::const_iterator it = service->extensions()->begin(); it != service->extensions()->end(); ++it) { // Ignore any component extensions. They are automatically loaded into all // profiles and aren't the extension we're looking for here. - if ((*it)->location() == Extension::COMPONENT) + if ((*it)->location() == extensions::Extension::COMPONENT) continue; if (extension != NULL) { diff --git a/chrome/browser/extensions/extension_apitest.h b/chrome/browser/extensions/extension_apitest.h index 28ec8b4..9e34373 100644 --- a/chrome/browser/extensions/extension_apitest.h +++ b/chrome/browser/extensions/extension_apitest.h @@ -14,13 +14,16 @@ #include "chrome/browser/extensions/extension_browsertest.h" #include "content/public/browser/notification_registrar.h" +class FilePath; + +namespace extensions { +class Extension; +} + namespace ui_test_utils { class TestWebSocketServer; } -class Extension; -class FilePath; - // The general flow of these API tests should work like this: // (1) Setup initial browser state (e.g. create some bookmarks for the // bookmark test) @@ -148,7 +151,7 @@ class ExtensionApiTest : public ExtensionBrowserTest { // Test that exactly one extension loaded. If so, return a pointer to // the extension. If not, return NULL and set message_. - const Extension* GetSingleLoadedExtension(); + const extensions::Extension* GetSingleLoadedExtension(); // All extensions tested by ExtensionApiTest are in the "api_test" dir. virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE; diff --git a/chrome/browser/extensions/extension_browser_event_router.cc b/chrome/browser/extensions/extension_browser_event_router.cc index d39810e..8be4717 100644 --- a/chrome/browser/extensions/extension_browser_event_router.cc +++ b/chrome/browser/extensions/extension_browser_event_router.cc @@ -676,7 +676,7 @@ void ExtensionBrowserEventRouter::ExtensionActionExecuted( Profile* profile, const std::string& extension_id, TabContentsWrapper* tab_contents) { - const Extension* extension = + const extensions::Extension* extension = profile->GetExtensionService()->GetExtensionById(extension_id, false); if (!extension) return; diff --git a/chrome/browser/extensions/extension_browsertest.cc b/chrome/browser/extensions/extension_browsertest.cc index a75649e..5297e1d 100644 --- a/chrome/browser/extensions/extension_browsertest.cc +++ b/chrome/browser/extensions/extension_browsertest.cc @@ -32,6 +32,8 @@ #include "content/public/browser/notification_service.h" #include "content/public/browser/render_view_host.h" +using extensions::Extension; + ExtensionBrowserTest::ExtensionBrowserTest() : loaded_(false), installed_(false), diff --git a/chrome/browser/extensions/extension_browsertest.h b/chrome/browser/extensions/extension_browsertest.h index 2489445..19141d5 100644 --- a/chrome/browser/extensions/extension_browsertest.h +++ b/chrome/browser/extensions/extension_browsertest.h @@ -17,7 +17,9 @@ #include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_types.h" +namespace extensions { class Extension; +} // Base class for extension browser tests. Provides utilities for loading, // unloading, and installing extensions. @@ -30,17 +32,17 @@ class ExtensionBrowserTest // InProcessBrowserTest virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE; - const Extension* LoadExtension(const FilePath& path); + const extensions::Extension* LoadExtension(const FilePath& path); // Same as above, but enables the extension in incognito mode first. - const Extension* LoadExtensionIncognito(const FilePath& path); + const extensions::Extension* LoadExtensionIncognito(const FilePath& path); - const Extension* LoadExtensionWithOptions(const FilePath& path, + const extensions::Extension* LoadExtensionWithOptions(const FilePath& path, bool incognito_enabled, bool fileaccess_enabled); // Loads extension and imitates that it is a component extension. - const Extension* LoadExtensionAsComponent(const FilePath& path); + const extensions::Extension* LoadExtensionAsComponent(const FilePath& path); // Pack the extension in |dir_path| into a crx file and return its path. // Return an empty FilePath if there were errors. @@ -59,18 +61,20 @@ class ExtensionBrowserTest // disabled, if negative). // 1 means you expect a new install, 0 means you expect an upgrade, -1 means // you expect a failed upgrade. - const Extension* InstallExtension(const FilePath& path, int expected_change) { + const extensions::Extension* InstallExtension(const FilePath& path, + int expected_change) { return InstallOrUpdateExtension("", path, INSTALL_UI_TYPE_NONE, expected_change); } // Installs extension as if it came from the Chrome Webstore. - const Extension* InstallExtensionFromWebstore( + const extensions::Extension* InstallExtensionFromWebstore( const FilePath& path, int expected_change); // Same as above but passes an id to CrxInstaller and does not allow a // privilege increase. - const Extension* UpdateExtension(const std::string& id, const FilePath& path, + const extensions::Extension* UpdateExtension(const std::string& id, + const FilePath& path, int expected_change) { return InstallOrUpdateExtension(id, path, INSTALL_UI_TYPE_NONE, expected_change); @@ -78,20 +82,22 @@ class ExtensionBrowserTest // Same as |InstallExtension| but with the normal extension UI showing up // (for e.g. info bar on success). - const Extension* InstallExtensionWithUI(const FilePath& path, - int expected_change) { + const extensions::Extension* InstallExtensionWithUI(const FilePath& path, + int expected_change) { return InstallOrUpdateExtension("", path, INSTALL_UI_TYPE_NORMAL, expected_change); } - const Extension* InstallExtensionWithUIAutoConfirm(const FilePath& path, - int expected_change, - Profile* profile) { + + const extensions::Extension* InstallExtensionWithUIAutoConfirm( + const FilePath& path, + int expected_change, + Profile* profile) { return InstallOrUpdateExtension("", path, INSTALL_UI_TYPE_AUTO_CONFIRM, expected_change, profile, false); } // Begins install process but simulates a user cancel. - const Extension* StartInstallButCancel(const FilePath& path) { + const extensions::Extension* StartInstallButCancel(const FilePath& path) { return InstallOrUpdateExtension("", path, INSTALL_UI_TYPE_CANCEL, 0); } @@ -157,16 +163,16 @@ class ExtensionBrowserTest INSTALL_UI_TYPE_AUTO_CONFIRM, }; - const Extension* InstallOrUpdateExtension(const std::string& id, - const FilePath& path, - InstallUIType ui_type, - int expected_change); - const Extension* InstallOrUpdateExtension(const std::string& id, - const FilePath& path, - InstallUIType ui_type, - int expected_change, - Profile* profile, - bool from_webstore); + const extensions::Extension* InstallOrUpdateExtension(const std::string& id, + const FilePath& path, + InstallUIType ui_type, + int expected_change); + const extensions::Extension* InstallOrUpdateExtension(const std::string& id, + const FilePath& path, + InstallUIType ui_type, + int expected_change, + Profile* profile, + bool from_webstore); bool WaitForExtensionViewsToLoad(); diff --git a/chrome/browser/extensions/extension_browsertests_misc.cc b/chrome/browser/extensions/extension_browsertests_misc.cc index 78481b0..0e27f41 100644 --- a/chrome/browser/extensions/extension_browsertests_misc.cc +++ b/chrome/browser/extensions/extension_browsertests_misc.cc @@ -34,6 +34,7 @@ using content::NavigationController; using content::WebContents; +using extensions::Extension; const std::string kSubscribePage = "/subscribe.html"; const std::string kFeedPage = "files/feeds/feed.html"; diff --git a/chrome/browser/extensions/extension_context_menu_browsertest.cc b/chrome/browser/extensions/extension_context_menu_browsertest.cc index 83bb8bb..c4e06d4 100644 --- a/chrome/browser/extensions/extension_context_menu_browsertest.cc +++ b/chrome/browser/extensions/extension_context_menu_browsertest.cc @@ -156,7 +156,7 @@ class ExtensionContextMenuBrowserTest : public ExtensionBrowserTest { // Returns a pointer to the currently loaded extension with |name|, or null // if not found. - const Extension* GetExtensionNamed(std::string name) { + const extensions::Extension* GetExtensionNamed(std::string name) { const ExtensionSet* extensions = browser()->profile()->GetExtensionService()->extensions(); ExtensionSet::const_iterator i; @@ -357,7 +357,7 @@ static void VerifyMenuForSeparatorsTest(const MenuModel& menu) { IN_PROC_BROWSER_TEST_F(ExtensionContextMenuBrowserTest, Separators) { // Load the extension. ASSERT_TRUE(LoadContextMenuExtension("separators")); - const Extension* extension = GetExtensionNamed("Separators Test"); + const extensions::Extension* extension = GetExtensionNamed("Separators Test"); ASSERT_TRUE(extension != NULL); // Navigate to test1.html inside the extension, which should create a bunch diff --git a/chrome/browser/extensions/extension_context_menu_model.cc b/chrome/browser/extensions/extension_context_menu_model.cc index f336b7c..92eceed 100644 --- a/chrome/browser/extensions/extension_context_menu_model.cc +++ b/chrome/browser/extensions/extension_context_menu_model.cc @@ -23,6 +23,7 @@ using content::OpenURLParams; using content::Referrer; using content::WebContents; +using extensions::Extension; enum MenuEntries { NAME = 0, diff --git a/chrome/browser/extensions/extension_context_menu_model.h b/chrome/browser/extensions/extension_context_menu_model.h index 059907fe..1f0134c 100644 --- a/chrome/browser/extensions/extension_context_menu_model.h +++ b/chrome/browser/extensions/extension_context_menu_model.h @@ -13,10 +13,13 @@ #include "ui/base/models/simple_menu_model.h" class Browser; -class Extension; class ExtensionAction; class Profile; +namespace extensions { +class Extension; +} + // The menu model for the context menu for extension action icons (browser and // page actions). class ExtensionContextMenuModel @@ -26,7 +29,8 @@ class ExtensionContextMenuModel public ExtensionUninstallDialog::Delegate { public: // Creates a menu model for the given extension action. - ExtensionContextMenuModel(const Extension* extension, Browser* browser); + ExtensionContextMenuModel(const extensions::Extension* extension, + Browser* browser); // SimpleMenuModel::Delegate overrides. virtual bool IsCommandIdChecked(int command_id) const OVERRIDE; @@ -48,7 +52,7 @@ class ExtensionContextMenuModel // Gets the extension we are displaying the menu for. Returns NULL if the // extension has been uninstalled and no longer exists. - const Extension* GetExtension() const; + const extensions::Extension* GetExtension() const; // A copy of the extension's id. std::string extension_id_; diff --git a/chrome/browser/extensions/extension_crash_recovery_browsertest.cc b/chrome/browser/extensions/extension_crash_recovery_browsertest.cc index 3e69eb0..2341cf2 100644 --- a/chrome/browser/extensions/extension_crash_recovery_browsertest.cc +++ b/chrome/browser/extensions/extension_crash_recovery_browsertest.cc @@ -27,6 +27,7 @@ using content::NavigationController; using content::WebContents; +using extensions::Extension; class ExtensionCrashRecoveryTest : public ExtensionBrowserTest { protected: diff --git a/chrome/browser/extensions/extension_creator.cc b/chrome/browser/extensions/extension_creator.cc index 5550c2f..0aaa77f 100644 --- a/chrome/browser/extensions/extension_creator.cc +++ b/chrome/browser/extensions/extension_creator.cc @@ -23,6 +23,8 @@ #include "grit/generated_resources.h" #include "ui/base/l10n/l10n_util.h" +using extensions::Extension; + namespace { const int kRSAKeySize = 1024; }; diff --git a/chrome/browser/extensions/extension_debugger_api.cc b/chrome/browser/extensions/extension_debugger_api.cc index 1330c3d..da4a530 100644 --- a/chrome/browser/extensions/extension_debugger_api.cc +++ b/chrome/browser/extensions/extension_debugger_api.cc @@ -269,7 +269,8 @@ void ExtensionDevToolsClientHost::Observe( const content::NotificationDetails& details) { if (type == chrome::NOTIFICATION_EXTENSION_UNLOADED) { std::string id = - content::Details<UnloadedExtensionInfo>(details)->extension->id(); + content::Details<extensions::UnloadedExtensionInfo>(details)-> + extension->id(); if (id == extension_id_) Close(); } else { diff --git a/chrome/browser/extensions/extension_disabled_ui.cc b/chrome/browser/extensions/extension_disabled_ui.cc index 3f37118..e1af856 100644 --- a/chrome/browser/extensions/extension_disabled_ui.cc +++ b/chrome/browser/extensions/extension_disabled_ui.cc @@ -33,6 +33,8 @@ #include "grit/theme_resources.h" #include "ui/base/l10n/l10n_util.h" +using extensions::Extension; + namespace { static base::LazyInstance< @@ -290,8 +292,8 @@ void ExtensionDisabledGlobalError::Observe( extension = content::Details<const Extension>(details).ptr(); } else { DCHECK_EQ(chrome::NOTIFICATION_EXTENSION_UNLOADED, type); - UnloadedExtensionInfo* info = - content::Details<UnloadedExtensionInfo>(details).ptr(); + extensions::UnloadedExtensionInfo* info = + content::Details<extensions::UnloadedExtensionInfo>(details).ptr(); extension = info->extension; } if (extension == extension_) { diff --git a/chrome/browser/extensions/extension_disabled_ui.h b/chrome/browser/extensions/extension_disabled_ui.h index f033b8e..1899cf3 100644 --- a/chrome/browser/extensions/extension_disabled_ui.h +++ b/chrome/browser/extensions/extension_disabled_ui.h @@ -6,12 +6,13 @@ #define CHROME_BROWSER_EXTENSIONS_EXTENSION_DISABLED_UI_H_ #pragma once -class Extension; class ExtensionService; class Profile; namespace extensions { +class Extension; + // Adds a global error to inform the user that an extension was // disabled after upgrading to higher permissions. void AddExtensionDisabledError(ExtensionService* service, diff --git a/chrome/browser/extensions/extension_disabled_ui_browsertest.cc b/chrome/browser/extensions/extension_disabled_ui_browsertest.cc index 8d30040..9a2889b1c 100644 --- a/chrome/browser/extensions/extension_disabled_ui_browsertest.cc +++ b/chrome/browser/extensions/extension_disabled_ui_browsertest.cc @@ -15,6 +15,8 @@ #include "chrome/browser/ui/global_error_service_factory.h" #include "chrome/common/extensions/extension.h" +using extensions::Extension; + class ExtensionDisabledGlobalErrorTest : public ExtensionBrowserTest { protected: void SetUpOnMainThread() { diff --git a/chrome/browser/extensions/extension_event_router.cc b/chrome/browser/extensions/extension_event_router.cc index 8b27f22..041d566 100644 --- a/chrome/browser/extensions/extension_event_router.cc +++ b/chrome/browser/extensions/extension_event_router.cc @@ -31,6 +31,7 @@ #include "content/public/browser/render_process_host.h" using content::BrowserThread; +using extensions::Extension; using extensions::ExtensionAPI; namespace { @@ -487,8 +488,8 @@ void ExtensionEventRouter::Observe( } case chrome::NOTIFICATION_EXTENSION_UNLOADED: { // Remove all registered lazy listeners from our cache. - UnloadedExtensionInfo* unloaded = - content::Details<UnloadedExtensionInfo>(details).ptr(); + extensions::UnloadedExtensionInfo* unloaded = + content::Details<extensions::UnloadedExtensionInfo>(details).ptr(); ListenerProcess lazy_listener(NULL, unloaded->extension->id()); for (ListenerMap::iterator it = lazy_listeners_.begin(); it != lazy_listeners_.end(); ++it) { diff --git a/chrome/browser/extensions/extension_event_router.h b/chrome/browser/extensions/extension_event_router.h index faf80e9..42a649c 100644 --- a/chrome/browser/extensions/extension_event_router.h +++ b/chrome/browser/extensions/extension_event_router.h @@ -18,7 +18,6 @@ #include "ipc/ipc_message.h" class GURL; -class Extension; class ExtensionHost; class ExtensionDevToolsManager; class Profile; @@ -27,6 +26,10 @@ namespace content { class RenderProcessHost; } +namespace extensions { +class Extension; +} + class ExtensionEventRouter : public content::NotificationObserver { public: // These constants convey the state of our knowledge of whether we're in @@ -163,7 +166,7 @@ class ExtensionEventRouter : public content::NotificationObserver { // the event crosses the incognito boundary. bool CanDispatchEventToProfile( Profile* profile, - const Extension* extension, + const extensions::Extension* extension, const linked_ptr<ExtensionEvent>& event, const std::string** event_args); @@ -179,12 +182,13 @@ class ExtensionEventRouter : public content::NotificationObserver { // dispatch an event. void MaybeLoadLazyBackgroundPage( Profile* profile, - const Extension* extension, + const extensions::Extension* extension, const linked_ptr<ExtensionEvent>& event); // Track of the number of dispatched events that have not yet sent an // ACK from the renderer. - void IncrementInFlightEvents(Profile* profile, const Extension* extension); + void IncrementInFlightEvents(Profile* profile, + const extensions::Extension* extension); void DispatchPendingEvent(const linked_ptr<ExtensionEvent>& event, ExtensionHost* host); diff --git a/chrome/browser/extensions/extension_function.h b/chrome/browser/extensions/extension_function.h index d943a31b..caef240 100644 --- a/chrome/browser/extensions/extension_function.h +++ b/chrome/browser/extensions/extension_function.h @@ -124,8 +124,10 @@ class ExtensionFunction void set_profile_id(void* profile_id) { profile_id_ = profile_id; } void* profile_id() const { return profile_id_; } - void set_extension(const Extension* extension) { extension_ = extension; } - const Extension* GetExtension() const { return extension_.get(); } + void set_extension(const extensions::Extension* extension) { + extension_ = extension; + } + const extensions::Extension* GetExtension() const { return extension_.get(); } const std::string& extension_id() const { return extension_->id(); } void set_request_id(int request_id) { request_id_ = request_id; } @@ -181,7 +183,7 @@ class ExtensionFunction void* profile_id_; // The extension that called this function. - scoped_refptr<const Extension> extension_; + scoped_refptr<const extensions::Extension> extension_; // The name of this function. std::string name_; diff --git a/chrome/browser/extensions/extension_function_dispatcher.cc b/chrome/browser/extensions/extension_function_dispatcher.cc index 113fcbf..3bde203 100644 --- a/chrome/browser/extensions/extension_function_dispatcher.cc +++ b/chrome/browser/extensions/extension_function_dispatcher.cc @@ -34,6 +34,7 @@ #include "third_party/skia/include/core/SkBitmap.h" #include "webkit/glue/resource_type.h" +using extensions::Extension; using extensions::ExtensionAPI; using content::RenderViewHost; using WebKit::WebSecurityOrigin; diff --git a/chrome/browser/extensions/extension_function_dispatcher.h b/chrome/browser/extensions/extension_function_dispatcher.h index 5278171..ed6548a 100644 --- a/chrome/browser/extensions/extension_function_dispatcher.h +++ b/chrome/browser/extensions/extension_function_dispatcher.h @@ -15,7 +15,6 @@ #include "googleurl/src/gurl.h" class ChromeRenderMessageFilter; -class Extension; class ExtensionFunction; class ExtensionWindowController; class ExtensionInfoMap; @@ -28,6 +27,7 @@ class WebContents; } namespace extensions { +class Extension; class ExtensionAPI; class ProcessMap; } @@ -104,7 +104,7 @@ class ExtensionFunctionDispatcher // Called when an ExtensionFunction is done executing, after it has sent // a response (if any) to the extension. - void OnExtensionFunctionCompleted(const Extension* extension); + void OnExtensionFunctionCompleted(const extensions::Extension* extension); // The profile that this dispatcher is associated with. Profile* profile() { return profile_; } @@ -115,7 +115,7 @@ class ExtensionFunctionDispatcher // Does not set subclass properties, or include_incognito. static ExtensionFunction* CreateExtensionFunction( const ExtensionHostMsg_Request_Params& params, - const Extension* extension, + const extensions::Extension* extension, int requesting_process_id, const extensions::ProcessMap& process_map, extensions::ExtensionAPI* api, diff --git a/chrome/browser/extensions/extension_function_test_utils.cc b/chrome/browser/extensions/extension_function_test_utils.cc index 8b33ed1..2f0fc46 100644 --- a/chrome/browser/extensions/extension_function_test_utils.cc +++ b/chrome/browser/extensions/extension_function_test_utils.cc @@ -17,6 +17,7 @@ #include "testing/gtest/include/gtest/gtest.h" using content::WebContents; +using extensions::Extension; namespace { diff --git a/chrome/browser/extensions/extension_function_test_utils.h b/chrome/browser/extensions/extension_function_test_utils.h index 27336a5..3ae6db8 100644 --- a/chrome/browser/extensions/extension_function_test_utils.h +++ b/chrome/browser/extensions/extension_function_test_utils.h @@ -13,7 +13,6 @@ class AsyncExtensionFunction; class Browser; -class Extension; class UIThreadExtensionFunction; namespace base { @@ -22,6 +21,10 @@ class DictionaryValue; class ListValue; } +namespace extensions { +class Extension; +} + namespace extension_function_test_utils { // Parse JSON and return as the specified type, or NULL if the JSON is invalid @@ -45,12 +48,12 @@ base::ListValue* ToList(base::Value* val); // Creates an extension instance that can be attached to an ExtensionFunction // before running it. -scoped_refptr<Extension> CreateEmptyExtension(); +scoped_refptr<extensions::Extension> CreateEmptyExtension(); // Creates an extension instance with a specified location that can be attached // to an ExtensionFunction before running. -scoped_refptr<Extension> CreateEmptyExtensionWithLocation( - Extension::Location location); +scoped_refptr<extensions::Extension> CreateEmptyExtensionWithLocation( + extensions::Extension::Location location); enum RunFunctionFlags { NONE = 0, diff --git a/chrome/browser/extensions/extension_global_error.cc b/chrome/browser/extensions/extension_global_error.cc index 3a69833..9217de4 100644 --- a/chrome/browser/extensions/extension_global_error.cc +++ b/chrome/browser/extensions/extension_global_error.cc @@ -13,6 +13,8 @@ #include "grit/generated_resources.h" #include "ui/base/l10n/l10n_util.h" +using extensions::ExtensionIdSet; + ExtensionGlobalError::ExtensionGlobalError(ExtensionService* extension_service) : extension_service_(extension_service), external_extension_ids_(new ExtensionIdSet), @@ -75,7 +77,8 @@ string16 ExtensionGlobalError::GenerateMessageSection( for (ExtensionIdSet::const_iterator iter = extensions->begin(); iter != extensions->end(); ++iter) { - const Extension* e = extension_service_->GetExtensionById(*iter, true); + const extensions::Extension* e = extension_service_->GetExtensionById(*iter, + true); message += l10n_util::GetStringFUTF16(template_message_id, string16(ASCIIToUTF16(e->name()))); } diff --git a/chrome/browser/extensions/extension_global_error.h b/chrome/browser/extensions/extension_global_error.h index 7a45468..1b02e88 100644 --- a/chrome/browser/extensions/extension_global_error.h +++ b/chrome/browser/extensions/extension_global_error.h @@ -29,15 +29,15 @@ class ExtensionGlobalError : public GlobalError { // Returns sets replaying the IDs that have been added with the // Add[...]Extension methods. - const ExtensionIdSet* get_external_extension_ids() const { + const extensions::ExtensionIdSet* get_external_extension_ids() const { return external_extension_ids_.get(); } - const ExtensionIdSet* get_blacklisted_extension_ids() const { + const extensions::ExtensionIdSet* get_blacklisted_extension_ids() const { return blacklisted_extension_ids_.get(); } - const ExtensionIdSet* get_orphaned_extension_ids() const { + const extensions::ExtensionIdSet* get_orphaned_extension_ids() const { return orphaned_extension_ids_.get(); } @@ -59,14 +59,14 @@ class ExtensionGlobalError : public GlobalError { private: bool should_delete_self_on_close_; ExtensionService* extension_service_; - scoped_ptr<ExtensionIdSet> external_extension_ids_; - scoped_ptr<ExtensionIdSet> blacklisted_extension_ids_; - scoped_ptr<ExtensionIdSet> orphaned_extension_ids_; + scoped_ptr<extensions::ExtensionIdSet> external_extension_ids_; + scoped_ptr<extensions::ExtensionIdSet> blacklisted_extension_ids_; + scoped_ptr<extensions::ExtensionIdSet> orphaned_extension_ids_; string16 message_; // Displayed in the body of the alert. // For a given set of extension IDs, generates appropriate text // describing what the user needs to know about them. - string16 GenerateMessageSection(const ExtensionIdSet* extensions, + string16 GenerateMessageSection(const extensions::ExtensionIdSet* extensions, int template_message_id); // Generates the message displayed in the body of the alert. diff --git a/chrome/browser/extensions/extension_host.cc b/chrome/browser/extensions/extension_host.cc index e5088af..ea90c45 100644 --- a/chrome/browser/extensions/extension_host.cc +++ b/chrome/browser/extensions/extension_host.cc @@ -123,7 +123,7 @@ class ExtensionHost::ProcessCreationQueue { //////////////// // ExtensionHost -ExtensionHost::ExtensionHost(const Extension* extension, +ExtensionHost::ExtensionHost(const extensions::Extension* extension, SiteInstance* site_instance, const GURL& url, content::ViewType host_type) @@ -245,7 +245,7 @@ void ExtensionHost::LoadInitialURL() { !profile_->GetExtensionService()->IsBackgroundPageReady(extension_)) { // Make sure the background page loads before any others. registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_BACKGROUND_PAGE_READY, - content::Source<Extension>(extension_)); + content::Source<extensions::Extension>(extension_)); return; } @@ -276,7 +276,8 @@ void ExtensionHost::Observe(int type, // when multiple ExtensionHost objects pointing to the same Extension are // present. if (extension_ == - content::Details<UnloadedExtensionInfo>(details)->extension) { + content::Details<extensions::UnloadedExtensionInfo>( + details)->extension) { extension_ = NULL; } break; diff --git a/chrome/browser/extensions/extension_host.h b/chrome/browser/extensions/extension_host.h index a9aa8e2..4350872 100644 --- a/chrome/browser/extensions/extension_host.h +++ b/chrome/browser/extensions/extension_host.h @@ -31,7 +31,6 @@ #endif class Browser; -class Extension; class ExtensionWindowController; class PrefsTabHelper; @@ -41,6 +40,10 @@ class RenderWidgetHostView; class SiteInstance; } +namespace extensions { +class Extension; +} + // This class is the browser component of an extension component's RenderView. // It handles setting up the renderer process, if needed, with special // privileges available to extensions. It may have a view to be shown in the @@ -63,7 +66,7 @@ class ExtensionHost : public content::WebContentsDelegate, typedef ExtensionViewAndroid PlatformExtensionView; #endif - ExtensionHost(const Extension* extension, + ExtensionHost(const extensions::Extension* extension, content::SiteInstance* site_instance, const GURL& url, content::ViewType host_type); virtual ~ExtensionHost(); @@ -92,7 +95,7 @@ class ExtensionHost : public content::WebContentsDelegate, // instantiate Browser objects. void CreateView(Browser* browser); - const Extension* extension() const { return extension_; } + const extensions::Extension* extension() const { return extension_; } const std::string& extension_id() const { return extension_id_; } content::WebContents* host_contents() const { return host_contents_.get(); } content::RenderViewHost* render_view_host() const; @@ -199,7 +202,7 @@ class ExtensionHost : public content::WebContentsDelegate, bool is_background_page() const { return !view(); } // The extension that we're hosting in this view. - const Extension* extension_; + const extensions::Extension* extension_; // Id of extension that we're hosting in this view. const std::string extension_id_; diff --git a/chrome/browser/extensions/extension_host_mac.h b/chrome/browser/extensions/extension_host_mac.h index 1ee25a6..4f655e4 100644 --- a/chrome/browser/extensions/extension_host_mac.h +++ b/chrome/browser/extensions/extension_host_mac.h @@ -8,11 +8,15 @@ #include "chrome/browser/extensions/extension_host.h" +namespace extensions { +class Extension; +} + // TODO(mpcomplete): I don't know what this does or if it is needed anymore, // now that ExtensionHost is restructured to rely on WebContents. class ExtensionHostMac : public ExtensionHost { public: - ExtensionHostMac(const Extension* extension, + ExtensionHostMac(const extensions::Extension* extension, content::SiteInstance* site_instance, const GURL& url, content::ViewType host_type) : ExtensionHost(extension, site_instance, url, host_type) {} diff --git a/chrome/browser/extensions/extension_icon_manager.cc b/chrome/browser/extensions/extension_icon_manager.cc index 37d17fe..c81fee6 100644 --- a/chrome/browser/extensions/extension_icon_manager.cc +++ b/chrome/browser/extensions/extension_icon_manager.cc @@ -46,7 +46,7 @@ ExtensionIconManager::ExtensionIconManager() ExtensionIconManager::~ExtensionIconManager() { } -void ExtensionIconManager::LoadIcon(const Extension* extension) { +void ExtensionIconManager::LoadIcon(const extensions::Extension* extension) { ExtensionResource icon_resource = extension->GetIconResource( ExtensionIconSet::EXTENSION_ICON_BITTY, ExtensionIconSet::MATCH_BIGGER); if (!icon_resource.extension_root().empty()) { diff --git a/chrome/browser/extensions/extension_icon_manager.h b/chrome/browser/extensions/extension_icon_manager.h index 4596d12..d7863db 100644 --- a/chrome/browser/extensions/extension_icon_manager.h +++ b/chrome/browser/extensions/extension_icon_manager.h @@ -15,7 +15,9 @@ #include "third_party/skia/include/core/SkBitmap.h" #include "ui/gfx/insets.h" +namespace extensions { class Extension; +} class ExtensionIconManager : public ImageLoadingTracker::Observer { public: @@ -23,7 +25,7 @@ class ExtensionIconManager : public ImageLoadingTracker::Observer { virtual ~ExtensionIconManager(); // Start loading the icon for the given extension. - void LoadIcon(const Extension* extension); + void LoadIcon(const extensions::Extension* extension); // This returns a bitmap of width/height kFaviconSize, loaded either from an // entry specified in the extension's 'icon' section of the manifest, or a diff --git a/chrome/browser/extensions/extension_icon_manager_unittest.cc b/chrome/browser/extensions/extension_icon_manager_unittest.cc index b058153..615ae8d 100644 --- a/chrome/browser/extensions/extension_icon_manager_unittest.cc +++ b/chrome/browser/extensions/extension_icon_manager_unittest.cc @@ -15,6 +15,7 @@ #include "ui/gfx/skia_util.h" using content::BrowserThread; +using extensions::Extension; // Our test class that takes care of managing the necessary threads for loading // extension icons, and waiting for those loads to happen. diff --git a/chrome/browser/extensions/extension_info_map.cc b/chrome/browser/extensions/extension_info_map.cc index 8db94d5..8401ceb 100644 --- a/chrome/browser/extensions/extension_info_map.cc +++ b/chrome/browser/extensions/extension_info_map.cc @@ -10,6 +10,7 @@ #include "content/public/browser/browser_thread.h" using content::BrowserThread; +using extensions::Extension; namespace { diff --git a/chrome/browser/extensions/extension_info_map.h b/chrome/browser/extensions/extension_info_map.h index df8a6c5..8a64d55 100644 --- a/chrome/browser/extensions/extension_info_map.h +++ b/chrome/browser/extensions/extension_info_map.h @@ -17,7 +17,9 @@ #include "chrome/common/extensions/extension_constants.h" #include "chrome/common/extensions/extension_set.h" +namespace extensions { class Extension; +} // Contains extension data that needs to be accessed on the IO thread. It can // be created/destroyed on any thread, but all other methods must be called on @@ -34,7 +36,7 @@ class ExtensionInfoMap : public base::RefCountedThreadSafe<ExtensionInfoMap> { const extensions::ProcessMap& process_map() const; // Callback for when new extensions are loaded. - void AddExtension(const Extension* extension, + void AddExtension(const extensions::Extension* extension, base::Time install_time, bool incognito_enabled); @@ -51,7 +53,7 @@ class ExtensionInfoMap : public base::RefCountedThreadSafe<ExtensionInfoMap> { // Returns true if the given extension can see events and data from another // sub-profile (incognito to original profile, or vice versa). - bool CanCrossIncognito(const Extension* extension); + bool CanCrossIncognito(const extensions::Extension* extension); // Adds an entry to process_map_. void RegisterExtensionProcess(const std::string& extension_id, diff --git a/chrome/browser/extensions/extension_info_map_unittest.cc b/chrome/browser/extensions/extension_info_map_unittest.cc index 65d95a6..1317c9e 100644 --- a/chrome/browser/extensions/extension_info_map_unittest.cc +++ b/chrome/browser/extensions/extension_info_map_unittest.cc @@ -15,6 +15,7 @@ #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURL.h" using content::BrowserThread; +using extensions::Extension; using WebKit::WebSecurityOrigin; using WebKit::WebString; diff --git a/chrome/browser/extensions/extension_infobar_delegate.cc b/chrome/browser/extensions/extension_infobar_delegate.cc index 0418d68..8f9d8c7 100644 --- a/chrome/browser/extensions/extension_infobar_delegate.cc +++ b/chrome/browser/extensions/extension_infobar_delegate.cc @@ -18,7 +18,7 @@ ExtensionInfoBarDelegate::ExtensionInfoBarDelegate( Browser* browser, InfoBarTabHelper* infobar_helper, - const Extension* extension, + const extensions::Extension* extension, const GURL& url, int height) : InfoBarDelegate(infobar_helper), @@ -97,7 +97,8 @@ void ExtensionInfoBarDelegate::Observe( } else { DCHECK(type == chrome::NOTIFICATION_EXTENSION_UNLOADED); if (extension_ == - content::Details<UnloadedExtensionInfo>(details)->extension) { + content::Details<extensions::UnloadedExtensionInfo>( + details)->extension) { RemoveSelf(); } } diff --git a/chrome/browser/extensions/extension_infobar_delegate.h b/chrome/browser/extensions/extension_infobar_delegate.h index 0e230e1..a8205bd 100644 --- a/chrome/browser/extensions/extension_infobar_delegate.h +++ b/chrome/browser/extensions/extension_infobar_delegate.h @@ -12,10 +12,13 @@ #include "content/public/browser/notification_registrar.h" class Browser; -class Extension; class ExtensionHost; class GURL; +namespace extensions { +class Extension; +} + // The InfobarDelegate for creating and managing state for the ExtensionInfobar // plus monitor when the extension goes away. class ExtensionInfoBarDelegate : public InfoBarDelegate, @@ -32,11 +35,11 @@ class ExtensionInfoBarDelegate : public InfoBarDelegate, ExtensionInfoBarDelegate(Browser* browser, InfoBarTabHelper* infobar_helper, - const Extension* extension, + const extensions::Extension* extension, const GURL& url, int height); - const Extension* extension() { return extension_; } + const extensions::Extension* extension() { return extension_; } ExtensionHost* extension_host() { return extension_host_.get(); } int height() { return height_; } @@ -70,7 +73,7 @@ class ExtensionInfoBarDelegate : public InfoBarDelegate, // The observer monitoring when the delegate dies. DelegateObserver* observer_; - const Extension* extension_; + const extensions::Extension* extension_; content::NotificationRegistrar registrar_; // The requested height of the infobar (in pixels). diff --git a/chrome/browser/extensions/extension_input_ime_api.cc b/chrome/browser/extensions/extension_input_ime_api.cc index 181d147..0ef52e7 100644 --- a/chrome/browser/extensions/extension_input_ime_api.cc +++ b/chrome/browser/extensions/extension_input_ime_api.cc @@ -326,7 +326,7 @@ void ExtensionInputImeEventRouter::Init() {} bool ExtensionInputImeEventRouter::RegisterIme( Profile* profile, const std::string& extension_id, - const Extension::InputComponentInfo& component) { + const extensions::Extension::InputComponentInfo& component) { VLOG(1) << "RegisterIme: " << extension_id << " id: " << component.id; std::map<std::string, chromeos::InputMethodEngine*>& engine_map = diff --git a/chrome/browser/extensions/extension_input_ime_api.h b/chrome/browser/extensions/extension_input_ime_api.h index ddee364..1220871 100644 --- a/chrome/browser/extensions/extension_input_ime_api.h +++ b/chrome/browser/extensions/extension_input_ime_api.h @@ -31,7 +31,7 @@ class ExtensionInputImeEventRouter { bool RegisterIme(Profile* profile, const std::string& extension_id, - const Extension::InputComponentInfo& component); + const extensions::Extension::InputComponentInfo& component); void UnregisterAllImes(Profile* profile, const std::string& extension_id); chromeos::InputMethodEngine* GetEngine(const std::string& extension_id, const std::string& engine_id); diff --git a/chrome/browser/extensions/extension_install_dialog.h b/chrome/browser/extensions/extension_install_dialog.h index 7ecdc27..9aabe0c 100644 --- a/chrome/browser/extensions/extension_install_dialog.h +++ b/chrome/browser/extensions/extension_install_dialog.h @@ -12,7 +12,6 @@ #include "base/string16.h" #include "chrome/browser/extensions/extension_install_ui.h" -class Extension; class Profile; class SkBitmap; diff --git a/chrome/browser/extensions/extension_install_ui.cc b/chrome/browser/extensions/extension_install_ui.cc index db904af..ad858d3 100644 --- a/chrome/browser/extensions/extension_install_ui.cc +++ b/chrome/browser/extensions/extension_install_ui.cc @@ -51,6 +51,7 @@ using content::WebContents; using extensions::BundleInstaller; +using extensions::Extension; static const int kTitleIds[ExtensionInstallUI::NUM_PROMPT_TYPES] = { 0, // The regular install prompt depends on what's being installed. diff --git a/chrome/browser/extensions/extension_install_ui.h b/chrome/browser/extensions/extension_install_ui.h index 372c627..4f6307d 100644 --- a/chrome/browser/extensions/extension_install_ui.h +++ b/chrome/browser/extensions/extension_install_ui.h @@ -18,7 +18,6 @@ #include "ui/gfx/native_widget_types.h" class Browser; -class Extension; class ExtensionPermissionSet; class MessageLoop; class Profile; @@ -27,11 +26,12 @@ class TabContentsWrapper; namespace base { class DictionaryValue; -} // namespace base +} namespace extensions { class BundleInstaller; -} // namespace extensions +class Extension; +} // Displays all the UI around extension installation. class ExtensionInstallUI : public ImageLoadingTracker::Observer { @@ -92,8 +92,10 @@ class ExtensionInstallUI : public ImageLoadingTracker::Observer { } // Populated for all other types. - const Extension* extension() const { return extension_; } - void set_extension(const Extension* extension) { extension_ = extension; } + const extensions::Extension* extension() const { return extension_; } + void set_extension(const extensions::Extension* extension) { + extension_ = extension; + } const gfx::Image& icon() const { return icon_; } void set_icon(const gfx::Image& icon) { icon_ = icon; } @@ -105,7 +107,7 @@ class ExtensionInstallUI : public ImageLoadingTracker::Observer { std::vector<string16> permissions_; // The extension or bundle being installed. - const Extension* extension_; + const extensions::Extension* extension_; const extensions::BundleInstaller* bundle_; // The icon to be displayed. @@ -138,7 +140,7 @@ class ExtensionInstallUI : public ImageLoadingTracker::Observer { // Creates a dummy extension from the |manifest|, replacing the name and // description with the localizations if provided. - static scoped_refptr<Extension> GetLocalizedExtensionForDisplay( + static scoped_refptr<extensions::Extension> GetLocalizedExtensionForDisplay( const base::DictionaryValue* manifest, const std::string& id, const std::string& localized_name, @@ -173,7 +175,7 @@ class ExtensionInstallUI : public ImageLoadingTracker::Observer { // // We *MUST* eventually call either Proceed() or Abort() on |delegate|. virtual void ConfirmInlineInstall(Delegate* delegate, - const Extension* extension, + const extensions::Extension* extension, SkBitmap* icon, const Prompt& prompt); @@ -182,31 +184,34 @@ class ExtensionInstallUI : public ImageLoadingTracker::Observer { // // We *MUST* eventually call either Proceed() or Abort() on |delegate|. virtual void ConfirmWebstoreInstall(Delegate* delegate, - const Extension* extension, + const extensions::Extension* extension, const SkBitmap* icon); // This is called by the installer to verify whether the installation should // proceed. This is declared virtual for testing. // // We *MUST* eventually call either Proceed() or Abort() on |delegate|. - virtual void ConfirmInstall(Delegate* delegate, const Extension* extension); + virtual void ConfirmInstall(Delegate* delegate, + const extensions::Extension* extension); // This is called by the app handler launcher to verify whether the app // should be re-enabled. This is declared virtual for testing. // // We *MUST* eventually call either Proceed() or Abort() on |delegate|. - virtual void ConfirmReEnable(Delegate* delegate, const Extension* extension); + virtual void ConfirmReEnable(Delegate* delegate, + const extensions::Extension* extension); // This is called by the extension permissions API to verify whether an // extension may be granted additional permissions. // // We *MUST* eventually call either Proceed() or Abort() on |delegate|. virtual void ConfirmPermissions(Delegate* delegate, - const Extension* extension, + const extensions::Extension* extension, const ExtensionPermissionSet* permissions); // Installation was successful. This is declared virtual for testing. - virtual void OnInstallSuccess(const Extension* extension, SkBitmap* icon); + virtual void OnInstallSuccess(const extensions::Extension* extension, + SkBitmap* icon); // Installation failed. This is declared virtual for testing. virtual void OnInstallFailure(const string16& error); @@ -235,7 +240,7 @@ class ExtensionInstallUI : public ImageLoadingTracker::Observer { // theme. static void ShowThemeInfoBar( const std::string& previous_theme_id, bool previous_using_native_theme, - const Extension* new_theme, Profile* profile); + const extensions::Extension* new_theme, Profile* profile); // Sets the icon that will be used in any UI. If |icon| is NULL, or contains // an empty bitmap, then a default icon will be used instead. @@ -253,7 +258,7 @@ class ExtensionInstallUI : public ImageLoadingTracker::Observer { // within its own function due to its platform-specific nature. static InfoBarDelegate* GetNewThemeInstalledInfoBarDelegate( TabContentsWrapper* tab_contents, - const Extension* new_theme, + const extensions::Extension* new_theme, const std::string& previous_theme_id, bool previous_using_native_theme); @@ -268,7 +273,7 @@ class ExtensionInstallUI : public ImageLoadingTracker::Observer { SkBitmap icon_; // The extension we are showing the UI for. - const Extension* extension_; + const extensions::Extension* extension_; // The bundle we are showing the UI for, if type BUNDLE_INSTALL_PROMPT. const extensions::BundleInstaller* bundle_; diff --git a/chrome/browser/extensions/extension_install_ui_browsertest.cc b/chrome/browser/extensions/extension_install_ui_browsertest.cc index 5456236..29415c5 100644 --- a/chrome/browser/extensions/extension_install_ui_browsertest.cc +++ b/chrome/browser/extensions/extension_install_ui_browsertest.cc @@ -17,6 +17,7 @@ #include "content/public/browser/web_contents.h" using content::WebContents; +using extensions::Extension; class ExtensionInstallUIBrowserTest : public ExtensionBrowserTest { public: diff --git a/chrome/browser/extensions/extension_keybinding_apitest.cc b/chrome/browser/extensions/extension_keybinding_apitest.cc index 69f6dc6..b00097d 100644 --- a/chrome/browser/extensions/extension_keybinding_apitest.cc +++ b/chrome/browser/extensions/extension_keybinding_apitest.cc @@ -40,7 +40,7 @@ class KeybindingApiTest : public ExtensionApiTest { IN_PROC_BROWSER_TEST_F(KeybindingApiTest, Basic) { ASSERT_TRUE(test_server()->Start()); ASSERT_TRUE(RunExtensionTest("keybinding/basics")) << message_; - const Extension* extension = GetSingleLoadedExtension(); + const extensions::Extension* extension = GetSingleLoadedExtension(); ASSERT_TRUE(extension) << message_; // Load this extension, which uses the same keybindings but sets the page @@ -87,7 +87,7 @@ IN_PROC_BROWSER_TEST_F(KeybindingApiTest, Basic) { IN_PROC_BROWSER_TEST_F(KeybindingApiTest, PageAction) { ASSERT_TRUE(test_server()->Start()); ASSERT_TRUE(RunExtensionTest("keybinding/page_action")) << message_; - const Extension* extension = GetSingleLoadedExtension(); + const extensions::Extension* extension = GetSingleLoadedExtension(); ASSERT_TRUE(extension) << message_; { diff --git a/chrome/browser/extensions/extension_keybinding_registry.cc b/chrome/browser/extensions/extension_keybinding_registry.cc index f05ce51..a985640 100644 --- a/chrome/browser/extensions/extension_keybinding_registry.cc +++ b/chrome/browser/extensions/extension_keybinding_registry.cc @@ -47,7 +47,7 @@ void ExtensionKeybindingRegistry::Observe( switch (type) { case chrome::NOTIFICATION_EXTENSION_LOADED: AddExtensionKeybinding( - content::Details<const Extension>(details).ptr()); + content::Details<const extensions::Extension>(details).ptr()); break; case chrome::NOTIFICATION_EXTENSION_UNLOADED: RemoveExtensionKeybinding( diff --git a/chrome/browser/extensions/extension_keybinding_registry.h b/chrome/browser/extensions/extension_keybinding_registry.h index 0747ce6..39ca0d9 100644 --- a/chrome/browser/extensions/extension_keybinding_registry.h +++ b/chrome/browser/extensions/extension_keybinding_registry.h @@ -14,11 +14,12 @@ #include "content/public/browser/notification_registrar.h" #include "content/public/browser/notification_source.h" -class Extension; class Profile; namespace extensions { +class Extension; + // The ExtensionKeybindingRegistry is a class that handles the cross-platform // logic for keyboard accelerators. See platform-specific implementations for // implementation details for each platform. @@ -34,9 +35,11 @@ class ExtensionKeybindingRegistry : public content::NotificationObserver { protected: // Add extension keybinding for the events defined by the |extension|. - virtual void AddExtensionKeybinding(const Extension* extension) = 0; + virtual void AddExtensionKeybinding( + const Extension* extension) = 0; // Remove extension bindings for |extension|. - virtual void RemoveExtensionKeybinding(const Extension* extension) = 0; + virtual void RemoveExtensionKeybinding( + const Extension* extension) = 0; // Make sure all extensions registered have keybindings added. void Init(); diff --git a/chrome/browser/extensions/extension_management_api.cc b/chrome/browser/extensions/extension_management_api.cc index fc74f1a..b22ba2f 100644 --- a/chrome/browser/extensions/extension_management_api.cc +++ b/chrome/browser/extensions/extension_management_api.cc @@ -40,6 +40,7 @@ using base::IntToString; using content::BrowserThread; using content::UtilityProcessHost; using content::UtilityProcessHostClient; +using extensions::Extension; namespace events = extension_event_names; namespace keys = extension_management_api_constants; @@ -489,7 +490,8 @@ void ExtensionManagementEventRouter::Observe( } else { const Extension* extension = NULL; if (event_name == events::kOnExtensionDisabled) { - extension = content::Details<UnloadedExtensionInfo>(details)->extension; + extension = content::Details<extensions::UnloadedExtensionInfo>( + details)->extension; } else { extension = content::Details<const Extension>(details).ptr(); } diff --git a/chrome/browser/extensions/extension_management_browsertest.cc b/chrome/browser/extensions/extension_management_browsertest.cc index c467491..51e5620 100644 --- a/chrome/browser/extensions/extension_management_browsertest.cc +++ b/chrome/browser/extensions/extension_management_browsertest.cc @@ -24,6 +24,8 @@ #include "content/public/browser/render_view_host.h" #include "content/public/common/url_fetcher.h" +using extensions::Extension; + class ExtensionManagementTest : public ExtensionBrowserTest { protected: // Helper method that returns whether the extension is at the given version. diff --git a/chrome/browser/extensions/extension_menu_manager.cc b/chrome/browser/extensions/extension_menu_manager.cc index f0bdca8..5d890de 100644 --- a/chrome/browser/extensions/extension_menu_manager.cc +++ b/chrome/browser/extensions/extension_menu_manager.cc @@ -140,8 +140,9 @@ const ExtensionMenuItem::List* ExtensionMenuManager::MenuItems( return NULL; } -bool ExtensionMenuManager::AddContextItem(const Extension* extension, - ExtensionMenuItem* item) { +bool ExtensionMenuManager::AddContextItem( + const extensions::Extension* extension, + ExtensionMenuItem* item) { const std::string& extension_id = item->extension_id(); // The item must have a non-empty extension id, and not have already been // added. @@ -544,8 +545,8 @@ void ExtensionMenuManager::Observe( DCHECK(type == chrome::NOTIFICATION_EXTENSION_UNLOADED); // Remove menu items for disabled/uninstalled extensions. - const Extension* extension = - content::Details<UnloadedExtensionInfo>(details)->extension; + const extensions::Extension* extension = + content::Details<extensions::UnloadedExtensionInfo>(details)->extension; if (ContainsKey(context_items_, extension->id())) { RemoveAllContextItems(extension->id()); } diff --git a/chrome/browser/extensions/extension_menu_manager.h b/chrome/browser/extensions/extension_menu_manager.h index 30a8b35..1235bdb 100644 --- a/chrome/browser/extensions/extension_menu_manager.h +++ b/chrome/browser/extensions/extension_menu_manager.h @@ -22,7 +22,6 @@ #include "content/public/browser/notification_registrar.h" -class Extension; class Profile; class SkBitmap; @@ -31,6 +30,10 @@ class WebContents; struct ContextMenuParams; } +namespace extensions { +class Extension; +} + // Represents a menu item added by an extension. class ExtensionMenuItem { public: @@ -224,7 +227,8 @@ class ExtensionMenuManager : public content::NotificationObserver { // Adds a top-level menu item for an extension, requiring the |extension| // pointer so it can load the icon for the extension. Takes ownership of // |item|. Returns a boolean indicating success or failure. - bool AddContextItem(const Extension* extension, ExtensionMenuItem* item); + bool AddContextItem(const extensions::Extension* extension, + ExtensionMenuItem* item); // Add an item as a child of another item which has been previously added, and // takes ownership of |item|. Returns a boolean indicating success or failure. diff --git a/chrome/browser/extensions/extension_menu_manager_unittest.cc b/chrome/browser/extensions/extension_menu_manager_unittest.cc index a506545..7862ec5 100644 --- a/chrome/browser/extensions/extension_menu_manager_unittest.cc +++ b/chrome/browser/extensions/extension_menu_manager_unittest.cc @@ -26,6 +26,7 @@ #include "testing/gtest/include/gtest/gtest.h" using content::BrowserThread; +using extensions::Extension; using testing::_; using testing::AtLeast; using testing::Return; @@ -75,7 +76,7 @@ class ExtensionMenuManagerTest : public testing::Test { content::TestBrowserThread file_thread_; ExtensionMenuManager manager_; - ExtensionList extensions_; + extensions::ExtensionList extensions_; TestExtensionPrefs prefs_; int next_id_; @@ -357,11 +358,12 @@ TEST_F(ExtensionMenuManagerTest, ExtensionUnloadRemovesMenuItems) { // Notify that the extension was unloaded, and make sure the right item is // gone. - UnloadedExtensionInfo details( + extensions::UnloadedExtensionInfo details( extension1, extension_misc::UNLOAD_REASON_DISABLE); notifier->Notify(chrome::NOTIFICATION_EXTENSION_UNLOADED, content::Source<Profile>(&profile_), - content::Details<UnloadedExtensionInfo>(&details)); + content::Details<extensions::UnloadedExtensionInfo>( + &details)); ASSERT_EQ(NULL, manager_.MenuItems(extension1->id())); ASSERT_EQ(1u, manager_.MenuItems(extension2->id())->size()); ASSERT_TRUE(manager_.GetItemById(id1) == NULL); diff --git a/chrome/browser/extensions/extension_message_service.cc b/chrome/browser/extensions/extension_message_service.cc index d041527..c522eaf 100644 --- a/chrome/browser/extensions/extension_message_service.cc +++ b/chrome/browser/extensions/extension_message_service.cc @@ -126,7 +126,7 @@ static content::RenderProcessHost* GetExtensionProcess( Profile* profile, const std::string& extension_id) { SiteInstance* site_instance = profile->GetExtensionProcessManager()->GetSiteInstanceForURL( - Extension::GetBaseURLFromExtensionId(extension_id)); + extensions::Extension::GetBaseURLFromExtensionId(extension_id)); if (!site_instance->HasProcess()) return NULL; @@ -430,7 +430,8 @@ bool ExtensionMessageService::MaybeAddPendingOpenChannelTask( const OpenChannelParams& params) { ExtensionService* service = profile->GetExtensionService(); const std::string& extension_id = params.target_extension_id; - const Extension* extension = service->extensions()->GetByID(extension_id); + const extensions::Extension* extension = service->extensions()->GetByID( + extension_id); if (extension && extension->has_lazy_background_page()) { // If the extension uses spanning incognito mode, make sure we're always // using the original profile since that is what the extension process diff --git a/chrome/browser/extensions/extension_module.cc b/chrome/browser/extensions/extension_module.cc index f09de0b..cd35b42 100644 --- a/chrome/browser/extensions/extension_module.cc +++ b/chrome/browser/extensions/extension_module.cc @@ -24,7 +24,7 @@ bool SetUpdateUrlDataFunction::RunImpl() { bool IsAllowedIncognitoAccessFunction::RunImpl() { ExtensionService* ext_service = profile()->GetExtensionService(); - const Extension* extension = GetExtension(); + const extensions::Extension* extension = GetExtension(); result_.reset(Value::CreateBooleanValue( ext_service->IsIncognitoEnabled(extension->id()))); @@ -33,7 +33,7 @@ bool IsAllowedIncognitoAccessFunction::RunImpl() { bool IsAllowedFileSchemeAccessFunction::RunImpl() { ExtensionService* ext_service = profile()->GetExtensionService(); - const Extension* extension = GetExtension(); + const extensions::Extension* extension = GetExtension(); result_.reset(Value::CreateBooleanValue( ext_service->AllowFileAccess(extension))); diff --git a/chrome/browser/extensions/extension_nacl_browsertest.cc b/chrome/browser/extensions/extension_nacl_browsertest.cc index 8565d8d..58ccfbb 100644 --- a/chrome/browser/extensions/extension_nacl_browsertest.cc +++ b/chrome/browser/extensions/extension_nacl_browsertest.cc @@ -22,6 +22,7 @@ using content::PluginService; using content::WebContents; +using extensions::Extension; namespace { diff --git a/chrome/browser/extensions/extension_navigation_observer.cc b/chrome/browser/extensions/extension_navigation_observer.cc index d827f80..2cb1bc6 100644 --- a/chrome/browser/extensions/extension_navigation_observer.cc +++ b/chrome/browser/extensions/extension_navigation_observer.cc @@ -55,7 +55,7 @@ void ExtensionNavigationObserver::PromptToEnableExtensionIfNecessary( return; ExtensionService* extension_service = profile_->GetExtensionService(); - const Extension* extension = + const extensions::Extension* extension = extension_service->disabled_extensions()-> GetExtensionOrAppByURL(ExtensionURLInfo(nav_entry->GetURL())); if (!extension) @@ -80,7 +80,7 @@ void ExtensionNavigationObserver::PromptToEnableExtensionIfNecessary( void ExtensionNavigationObserver::InstallUIProceed() { ExtensionService* extension_service = profile_->GetExtensionService(); - const Extension* extension = extension_service->GetExtensionById( + const extensions::Extension* extension = extension_service->GetExtensionById( in_progress_prompt_extension_id_, true); NavigationController* nav_controller = in_progress_prompt_navigation_controller_; @@ -98,7 +98,7 @@ void ExtensionNavigationObserver::InstallUIProceed() { void ExtensionNavigationObserver::InstallUIAbort(bool user_initiated) { ExtensionService* extension_service = profile_->GetExtensionService(); - const Extension* extension = extension_service->GetExtensionById( + const extensions::Extension* extension = extension_service->GetExtensionById( in_progress_prompt_extension_id_, true); in_progress_prompt_extension_id_ = ""; diff --git a/chrome/browser/extensions/extension_override_apitest.cc b/chrome/browser/extensions/extension_override_apitest.cc index 50d59c5..fd63acd 100644 --- a/chrome/browser/extensions/extension_override_apitest.cc +++ b/chrome/browser/extensions/extension_override_apitest.cc @@ -117,7 +117,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionOverrideTest, MAYBE_OverrideHistory) { // Regression test for http://crbug.com/41442. IN_PROC_BROWSER_TEST_F(ExtensionOverrideTest, ShouldNotCreateDuplicateEntries) { - const Extension* extension = + const extensions::Extension* extension = LoadExtension(test_data_dir_.AppendASCII("override/history")); ASSERT_TRUE(extension); @@ -164,7 +164,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionOverrideTest, OverrideKeyboard) { } // Load the failing version. This should take precedence. - const Extension* extension = LoadExtension( + const extensions::Extension* extension = LoadExtension( test_data_dir_.AppendASCII("override").AppendASCII("keyboard_fails")); ASSERT_TRUE(extension); { diff --git a/chrome/browser/extensions/extension_prefs.cc b/chrome/browser/extensions/extension_prefs.cc index 5fb0bb4..faf3bd5 100644 --- a/chrome/browser/extensions/extension_prefs.cc +++ b/chrome/browser/extensions/extension_prefs.cc @@ -22,6 +22,9 @@ #include "chrome/common/url_constants.h" #include "content/public/browser/notification_service.h" +using extensions::Extension; +using extensions::ExtensionInfo; + namespace { // Additional preferences keys @@ -855,8 +858,8 @@ void ExtensionPrefs::SetActiveBit(const std::string& extension_id, void ExtensionPrefs::MigratePermissions(const ExtensionIdSet& extension_ids) { ExtensionPermissionsInfo* info = ExtensionPermissionsInfo::GetInstance(); - for (ExtensionIdSet::const_iterator ext_id = extension_ids.begin(); - ext_id != extension_ids.end(); ++ext_id) { + for (ExtensionIdSet::const_iterator ext_id = + extension_ids.begin(); ext_id != extension_ids.end(); ++ext_id) { // An extension's granted permissions need to be migrated if the // full_access bit is present. This bit was always present in the previous @@ -1166,7 +1169,7 @@ bool ExtensionPrefs::IsExtensionDisabled( } std::vector<std::string> ExtensionPrefs::GetToolbarOrder() { - ExtensionPrefs::ExtensionIdSet extension_ids; + ExtensionIdSet extension_ids; const ListValue* toolbar_order = prefs_->GetList(kExtensionToolbar); if (toolbar_order) { for (size_t i = 0; i < toolbar_order->GetSize(); ++i) { diff --git a/chrome/browser/extensions/extension_prefs.h b/chrome/browser/extensions/extension_prefs.h index 31bf160..adfb45f 100644 --- a/chrome/browser/extensions/extension_prefs.h +++ b/chrome/browser/extensions/extension_prefs.h @@ -52,7 +52,7 @@ class ExtensionPrefs : public extensions::ContentSettingsStore::Observer, // extension ids. static const char kExtensionsPref[]; - typedef std::vector<linked_ptr<ExtensionInfo> > ExtensionsInfo; + typedef std::vector<linked_ptr<extensions::ExtensionInfo> > ExtensionsInfo; // Vector containing identifiers for preferences. typedef std::set<std::string> PrefKeySet; @@ -110,18 +110,19 @@ class ExtensionPrefs : public extensions::ContentSettingsStore::Observer, // Called when an extension is installed, so that prefs get created. // If |page_ordinal| is an invalid ordinal, then a page will be found // for the App. - void OnExtensionInstalled(const Extension* extension, - Extension::State initial_state, + void OnExtensionInstalled(const extensions::Extension* extension, + extensions::Extension::State initial_state, bool from_webstore, const StringOrdinal& page_ordinal); // Called when an extension is uninstalled, so that prefs get cleaned up. void OnExtensionUninstalled(const std::string& extension_id, - const Extension::Location& location, + const extensions::Extension::Location& location, bool external_uninstall); // Called to change the extension's state when it is enabled/disabled. - void SetExtensionState(const std::string& extension_id, Extension::State); + void SetExtensionState(const std::string& extension_id, + extensions::Extension::State); // Returns all installed extensions void GetExtensions(ExtensionIdSet* out); @@ -133,21 +134,24 @@ class ExtensionPrefs : public extensions::ContentSettingsStore::Observer, const base::DictionaryValue* extension_prefs); // Getter and setter for browser action visibility. - bool GetBrowserActionVisibility(const Extension* extension); - void SetBrowserActionVisibility(const Extension* extension, bool visible); + bool GetBrowserActionVisibility(const extensions::Extension* extension); + void SetBrowserActionVisibility(const extensions::Extension* extension, + bool visible); // Did the extension ask to escalate its permission during an upgrade? bool DidExtensionEscalatePermissions(const std::string& id); // If |did_escalate| is true, the preferences for |extension| will be set to // require the install warning when the user tries to enable. - void SetDidExtensionEscalatePermissions(const Extension* extension, - bool did_escalate); + void SetDidExtensionEscalatePermissions( + const extensions::Extension* extension, + bool did_escalate); // Getter and setters for disabled reason. - Extension::DisableReason GetDisableReason(const std::string& extension_id); + extensions::Extension::DisableReason GetDisableReason( + const std::string& extension_id); void SetDisableReason(const std::string& extension_id, - Extension::DisableReason disable_reason); + extensions::Extension::DisableReason disable_reason); void RemoveDisableReason(const std::string& extension_id); // Returns the version string for the currently installed extension, or @@ -156,7 +160,7 @@ class ExtensionPrefs : public extensions::ContentSettingsStore::Observer, // Re-writes the extension manifest into the prefs. // Called to change the extension's manifest when it's re-localized. - void UpdateManifest(const Extension* extension); + void UpdateManifest(const extensions::Extension* extension); // Returns extension path based on extension ID, or empty FilePath on error. FilePath GetExtensionPath(const std::string& extension_id); @@ -205,7 +209,7 @@ class ExtensionPrefs : public extensions::ContentSettingsStore::Observer, // Is the extension with |extension_id| allowed by policy (checking both // whitelist and blacklist). bool IsExtensionAllowedByPolicy(const std::string& extension_id, - Extension::Location location) const; + extensions::Extension::Location location) const; // Checks if extensions are blacklisted by default, by policy. When true, this // means that even extensions without an ID should be blacklisted (e.g. @@ -301,7 +305,7 @@ class ExtensionPrefs : public extensions::ContentSettingsStore::Observer, // If |extension|'s prefs do not have a launch type set, then // use |default_pref_value|. extension_misc::LaunchContainer GetLaunchContainer( - const Extension* extension, + const extensions::Extension* extension, LaunchType default_pref_value); // Saves ExtensionInfo for each installed extension with the path to the @@ -312,7 +316,8 @@ class ExtensionPrefs : public extensions::ContentSettingsStore::Observer, // Returns the ExtensionInfo from the prefs for the given extension. If the // extension is not present, NULL is returned. - ExtensionInfo* GetInstalledExtensionInfo(const std::string& extension_id); + extensions::ExtensionInfo* GetInstalledExtensionInfo( + const std::string& extension_id); // We've downloaded an updated .crx file for the extension, but are waiting // for idle time to install it. @@ -522,7 +527,7 @@ class ExtensionPrefs : public extensions::ContentSettingsStore::Observer, // Checks whether there is a state pref for the extension and if so, whether // it matches |check_state|. bool DoesExtensionHaveState(const std::string& id, - Extension::State check_state) const; + extensions::Extension::State check_state) const; // The pref service specific to this set of extension prefs. Owned by profile. PrefService* prefs_; diff --git a/chrome/browser/extensions/extension_prefs_unittest.cc b/chrome/browser/extensions/extension_prefs_unittest.cc index 17bb3b1..378dfbf 100644 --- a/chrome/browser/extensions/extension_prefs_unittest.cc +++ b/chrome/browser/extensions/extension_prefs_unittest.cc @@ -25,6 +25,8 @@ using base::Time; using base::TimeDelta; using content::BrowserThread; +using extensions::Extension; +using extensions::ExtensionList; namespace { @@ -447,7 +449,7 @@ class ExtensionPrefsBlacklist : public ExtensionPrefsTest { EXPECT_EQ(4u, info->size()); ExtensionPrefs::ExtensionsInfo::iterator info_iter; for (info_iter = info->begin(); info_iter != info->end(); ++info_iter) { - ExtensionInfo* extension_info = info_iter->get(); + extensions::ExtensionInfo* extension_info = info_iter->get(); EXPECT_NE(extensions_[0]->id(), extension_info->extension_id); } } diff --git a/chrome/browser/extensions/extension_prefs_unittest.h b/chrome/browser/extensions/extension_prefs_unittest.h index bda1dca..7a97651 100644 --- a/chrome/browser/extensions/extension_prefs_unittest.h +++ b/chrome/browser/extensions/extension_prefs_unittest.h @@ -15,6 +15,10 @@ namespace base { class Value; } +namespace extensions { +class Extension; +} + // Base class for extension preference-related unit tests. class ExtensionPrefsTest : public testing::Test { public: @@ -57,41 +61,41 @@ class ExtensionPrefsPrepopulatedTest : public ExtensionPrefsTest { virtual void RegisterPreferences() OVERRIDE; - void InstallExtControlledPref(Extension *ext, + void InstallExtControlledPref(extensions::Extension* ext, const std::string& key, base::Value* val); - void InstallExtControlledPrefIncognito(Extension *ext, + void InstallExtControlledPrefIncognito(extensions::Extension* ext, const std::string& key, base::Value* val); void InstallExtControlledPrefIncognitoSessionOnly( - Extension *ext, + extensions::Extension* ext, const std::string& key, base::Value* val); - void InstallExtension(Extension *ext); + void InstallExtension(extensions::Extension* ext); void UninstallExtension(const std::string& extension_id); // Weak references, for convenience. - Extension* ext1_; - Extension* ext2_; - Extension* ext3_; - Extension* ext4_; + extensions::Extension* ext1_; + extensions::Extension* ext2_; + extensions::Extension* ext3_; + extensions::Extension* ext4_; // Flags indicating whether each of the extensions has been installed, yet. bool installed[4]; private: - void EnsureExtensionInstalled(Extension *ext); + void EnsureExtensionInstalled(extensions::Extension *ext); void EnsureExtensionUninstalled(const std::string& extension_id); - scoped_refptr<Extension> ext1_scoped_; - scoped_refptr<Extension> ext2_scoped_; - scoped_refptr<Extension> ext3_scoped_; - scoped_refptr<Extension> ext4_scoped_; + scoped_refptr<extensions::Extension> ext1_scoped_; + scoped_refptr<extensions::Extension> ext2_scoped_; + scoped_refptr<extensions::Extension> ext3_scoped_; + scoped_refptr<extensions::Extension> ext4_scoped_; }; diff --git a/chrome/browser/extensions/extension_process_manager.cc b/chrome/browser/extensions/extension_process_manager.cc index 63437bd..1685138 100644 --- a/chrome/browser/extensions/extension_process_manager.cc +++ b/chrome/browser/extensions/extension_process_manager.cc @@ -43,6 +43,7 @@ using content::OpenURLParams; using content::Referrer; using content::RenderViewHost; using content::SiteInstance; +using extensions::Extension; namespace { @@ -540,7 +541,8 @@ void ExtensionProcessManager::Observe( case chrome::NOTIFICATION_EXTENSION_UNLOADED: { const Extension* extension = - content::Details<UnloadedExtensionInfo>(details)->extension; + content::Details<extensions::UnloadedExtensionInfo>( + details)->extension; for (ExtensionHostSet::iterator iter = background_hosts_.begin(); iter != background_hosts_.end(); ++iter) { ExtensionHost* host = *iter; diff --git a/chrome/browser/extensions/extension_process_manager.h b/chrome/browser/extensions/extension_process_manager.h index 33f5820..c695d21 100644 --- a/chrome/browser/extensions/extension_process_manager.h +++ b/chrome/browser/extensions/extension_process_manager.h @@ -19,7 +19,6 @@ #include "content/public/browser/notification_registrar.h" class Browser; -class Extension; class ExtensionHost; class GURL; class Profile; @@ -29,6 +28,10 @@ class RenderViewHost; class SiteInstance; }; +namespace extensions { +class Extension; +} + // Manages dynamic state of running Chromium extensions. There is one instance // of this class per Profile. OTR Profiles have a separate instance that keeps // track of split-mode extensions only. @@ -50,30 +53,31 @@ class ExtensionProcessManager : public content::NotificationObserver { // Creates a new ExtensionHost with its associated view, grouping it in the // appropriate SiteInstance (and therefore process) based on the URL and // profile. - virtual ExtensionHost* CreateViewHost(const Extension* extension, + virtual ExtensionHost* CreateViewHost(const extensions::Extension* extension, const GURL& url, Browser* browser, content::ViewType view_type); ExtensionHost* CreateViewHost(const GURL& url, Browser* browser, content::ViewType view_type); - ExtensionHost* CreatePopupHost(const Extension* extension, + ExtensionHost* CreatePopupHost(const extensions::Extension* extension, const GURL& url, Browser* browser); ExtensionHost* CreatePopupHost(const GURL& url, Browser* browser); ExtensionHost* CreateDialogHost(const GURL& url, Browser* browser); - ExtensionHost* CreateInfobarHost(const Extension* extension, + ExtensionHost* CreateInfobarHost(const extensions::Extension* extension, const GURL& url, Browser* browser); ExtensionHost* CreateInfobarHost(const GURL& url, Browser* browser); // Open the extension's options page. - void OpenOptionsPage(const Extension* extension, Browser* browser); + void OpenOptionsPage(const extensions::Extension* extension, + Browser* browser); // Creates a new UI-less extension instance. Like CreateViewHost, but not // displayed anywhere. - virtual void CreateBackgroundHost(const Extension* extension, + virtual void CreateBackgroundHost(const extensions::Extension* extension, const GURL& url); // Gets the ExtensionHost for the background page for an extension, or NULL if @@ -87,7 +91,7 @@ class ExtensionProcessManager : public content::NotificationObserver { // Registers a RenderViewHost as hosting a given extension. void RegisterRenderViewHost(content::RenderViewHost* render_view_host, - const Extension* extension); + const extensions::Extension* extension); // Unregisters a RenderViewHost as hosting any extension. void UnregisterRenderViewHost(content::RenderViewHost* render_view_host); @@ -99,7 +103,7 @@ class ExtensionProcessManager : public content::NotificationObserver { // Returns the extension associated with the specified RenderViewHost, or // NULL. - const Extension* GetExtensionForRenderViewHost( + const extensions::Extension* GetExtensionForRenderViewHost( content::RenderViewHost* render_view_host); // Returns true if the (lazy) background host for the given extension has @@ -110,9 +114,9 @@ class ExtensionProcessManager : public content::NotificationObserver { // the count of how many outstanding "things" are keeping the page alive. // When this reaches 0, we will begin the process of shutting down the page. // "Things" include pending events, resource loads, and API calls. - int GetLazyKeepaliveCount(const Extension* extension); - int IncrementLazyKeepaliveCount(const Extension* extension); - int DecrementLazyKeepaliveCount(const Extension* extension); + int GetLazyKeepaliveCount(const extensions::Extension* extension); + int IncrementLazyKeepaliveCount(const extensions::Extension* extension); + int DecrementLazyKeepaliveCount(const extensions::Extension* extension); void IncrementLazyKeepaliveCountForView( content::RenderViewHost* render_view_host); diff --git a/chrome/browser/extensions/extension_protocols.cc b/chrome/browser/extensions/extension_protocols.cc index 67e92a7..bf836bb 100644 --- a/chrome/browser/extensions/extension_protocols.cc +++ b/chrome/browser/extensions/extension_protocols.cc @@ -35,6 +35,7 @@ #include "ui/base/resource/resource_bundle.h" using content::ResourceRequestInfo; +using extensions::Extension; namespace { diff --git a/chrome/browser/extensions/extension_protocols_unittest.cc b/chrome/browser/extensions/extension_protocols_unittest.cc index 2437db4..6c0f96b 100644 --- a/chrome/browser/extensions/extension_protocols_unittest.cc +++ b/chrome/browser/extensions/extension_protocols_unittest.cc @@ -18,6 +18,7 @@ #include "testing/gtest/include/gtest/gtest.h" using content::BrowserThread; +using extensions::Extension; namespace { diff --git a/chrome/browser/extensions/extension_service.cc b/chrome/browser/extensions/extension_service.cc index bb0f44a..9a50210 100644 --- a/chrome/browser/extensions/extension_service.cc +++ b/chrome/browser/extensions/extension_service.cc @@ -133,6 +133,10 @@ using content::BrowserThread; using content::DevToolsAgentHost; using content::DevToolsAgentHostRegistry; using content::PluginService; +using extensions::Extension; +using extensions::ExtensionIdSet; +using extensions::ExtensionInfo; +using extensions::UnloadedExtensionInfo; namespace errors = extension_manifest_errors; diff --git a/chrome/browser/extensions/extension_service.h b/chrome/browser/extensions/extension_service.h index d774113..01e056d 100644 --- a/chrome/browser/extensions/extension_service.h +++ b/chrome/browser/extensions/extension_service.h @@ -78,6 +78,7 @@ class APIResourceController; class AppSyncData; class ComponentLoader; class ContentSettingsStore; +class Extension; class ExtensionCookiesEventRouter; class ExtensionSyncData; class ExtensionUpdater; @@ -92,7 +93,7 @@ class ExtensionServiceInterface : public SyncableService { // A function that returns true if the given extension should be // included and false if it should be filtered out. Identical to // PendingExtensionInfo::ShouldAllowInstallPredicate. - typedef bool (*ExtensionFilter)(const Extension&); + typedef bool (*ExtensionFilter)(const extensions::Extension&); virtual ~ExtensionServiceInterface() {} virtual const ExtensionSet* extensions() const = 0; @@ -106,9 +107,9 @@ class ExtensionServiceInterface : public SyncableService { const FilePath& path, const GURL& download_url, CrxInstaller** out_crx_installer) = 0; - virtual const Extension* GetExtensionById(const std::string& id, + virtual const extensions::Extension* GetExtensionById(const std::string& id, bool include_disabled) const = 0; - virtual const Extension* GetInstalledExtension( + virtual const extensions::Extension* GetInstalledExtension( const std::string& id) const = 0; virtual bool IsExtensionEnabled(const std::string& extension_id) const = 0; @@ -125,13 +126,14 @@ class ExtensionServiceInterface : public SyncableService { // themes sync to not use it directly. virtual void CheckForUpdatesSoon() = 0; - virtual void AddExtension(const Extension* extension) = 0; + virtual void AddExtension(const extensions::Extension* extension) = 0; virtual void UnloadExtension( const std::string& extension_id, extension_misc::UnloadedExtensionReason reason) = 0; - virtual void SyncExtensionChangeIfNeeded(const Extension& extension) = 0; + virtual void SyncExtensionChangeIfNeeded( + const extensions::Extension& extension) = 0; virtual bool is_ready() = 0; }; @@ -169,17 +171,19 @@ class ExtensionService static const char* kSyncExtensionSettingsDirectoryName; // Returns the Extension of hosted or packaged apps, NULL otherwise. - const Extension* GetInstalledApp(const GURL& url); + const extensions::Extension* GetInstalledApp(const GURL& url); // Returns whether the URL is from either a hosted or packaged app. bool IsInstalledApp(const GURL& url); // Associates a renderer process with the given installed app. - void SetInstalledAppForRenderer(int renderer_child_id, const Extension* app); + void SetInstalledAppForRenderer(int renderer_child_id, + const extensions::Extension* app); // If the renderer is hosting an installed app, returns it, otherwise returns // NULL. - const Extension* GetInstalledAppForRenderer(int renderer_child_id); + const extensions::Extension* GetInstalledAppForRenderer( + int renderer_child_id); // Attempts to uninstall an extension from a given ExtensionService. Returns // true iff the target extension exists. @@ -239,36 +243,36 @@ class ExtensionService // Returns true if the given extension can see events and data from another // sub-profile (incognito to original profile, or vice versa). - bool CanCrossIncognito(const Extension* extension); + bool CanCrossIncognito(const extensions::Extension* extension); // Returns true if the given extension can be loaded in incognito. - bool CanLoadInIncognito(const Extension* extension) const; + bool CanLoadInIncognito(const extensions::Extension* extension) const; // Whether this extension can inject scripts into pages with file URLs. - bool AllowFileAccess(const Extension* extension); + bool AllowFileAccess(const extensions::Extension* extension); // Will reload the extension since this permission is applied at loading time // only. - void SetAllowFileAccess(const Extension* extension, bool allow); + void SetAllowFileAccess(const extensions::Extension* extension, bool allow); // Whether the persistent background page, if any, is ready. We don't load // other components until then. If there is no background page, or if it is // non-persistent (lazy), we consider it to be ready. - bool IsBackgroundPageReady(const Extension* extension); - void SetBackgroundPageReady(const Extension* extension); + bool IsBackgroundPageReady(const extensions::Extension* extension); + void SetBackgroundPageReady(const extensions::Extension* extension); // Getter and setter for the flag that specifies whether the extension is // being upgraded. - bool IsBeingUpgraded(const Extension* extension); - void SetBeingUpgraded(const Extension* extension, bool value); + bool IsBeingUpgraded(const extensions::Extension* extension); + void SetBeingUpgraded(const extensions::Extension* extension, bool value); // Getter and setter for the flag that specifies if the extension has used // the webrequest API. // TODO(mpcomplete): remove. http://crbug.com/100411 - bool HasUsedWebRequest(const Extension* extension); - void SetHasUsedWebRequest(const Extension* extension, bool value); + bool HasUsedWebRequest(const extensions::Extension* extension); + void SetHasUsedWebRequest(const extensions::Extension* extension, bool value); // Getter for the extension's runtime data PropertyBag. - base::PropertyBag* GetPropertyBag(const Extension* extension); + base::PropertyBag* GetPropertyBag(const extensions::Extension* extension); // Initialize and start all installed extensions. void Init(); @@ -287,15 +291,16 @@ class ExtensionService // Look up an extension by ID. Does not include terminated // extensions. - virtual const Extension* GetExtensionById( + virtual const extensions::Extension* GetExtensionById( const std::string& id, bool include_disabled) const OVERRIDE; // Looks up a terminated (crashed) extension by ID. - const Extension* GetTerminatedExtension(const std::string& id) const; + const extensions::Extension* + GetTerminatedExtension(const std::string& id) const; // Looks up an extension by ID, regardless of whether it's enabled, // disabled, or terminated. - virtual const Extension* GetInstalledExtension( + virtual const extensions::Extension* GetInstalledExtension( const std::string& id) const OVERRIDE; // Updates a currently-installed extension with the contents from @@ -338,12 +343,13 @@ class ExtensionService // Disables the extension. If the extension is already disabled, or // cannot be disabled, does nothing. virtual void DisableExtension(const std::string& extension_id, - Extension::DisableReason disable_reason); + extensions::Extension::DisableReason disable_reason); // Updates the |extension|'s granted permissions lists to include all // permissions in the |extension|'s manifest and re-enables the // extension. - void GrantPermissionsAndEnableExtension(const Extension* extension); + void GrantPermissionsAndEnableExtension( + const extensions::Extension* extension); // Check for updates (or potentially new extensions from external providers) void CheckForExternalUpdates(); @@ -365,7 +371,8 @@ class ExtensionService // Notifies Sync (if needed) of a newly-installed extension or a change to // an existing extension. - virtual void SyncExtensionChangeIfNeeded(const Extension& extension) OVERRIDE; + virtual void SyncExtensionChangeIfNeeded( + const extensions::Extension& extension) OVERRIDE; // Returns true if |url| should get extension api bindings and be permitted // to make api calls. Note that this is independent of what extension @@ -385,17 +392,17 @@ class ExtensionService // Adds |extension| to this ExtensionService and notifies observers than an // extension has been loaded. Called by the backend after an extension has // been loaded from a file and installed. - virtual void AddExtension(const Extension* extension) OVERRIDE; + virtual void AddExtension(const extensions::Extension* extension) OVERRIDE; // Called by the backend when an extension has been installed. void OnExtensionInstalled( - const Extension* extension, + const extensions::Extension* extension, bool from_webstore, const StringOrdinal& page_ordinal); // Initializes the |extension|'s active permission set and disables the // extension if the privilege level has increased (e.g., due to an upgrade). - void InitializePermissions(const Extension* extension); + void InitializePermissions(const extensions::Extension* extension); // Go through each extensions in pref, unload blacklisted extensions // and update the blacklist state in pref. @@ -424,11 +431,12 @@ class ExtensionService // Gets the sync data for the given extension, assuming that the extension is // syncable. extensions::ExtensionSyncData GetExtensionSyncData( - const Extension& extension) const; + const extensions::Extension& extension) const; // Gets the sync data for the given app, assuming that the app is // syncable. - extensions::AppSyncData GetAppSyncData(const Extension& extension) const; + extensions::AppSyncData GetAppSyncData( + const extensions::Extension& extension) const; // Gets the ExtensionSyncData for all extensions. std::vector<extensions::ExtensionSyncData> GetExtensionSyncDataList() const; @@ -524,18 +532,18 @@ class ExtensionService void AddProviderForTesting(ExternalExtensionProviderInterface* test_provider); // ExternalExtensionProvider::Visitor implementation. - virtual bool OnExternalExtensionFileFound(const std::string& id, - const Version* version, - const FilePath& path, - Extension::Location location, - int creation_flags, - bool mark_acknowledged) - OVERRIDE; - - virtual bool OnExternalExtensionUpdateUrlFound(const std::string& id, - const GURL& update_url, - Extension::Location location) - OVERRIDE; + virtual bool OnExternalExtensionFileFound( + const std::string& id, + const Version* version, + const FilePath& path, + extensions::Extension::Location location, + int creation_flags, + bool mark_acknowledged) OVERRIDE; + + virtual bool OnExternalExtensionUpdateUrlFound( + const std::string& id, + const GURL& update_url, + extensions::Extension::Location location) OVERRIDE; virtual void OnExternalProviderReady( const ExternalExtensionProviderInterface* provider) OVERRIDE; @@ -581,17 +589,17 @@ class ExtensionService bool HasApps() const; // Gets the set of loaded app ids. Component apps are not included. - ExtensionIdSet GetAppIds() const; + extensions::ExtensionIdSet GetAppIds() const; // Record a histogram using the PermissionMessage enum values for each // permission in |e|. // NOTE: If this is ever called with high frequency, the implementation may // need to be made more efficient. static void RecordPermissionMessagesHistogram( - const Extension* e, const char* histogram); + const extensions::Extension* e, const char* histogram); #if defined(UNIT_TEST) - void TrackTerminatedExtensionForTest(const Extension* extension) { + void TrackTerminatedExtensionForTest(const extensions::Extension* extension) { TrackTerminatedExtension(extension); } #endif @@ -636,7 +644,8 @@ class ExtensionService typedef std::list<NaClModuleInfo> NaClModuleInfoList; // Return true if the sync type of |extension| matches |type|. - bool IsCorrectSyncType(const Extension& extension, syncable::ModelType type) + bool IsCorrectSyncType(const extensions::Extension& extension, + syncable::ModelType type) const; // Handles setting the extension specific values in |extension_sync_data| to @@ -649,24 +658,25 @@ class ExtensionService // Look up an extension by ID, optionally including either or both of enabled // and disabled extensions. - const Extension* GetExtensionByIdInternal(const std::string& id, - bool include_enabled, - bool include_disabled, - bool include_terminated) const; + const extensions::Extension* GetExtensionByIdInternal( + const std::string& id, + bool include_enabled, + bool include_disabled, + bool include_terminated) const; // Adds the given extension to the list of terminated extensions if // it is not already there and unloads it. - void TrackTerminatedExtension(const Extension* extension); + void TrackTerminatedExtension(const extensions::Extension* extension); // Removes the extension with the given id from the list of // terminated extensions if it is there. void UntrackTerminatedExtension(const std::string& id); // Handles sending notification that |extension| was loaded. - void NotifyExtensionLoaded(const Extension* extension); + void NotifyExtensionLoaded(const extensions::Extension* extension); // Handles sending notification that |extension| was unloaded. - void NotifyExtensionUnloaded(const Extension* extension, + void NotifyExtensionUnloaded(const extensions::Extension* extension, extension_misc::UnloadedExtensionReason reason); // Helper that updates the active extension list used for crash reporting. @@ -716,7 +726,8 @@ class ExtensionService // Holds a map between renderer process IDs that are associated with an // installed app and their app. - typedef std::map<int, scoped_refptr<const Extension> > InstalledAppMap; + typedef std::map<int, scoped_refptr<const extensions::Extension> > + InstalledAppMap; InstalledAppMap installed_app_hosts_; // The full path to the directory where extensions are installed. diff --git a/chrome/browser/extensions/extension_service_unittest.cc b/chrome/browser/extensions/extension_service_unittest.cc index 3963400..127a2a1 100644 --- a/chrome/browser/extensions/extension_service_unittest.cc +++ b/chrome/browser/extensions/extension_service_unittest.cc @@ -95,6 +95,7 @@ using content::BrowserThread; using content::DOMStorageContext; using content::IndexedDBContext; using content::PluginService; +using extensions::Extension; namespace keys = extension_manifest_keys; @@ -523,9 +524,10 @@ class ExtensionServiceTest case chrome::NOTIFICATION_EXTENSION_UNLOADED: { const Extension* e = - content::Details<UnloadedExtensionInfo>(details)->extension; + content::Details<extensions::UnloadedExtensionInfo>( + details)->extension; unloaded_id_ = e->id(); - ExtensionList::iterator i = + extensions::ExtensionList::iterator i = std::find(loaded_.begin(), loaded_.end(), e); // TODO(erikkay) fix so this can be an assert. Right now the tests // are manually calling clear() on loaded_, so this isn't doable. @@ -944,7 +946,7 @@ class ExtensionServiceTest } protected: - ExtensionList loaded_; + extensions::ExtensionList loaded_; std::string unloaded_id_; const Extension* installed_; diff --git a/chrome/browser/extensions/extension_sorting.cc b/chrome/browser/extensions/extension_sorting.cc index f7b770d..1e29b36 100644 --- a/chrome/browser/extensions/extension_sorting.cc +++ b/chrome/browser/extensions/extension_sorting.cc @@ -496,7 +496,7 @@ void ExtensionSorting::RemoveOrdinalMapping( void ExtensionSorting::SyncIfNeeded(const std::string& extension_id) { if (extension_service_) { - const Extension* ext = + const extensions::Extension* ext = extension_service_->GetInstalledExtension(extension_id); if (ext) { diff --git a/chrome/browser/extensions/extension_sorting_unittest.cc b/chrome/browser/extensions/extension_sorting_unittest.cc index ed16f68..1cd8316 100644 --- a/chrome/browser/extensions/extension_sorting_unittest.cc +++ b/chrome/browser/extensions/extension_sorting_unittest.cc @@ -7,6 +7,8 @@ #include "chrome/common/extensions/extension_manifest_constants.h" #include "testing/gtest/include/gtest/gtest.h" +using extensions::Extension; + namespace keys = extension_manifest_keys; class ExtensionSortingTest : public ExtensionPrefsTest { diff --git a/chrome/browser/extensions/extension_special_storage_policy.cc b/chrome/browser/extensions/extension_special_storage_policy.cc index 23e6889..1b971bc 100644 --- a/chrome/browser/extensions/extension_special_storage_policy.cc +++ b/chrome/browser/extensions/extension_special_storage_policy.cc @@ -61,7 +61,7 @@ bool ExtensionSpecialStoragePolicy::IsFileHandler( } void ExtensionSpecialStoragePolicy::GrantRightsForExtension( - const Extension* extension) { + const extensions::Extension* extension) { DCHECK(extension); if (!extension->is_hosted_app() && !extension->HasAPIPermission( @@ -85,7 +85,7 @@ void ExtensionSpecialStoragePolicy::GrantRightsForExtension( } void ExtensionSpecialStoragePolicy::RevokeRightsForExtension( - const Extension* extension) { + const extensions::Extension* extension) { DCHECK(extension); if (!extension->is_hosted_app() && !extension->HasAPIPermission( @@ -158,13 +158,13 @@ bool ExtensionSpecialStoragePolicy::SpecialCollection::ContainsExtension( } void ExtensionSpecialStoragePolicy::SpecialCollection::Add( - const Extension* extension) { + const extensions::Extension* extension) { cached_results_.clear(); extensions_[extension->id()] = extension; } void ExtensionSpecialStoragePolicy::SpecialCollection::Remove( - const Extension* extension) { + const extensions::Extension* extension) { cached_results_.clear(); extensions_.erase(extension->id()); } diff --git a/chrome/browser/extensions/extension_special_storage_policy.h b/chrome/browser/extensions/extension_special_storage_policy.h index 22a6c98..c2c8665 100644 --- a/chrome/browser/extensions/extension_special_storage_policy.h +++ b/chrome/browser/extensions/extension_special_storage_policy.h @@ -14,7 +14,10 @@ #include "webkit/quota/special_storage_policy.h" class CookieSettings; + +namespace extensions { class Extension; +} // Special rights are granted to 'extensions' and 'applications'. The // storage subsystems and the browsing data remover query this interface @@ -32,8 +35,8 @@ class ExtensionSpecialStoragePolicy : public quota::SpecialStoragePolicy { virtual bool HasSessionOnlyOrigins() OVERRIDE; // Methods used by the ExtensionService to populate this class. - void GrantRightsForExtension(const Extension* extension); - void RevokeRightsForExtension(const Extension* extension); + void GrantRightsForExtension(const extensions::Extension* extension); + void RevokeRightsForExtension(const extensions::Extension* extension); void RevokeRightsForAllExtensions(); protected: @@ -47,13 +50,14 @@ class ExtensionSpecialStoragePolicy : public quota::SpecialStoragePolicy { bool Contains(const GURL& origin); bool ContainsExtension(const std::string& extension_id); - void Add(const Extension* extension); - void Remove(const Extension* extension); + void Add(const extensions::Extension* extension); + void Remove(const extensions::Extension* extension); void Clear(); private: typedef std::map<GURL, bool> CachedResults; - typedef std::map<std::string, scoped_refptr<const Extension> > Extensions; + typedef std::map<std::string, scoped_refptr<const extensions::Extension> > + Extensions; Extensions extensions_; CachedResults cached_results_; }; diff --git a/chrome/browser/extensions/extension_special_storage_policy_unittest.cc b/chrome/browser/extensions/extension_special_storage_policy_unittest.cc index 73dd57c..cb81acf 100644 --- a/chrome/browser/extensions/extension_special_storage_policy_unittest.cc +++ b/chrome/browser/extensions/extension_special_storage_policy_unittest.cc @@ -15,6 +15,7 @@ #include "testing/gtest/include/gtest/gtest.h" using content::BrowserThread; +using extensions::Extension; namespace keys = extension_manifest_keys; diff --git a/chrome/browser/extensions/extension_startup_browsertest.cc b/chrome/browser/extensions/extension_startup_browsertest.cc index d2a5f53..c35ff72 100644 --- a/chrome/browser/extensions/extension_startup_browsertest.cc +++ b/chrome/browser/extensions/extension_startup_browsertest.cc @@ -90,7 +90,7 @@ class ExtensionStartupTestBase : public InProcessBrowserTest { int found_extensions = 0; for (ExtensionSet::const_iterator it = service->extensions()->begin(); it != service->extensions()->end(); ++it) - if ((*it)->location() != Extension::COMPONENT) + if ((*it)->location() != extensions::Extension::COMPONENT) found_extensions++; ASSERT_EQ(static_cast<uint32>(num_expected_extensions), @@ -172,12 +172,12 @@ IN_PROC_BROWSER_TEST_F(ExtensionsStartupTest, MAYBE_NoFileAccess) { // Keep a separate list of extensions for which to disable file access, since // doing so reloads them. - std::vector<const Extension*> extension_list; + std::vector<const extensions::Extension*> extension_list; ExtensionService* service = browser()->profile()->GetExtensionService(); for (ExtensionSet::const_iterator it = service->extensions()->begin(); it != service->extensions()->end(); ++it) { - if ((*it)->location() == Extension::COMPONENT) + if ((*it)->location() == extensions::Extension::COMPONENT) continue; if (service->AllowFileAccess(*it)) extension_list.push_back(*it); diff --git a/chrome/browser/extensions/extension_sync_bundle.h b/chrome/browser/extensions/extension_sync_bundle.h index 2945442..8d6379a 100644 --- a/chrome/browser/extensions/extension_sync_bundle.h +++ b/chrome/browser/extensions/extension_sync_bundle.h @@ -17,13 +17,14 @@ #include "sync/api/syncable_service.h" class SyncChangeProcessor; -class Extension; class ExtensionService; class ExtensionSet; class SyncErrorFactory; namespace extensions { +class Extension; + // Bundle of extension specific sync stuff. class ExtensionSyncBundle { public: diff --git a/chrome/browser/extensions/extension_sync_data.h b/chrome/browser/extensions/extension_sync_data.h index 9dd1514..ef3a92b 100644 --- a/chrome/browser/extensions/extension_sync_data.h +++ b/chrome/browser/extensions/extension_sync_data.h @@ -13,7 +13,6 @@ #include "googleurl/src/gurl.h" #include "sync/api/sync_change.h" -class Extension; class SyncData; namespace sync_pb { @@ -22,6 +21,8 @@ class ExtensionSpecifics; namespace extensions { +class Extension; + // A class that encapsulates the synced properties of an Extension. class ExtensionSyncData { public: diff --git a/chrome/browser/extensions/extension_system.cc b/chrome/browser/extensions/extension_system.cc index 9385568..1cc0ccc 100644 --- a/chrome/browser/extensions/extension_system.cc +++ b/chrome/browser/extensions/extension_system.cc @@ -302,9 +302,9 @@ ExtensionSystemImpl::rules_registry_service() { } void ExtensionSystemImpl::RegisterExtensionWithRequestContexts( - const Extension* extension) { + const extensions::Extension* extension) { base::Time install_time; - if (extension->location() != Extension::COMPONENT) { + if (extension->location() != extensions::Extension::COMPONENT) { install_time = extension_service()->extension_prefs()-> GetInstallTime(extension->id()); } diff --git a/chrome/browser/extensions/extension_system.h b/chrome/browser/extensions/extension_system.h index 9b1d14ad..2ae71cc 100644 --- a/chrome/browser/extensions/extension_system.h +++ b/chrome/browser/extensions/extension_system.h @@ -13,7 +13,6 @@ #include "chrome/browser/profiles/profile_keyed_service.h" #include "chrome/common/extensions/extension_constants.h" -class Extension; class ExtensionDevToolsManager; class ExtensionEventRouter; class ExtensionInfoMap; @@ -27,6 +26,7 @@ class UserScriptMaster; namespace extensions { class AlarmManager; +class Extension; class LazyBackgroundTaskQueue; class RulesRegistryService; } @@ -89,7 +89,7 @@ class ExtensionSystem : public ProfileKeyedService { // avoid race conditions by making sure URLRequestContexts learn about new // extensions before anything else needs them to know. virtual void RegisterExtensionWithRequestContexts( - const Extension* extension) {} + const extensions::Extension* extension) {} // Called by the ExtensionService that lives in this system. Lets the // info map clean up its RequestContexts once all the listeners to the @@ -129,7 +129,7 @@ class ExtensionSystemImpl : public ExtensionSystem { OVERRIDE; // shared virtual void RegisterExtensionWithRequestContexts( - const Extension* extension) OVERRIDE; + const extensions::Extension* extension) OVERRIDE; virtual void UnregisterExtensionWithRequestContexts( const std::string& extension_id, diff --git a/chrome/browser/extensions/extension_tab_helper.cc b/chrome/browser/extensions/extension_tab_helper.cc index 8f1a554..c7c1c5c 100644 --- a/chrome/browser/extensions/extension_tab_helper.cc +++ b/chrome/browser/extensions/extension_tab_helper.cc @@ -31,6 +31,7 @@ #include "ui/gfx/image/image.h" using content::WebContents; +using extensions::Extension; using extensions::ScriptBadgeController; using extensions::ScriptExecutorImpl; using extensions::PageActionController; diff --git a/chrome/browser/extensions/extension_tab_helper.h b/chrome/browser/extensions/extension_tab_helper.h index fcda259..d4a4402 100644 --- a/chrome/browser/extensions/extension_tab_helper.h +++ b/chrome/browser/extensions/extension_tab_helper.h @@ -16,7 +16,6 @@ #include "content/public/browser/web_contents_observer.h" #include "third_party/skia/include/core/SkBitmap.h" -class Extension; class ExtensionTabHelperDelegate; class TabContentsWrapper; struct WebApplicationInfo; @@ -27,6 +26,7 @@ struct LoadCommittedDetails; namespace extensions { class ActionBoxController; +class Extension; class ScriptBadgeController; class ScriptExecutor; } @@ -79,7 +79,7 @@ class ExtensionTabHelper // NOTE: this should only be manipulated before the tab is added to a browser. // TODO(sky): resolve if this is the right way to identify an app tab. If it // is, than this should be passed in the constructor. - void SetExtensionApp(const Extension* extension); + void SetExtensionApp(const extensions::Extension* extension); // Convenience for setting the app extension by id. This does nothing if // |extension_app_id| is empty, or an extension can't be found given the @@ -89,7 +89,7 @@ class ExtensionTabHelper // Set just the app icon, used by panels created by an extension. void SetExtensionAppIconById(const std::string& extension_app_id); - const Extension* extension_app() const { return extension_app_; } + const extensions::Extension* extension_app() const { return extension_app_; } bool is_app() const { return extension_app_ != NULL; } const WebApplicationInfo& web_app_info() const { return web_app_info_; @@ -150,9 +150,10 @@ class ExtensionTabHelper // Resets app_icon_ and if |extension| is non-null creates a new // ImageLoadingTracker to load the extension's image. - void UpdateExtensionAppIcon(const Extension* extension); + void UpdateExtensionAppIcon(const extensions::Extension* extension); - const Extension* GetExtension(const std::string& extension_app_id); + const extensions::Extension* GetExtension( + const std::string& extension_app_id); // ImageLoadingTracker::Observer. virtual void OnImageLoaded(const gfx::Image& image, @@ -183,7 +184,7 @@ class ExtensionTabHelper // If non-null this tab is an app tab and this is the extension the tab was // created for. - const Extension* extension_app_; + const extensions::Extension* extension_app_; // Icon for extension_app_ (if non-null) or a manually-set icon for // non-extension apps. diff --git a/chrome/browser/extensions/extension_tab_util.cc b/chrome/browser/extensions/extension_tab_util.cc index ba6a778..2e2db28 100644 --- a/chrome/browser/extensions/extension_tab_util.cc +++ b/chrome/browser/extensions/extension_tab_util.cc @@ -207,7 +207,7 @@ bool ExtensionTabUtil::GetTabById(int tab_id, } GURL ExtensionTabUtil::ResolvePossiblyRelativeURL(const std::string& url_string, - const Extension* extension) { + const extensions::Extension* extension) { GURL url = GURL(url_string); if (!url.is_valid()) url = extension->GetResourceURL(url_string); diff --git a/chrome/browser/extensions/extension_tab_util.h b/chrome/browser/extensions/extension_tab_util.h index ed0f1a5..d6659e6 100644 --- a/chrome/browser/extensions/extension_tab_util.h +++ b/chrome/browser/extensions/extension_tab_util.h @@ -9,7 +9,6 @@ #include <string> class Browser; -class Extension; class GURL; class Profile; class TabContentsWrapper; @@ -24,6 +23,10 @@ namespace content { class WebContents; } +namespace extensions { +class Extension; +} + // Provides various utility functions that help manipulate tabs. class ExtensionTabUtil { public: @@ -71,7 +74,7 @@ class ExtensionTabUtil { // extension base, we decided it wasn't worth breaking existing extensions to // fix. static GURL ResolvePossiblyRelativeURL(const std::string& url_string, - const Extension* extension); + const extensions::Extension* extension); // Returns true if |url| is used for testing crashes. static bool IsCrashURL(const GURL& url); diff --git a/chrome/browser/extensions/extension_tabs_module.h b/chrome/browser/extensions/extension_tabs_module.h index 7d9d81d..58ee8ed 100644 --- a/chrome/browser/extensions/extension_tabs_module.h +++ b/chrome/browser/extensions/extension_tabs_module.h @@ -16,19 +16,21 @@ #include "googleurl/src/gurl.h" class BackingStore; -class Extension; class GURL; class SkBitmap; class TabContentsWrapper; + namespace base { class DictionaryValue; -} // namespace base +} + namespace content { class WebContents; -} // namespace content +} + namespace skia { class PlatformCanvas; -} // namespace skia +} // Windows class GetWindowFunction : public SyncExtensionFunction { diff --git a/chrome/browser/extensions/extension_tabs_test.cc b/chrome/browser/extensions/extension_tabs_test.cc index 58e2bb7..393a9c0 100644 --- a/chrome/browser/extensions/extension_tabs_test.cc +++ b/chrome/browser/extensions/extension_tabs_test.cc @@ -247,7 +247,8 @@ IN_PROC_BROWSER_TEST_F(ExtensionTabsTest, UpdateNoPermissions) { // The test empty extension has no permissions, therefore it should not get // tab data in the function result. scoped_refptr<UpdateTabFunction> update_tab_function(new UpdateTabFunction()); - scoped_refptr<Extension> empty_extension(utils::CreateEmptyExtension()); + scoped_refptr<extensions::Extension> empty_extension( + utils::CreateEmptyExtension()); update_tab_function->set_extension(empty_extension.get()); // Without a callback the function will not generate a result. update_tab_function->set_has_callback(true); diff --git a/chrome/browser/extensions/extension_toolbar_model.cc b/chrome/browser/extensions/extension_toolbar_model.cc index 5c063a8..d1ea347 100644 --- a/chrome/browser/extensions/extension_toolbar_model.cc +++ b/chrome/browser/extensions/extension_toolbar_model.cc @@ -15,6 +15,9 @@ #include "content/public/browser/notification_details.h" #include "content/public/browser/notification_source.h" +using extensions::Extension; +using extensions::ExtensionList; + ExtensionToolbarModel::ExtensionToolbarModel(ExtensionService* service) : service_(service), prefs_(service->profile()->GetPrefs()), @@ -101,7 +104,8 @@ void ExtensionToolbarModel::Observe( const Extension* extension = NULL; if (type == chrome::NOTIFICATION_EXTENSION_UNLOADED) { - extension = content::Details<UnloadedExtensionInfo>(details)->extension; + extension = content::Details<extensions::UnloadedExtensionInfo>( + details)->extension; } else { extension = content::Details<const Extension>(details).ptr(); } diff --git a/chrome/browser/extensions/extension_toolbar_model.h b/chrome/browser/extensions/extension_toolbar_model.h index 8dca018..530340a 100644 --- a/chrome/browser/extensions/extension_toolbar_model.h +++ b/chrome/browser/extensions/extension_toolbar_model.h @@ -28,13 +28,15 @@ class ExtensionToolbarModel : public content::NotificationObserver { public: // An extension with a browser action button has been added, and should go // in the toolbar at |index|. - virtual void BrowserActionAdded(const Extension* extension, int index) {} + virtual void BrowserActionAdded(const extensions::Extension* extension, + int index) {} // The browser action button for |extension| should no longer show. - virtual void BrowserActionRemoved(const Extension* extension) {} + virtual void BrowserActionRemoved(const extensions::Extension* extension) {} // The browser action button for |extension| has been moved to |index|. - virtual void BrowserActionMoved(const Extension* extension, int index) {} + virtual void BrowserActionMoved(const extensions::Extension* extension, + int index) {} // The browser action button for |extension_id| (which was not a popup) was // clicked, executing it. @@ -51,7 +53,7 @@ class ExtensionToolbarModel : public content::NotificationObserver { // Functions called by the view. void AddObserver(Observer* observer); void RemoveObserver(Observer* observer); - void MoveBrowserAction(const Extension* extension, int index); + void MoveBrowserAction(const extensions::Extension* extension, int index); void ExecuteBrowserAction(const std::string& extension_id, Browser* browser); // If count == size(), this will set the visible icon count to -1, meaning // "show all actions". @@ -65,15 +67,15 @@ class ExtensionToolbarModel : public content::NotificationObserver { return toolitems_.size(); } - ExtensionList::iterator begin() { + extensions::ExtensionList::iterator begin() { return toolitems_.begin(); } - ExtensionList::iterator end() { + extensions::ExtensionList::iterator end() { return toolitems_.end(); } - const Extension* GetExtensionByIndex(int index) const; + const extensions::Extension* GetExtensionByIndex(int index) const; // Utility functions for converting between an index into the list of // incognito-enabled browser actions, and the list of all browser actions. @@ -97,8 +99,8 @@ class ExtensionToolbarModel : public content::NotificationObserver { // Our observers. ObserverList<Observer> observers_; - void AddExtension(const Extension* extension); - void RemoveExtension(const Extension* extension); + void AddExtension(const extensions::Extension* extension); + void RemoveExtension(const extensions::Extension* extension); // Our ExtensionService, guaranteed to outlive us. ExtensionService* service_; @@ -109,7 +111,7 @@ class ExtensionToolbarModel : public content::NotificationObserver { bool extensions_initialized_; // Ordered list of browser action buttons. - ExtensionList toolitems_; + extensions::ExtensionList toolitems_; // Keeps track of what the last extension to get disabled was. std::string last_extension_removed_; diff --git a/chrome/browser/extensions/extension_toolbar_model_browsertest.cc b/chrome/browser/extensions/extension_toolbar_model_browsertest.cc index bf74f3c..8221c66 100644 --- a/chrome/browser/extensions/extension_toolbar_model_browsertest.cc +++ b/chrome/browser/extensions/extension_toolbar_model_browsertest.cc @@ -10,6 +10,8 @@ #include "chrome/common/chrome_switches.h" #include "chrome/test/base/in_process_browser_test.h" +using extensions::Extension; + // An InProcessBrowserTest for testing the ExtensionToolbarModel. // TODO(erikkay) It's unfortunate that this needs to be an in-proc browser test. // It would be nice to refactor things so that ExtensionService could run @@ -48,7 +50,8 @@ class ExtensionToolbarModelTest : public ExtensionBrowserTest, } const Extension* ExtensionAt(int index) { - for (ExtensionList::iterator i = model_->begin(); i < model_->end(); ++i) { + for (extensions::ExtensionList::iterator i = model_->begin(); + i < model_->end(); ++i) { if (index-- == 0) return *i; } diff --git a/chrome/browser/extensions/extension_ui_unittest.cc b/chrome/browser/extensions/extension_ui_unittest.cc index 190fe68..e55c0ad 100644 --- a/chrome/browser/extensions/extension_ui_unittest.cc +++ b/chrome/browser/extensions/extension_ui_unittest.cc @@ -10,6 +10,7 @@ #include "chrome/common/extensions/extension.h" #include "testing/gtest/include/gtest/gtest.h" +using extensions::Extension; class ExtensionUITest : public testing::Test { protected: diff --git a/chrome/browser/extensions/extension_uninstall_dialog.cc b/chrome/browser/extensions/extension_uninstall_dialog.cc index 554e929..13c718e 100644 --- a/chrome/browser/extensions/extension_uninstall_dialog.cc +++ b/chrome/browser/extensions/extension_uninstall_dialog.cc @@ -29,7 +29,8 @@ ExtensionUninstallDialog::ExtensionUninstallDialog( ExtensionUninstallDialog::~ExtensionUninstallDialog() {} -void ExtensionUninstallDialog::ConfirmUninstall(const Extension* extension) { +void ExtensionUninstallDialog::ConfirmUninstall( + const extensions::Extension* extension) { DCHECK(ui_loop_ == MessageLoop::current()); extension_ = extension; diff --git a/chrome/browser/extensions/extension_uninstall_dialog.h b/chrome/browser/extensions/extension_uninstall_dialog.h index b03561d..83b4ab1 100644 --- a/chrome/browser/extensions/extension_uninstall_dialog.h +++ b/chrome/browser/extensions/extension_uninstall_dialog.h @@ -15,6 +15,10 @@ class MessageLoop; class Profile; +namespace extensions { +class Extension; +} + class ExtensionUninstallDialog : public ImageLoadingTracker::Observer, public base::SupportsWeakPtr<ExtensionUninstallDialog> { @@ -41,7 +45,7 @@ class ExtensionUninstallDialog // Starts the process of showing a confirmation UI, which is split into two. // 1) Set off a 'load icon' task. // 2) Handle the load icon response and show the UI (OnImageLoaded). - void ConfirmUninstall(const Extension* extension); + void ConfirmUninstall(const extensions::Extension* extension); protected: // Constructor used by the derived classes. @@ -53,7 +57,7 @@ class ExtensionUninstallDialog Delegate* delegate_; // The extension we are showing the dialog for. - const Extension* extension_; + const extensions::Extension* extension_; // The extensions icon. SkBitmap icon_; diff --git a/chrome/browser/extensions/extension_web_ui.cc b/chrome/browser/extensions/extension_web_ui.cc index 809e9df..429f5bb 100644 --- a/chrome/browser/extensions/extension_web_ui.cc +++ b/chrome/browser/extensions/extension_web_ui.cc @@ -35,6 +35,7 @@ #include "ui/gfx/favicon_size.h" using content::WebContents; +using extensions::Extension; namespace { diff --git a/chrome/browser/extensions/extension_web_ui.h b/chrome/browser/extensions/extension_web_ui.h index 60eb446..e67e748 100644 --- a/chrome/browser/extensions/extension_web_ui.h +++ b/chrome/browser/extensions/extension_web_ui.h @@ -42,9 +42,9 @@ class ExtensionWebUI : public content::WebUIController { // Page names are the keys, and chrome-extension: URLs are the values. // (e.g. { "newtab": "chrome-extension://<id>/my_new_tab.html" } static void RegisterChromeURLOverrides(Profile* profile, - const Extension::URLOverrideMap& overrides); + const extensions::Extension::URLOverrideMap& overrides); static void UnregisterChromeURLOverrides(Profile* profile, - const Extension::URLOverrideMap& overrides); + const extensions::Extension::URLOverrideMap& overrides); static void UnregisterChromeURLOverride(const std::string& page, Profile* profile, base::Value* override); diff --git a/chrome/browser/extensions/extension_webkit_preferences.cc b/chrome/browser/extensions/extension_webkit_preferences.cc index 0cf402c..672ba58 100644 --- a/chrome/browser/extensions/extension_webkit_preferences.cc +++ b/chrome/browser/extensions/extension_webkit_preferences.cc @@ -11,7 +11,7 @@ namespace extension_webkit_preferences { -void SetPreferences(const Extension* extension, +void SetPreferences(const extensions::Extension* extension, content::ViewType render_view_type, webkit_glue::WebPreferences* webkit_prefs) { if (!extension) @@ -51,7 +51,7 @@ void SetPreferences(const Extension* extension, // sometimes loaded with chrome-extension: URLs - we should expect the // performance characteristics to be similar in both cases. const CommandLine& command_line = *CommandLine::ForCurrentProcess(); - if (extension->location() == Extension::COMPONENT && + if (extension->location() == extensions::Extension::COMPONENT && !command_line.HasSwitch(switches::kAllowWebUICompositing)) { webkit_prefs->accelerated_compositing_enabled = false; webkit_prefs->accelerated_2d_canvas_enabled = false; diff --git a/chrome/browser/extensions/extension_webkit_preferences.h b/chrome/browser/extensions/extension_webkit_preferences.h index f5c1fb4..e793bb0 100644 --- a/chrome/browser/extensions/extension_webkit_preferences.h +++ b/chrome/browser/extensions/extension_webkit_preferences.h @@ -7,7 +7,9 @@ #include "chrome/common/chrome_view_type.h" +namespace extensions { class Extension; +} namespace webkit_glue { struct WebPreferences; @@ -15,7 +17,7 @@ struct WebPreferences; namespace extension_webkit_preferences { -void SetPreferences(const Extension* extension, +void SetPreferences(const extensions::Extension* extension, content::ViewType render_view_type, webkit_glue::WebPreferences* webkit_prefs); diff --git a/chrome/browser/extensions/extension_webstore_private_api.cc b/chrome/browser/extensions/extension_webstore_private_api.cc index f2d1135..8aa813b 100644 --- a/chrome/browser/extensions/extension_webstore_private_api.cc +++ b/chrome/browser/extensions/extension_webstore_private_api.cc @@ -259,7 +259,7 @@ bool BeginInstallWithManifestFunction::RunImpl() { CHECK(details); EXTENSION_FUNCTION_VALIDATE(details->GetString(kIdKey, &id_)); - if (!Extension::IdIsValid(id_)) { + if (!extensions::Extension::IdIsValid(id_)) { SetResult(INVALID_ID); error_ = kInvalidIdError; return false; @@ -448,7 +448,7 @@ void BeginInstallWithManifestFunction::InstallUIAbort(bool user_initiated) { bool CompleteInstallFunction::RunImpl() { std::string id; EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &id)); - if (!Extension::IdIsValid(id)) { + if (!extensions::Extension::IdIsValid(id)) { error_ = kInvalidIdError; return false; } diff --git a/chrome/browser/extensions/extension_webstore_private_api.h b/chrome/browser/extensions/extension_webstore_private_api.h index 912f9d7..4c31ab4 100644 --- a/chrome/browser/extensions/extension_webstore_private_api.h +++ b/chrome/browser/extensions/extension_webstore_private_api.h @@ -145,7 +145,7 @@ class BeginInstallWithManifestFunction // A dummy Extension object we create for the purposes of using // ExtensionInstallUI to prompt for confirmation of the install. - scoped_refptr<Extension> dummy_extension_; + scoped_refptr<extensions::Extension> dummy_extension_; // The class that displays the install prompt. scoped_ptr<ExtensionInstallUI> install_ui_; diff --git a/chrome/browser/extensions/external_extension_provider_impl.cc b/chrome/browser/extensions/external_extension_provider_impl.cc index 46c3385..ea245c3 100644 --- a/chrome/browser/extensions/external_extension_provider_impl.cc +++ b/chrome/browser/extensions/external_extension_provider_impl.cc @@ -40,6 +40,7 @@ #endif using content::BrowserThread; +using extensions::Extension; // Constants for keeping track of extension preferences in a dictionary. const char ExternalExtensionProviderImpl::kExternalCrx[] = "external_crx"; diff --git a/chrome/browser/extensions/external_extension_provider_impl.h b/chrome/browser/extensions/external_extension_provider_impl.h index 1436fdf..9de9374 100644 --- a/chrome/browser/extensions/external_extension_provider_impl.h +++ b/chrome/browser/extensions/external_extension_provider_impl.h @@ -21,6 +21,10 @@ namespace base { class DictionaryValue; } +namespace extensions { +class Extension; +} + // A specialization of the ExternalExtensionProvider that uses an instance // of ExternalExtensionLoader to provide external extensions. This class // can be seen as a bridge between the extension system and an @@ -38,8 +42,8 @@ class ExternalExtensionProviderImpl ExternalExtensionProviderImpl( VisitorInterface* service, ExternalExtensionLoader* loader, - Extension::Location crx_location, - Extension::Location download_location, + extensions::Extension::Location crx_location, + extensions::Extension::Location download_location, int creation_flags); virtual ~ExternalExtensionProviderImpl(); @@ -59,7 +63,7 @@ class ExternalExtensionProviderImpl virtual void VisitRegisteredExtension() OVERRIDE; virtual bool HasExtension(const std::string& id) const OVERRIDE; virtual bool GetExtensionDetails(const std::string& id, - Extension::Location* location, + extensions::Extension::Location* location, scoped_ptr<Version>* version) const OVERRIDE; virtual bool IsReady() const OVERRIDE; @@ -77,11 +81,11 @@ class ExternalExtensionProviderImpl private: // Location for external extensions that are provided by this provider from // local crx files. - const Extension::Location crx_location_; + const extensions::Extension::Location crx_location_; // Location for external extensions that are provided by this provider from // update URLs. - const Extension::Location download_location_; + const extensions::Extension::Location download_location_; // Weak pointer to the object that consumes the external extensions. // This is zeroed out by: ServiceShutdown() diff --git a/chrome/browser/extensions/external_extension_provider_interface.h b/chrome/browser/extensions/external_extension_provider_interface.h index 03951ec..e765e42 100644 --- a/chrome/browser/extensions/external_extension_provider_interface.h +++ b/chrome/browser/extensions/external_extension_provider_interface.h @@ -32,7 +32,7 @@ class ExternalExtensionProviderInterface { const std::string& id, const Version* version, const FilePath& path, - Extension::Location location, + extensions::Extension::Location location, int creation_flags, bool mark_acknowledged) = 0; @@ -42,7 +42,7 @@ class ExternalExtensionProviderInterface { virtual bool OnExternalExtensionUpdateUrlFound( const std::string& id, const GURL& update_url, - Extension::Location location) = 0; + extensions::Extension::Location location) = 0; // Called after all the external extensions have been reported // through the above two methods. |provider| is a pointer to the @@ -74,7 +74,7 @@ class ExternalExtensionProviderInterface { // provider type, it will not be changed. // This function is no longer used outside unit tests. virtual bool GetExtensionDetails(const std::string& id, - Extension::Location* location, + extensions::Extension::Location* location, scoped_ptr<Version>* version) const = 0; // Determines if this provider had loaded the list of external extensions diff --git a/chrome/browser/extensions/external_policy_extension_loader.cc b/chrome/browser/extensions/external_policy_extension_loader.cc index fedeada..c0a9bf9 100644 --- a/chrome/browser/extensions/external_policy_extension_loader.cc +++ b/chrome/browser/extensions/external_policy_extension_loader.cc @@ -26,7 +26,7 @@ bool CheckExtension(const std::string& id, const std::string& update_url) { << "extension: " << update_url; return false; } - if (!Extension::IdIsValid(id)) { + if (!extensions::Extension::IdIsValid(id)) { LOG(WARNING) << "Policy specifies invalid ID for external " << "extension: " << id; return false; diff --git a/chrome/browser/extensions/external_policy_extension_loader_unittest.cc b/chrome/browser/extensions/external_policy_extension_loader_unittest.cc index cd5c3c4..69b5e0c 100644 --- a/chrome/browser/extensions/external_policy_extension_loader_unittest.cc +++ b/chrome/browser/extensions/external_policy_extension_loader_unittest.cc @@ -19,6 +19,7 @@ #include "testing/gtest/include/gtest/gtest.h" using content::BrowserThread; +using extensions::Extension; class ExternalPolicyExtensionProviderTest : public testing::Test { public: diff --git a/chrome/browser/extensions/external_registry_extension_loader_win.cc b/chrome/browser/extensions/external_registry_extension_loader_win.cc index a494be5..289617c 100644 --- a/chrome/browser/extensions/external_registry_extension_loader_win.cc +++ b/chrome/browser/extensions/external_registry_extension_loader_win.cc @@ -120,7 +120,7 @@ void ExternalRegistryExtensionLoader::LoadOnFileThread() { std::string id = WideToASCII(*it); StringToLowerASCII(&id); - if (!Extension::IdIsValid(id)) { + if (!extensions::Extension::IdIsValid(id)) { LOG(ERROR) << "Invalid id value " << id << " for key " << key_path << "."; continue; diff --git a/chrome/browser/extensions/image_loading_tracker.cc b/chrome/browser/extensions/image_loading_tracker.cc index ab43b06..65d47ad 100644 --- a/chrome/browser/extensions/image_loading_tracker.cc +++ b/chrome/browser/extensions/image_loading_tracker.cc @@ -22,6 +22,7 @@ #include "webkit/glue/image_decoder.h" using content::BrowserThread; +using extensions::Extension; //////////////////////////////////////////////////////////////////////////////// // ImageLoadingTracker::Observer @@ -327,7 +328,7 @@ void ImageLoadingTracker::Observe(int type, DCHECK(type == chrome::NOTIFICATION_EXTENSION_UNLOADED); const Extension* extension = - content::Details<UnloadedExtensionInfo>(details)->extension; + content::Details<extensions::UnloadedExtensionInfo>(details)->extension; // Remove reference to this extension from all pending load entries. This // ensures we don't attempt to cache the image when the load completes. diff --git a/chrome/browser/extensions/image_loading_tracker.h b/chrome/browser/extensions/image_loading_tracker.h index be89d34..8c92bf6 100644 --- a/chrome/browser/extensions/image_loading_tracker.h +++ b/chrome/browser/extensions/image_loading_tracker.h @@ -16,9 +16,12 @@ #include "content/public/browser/notification_registrar.h" #include "ui/gfx/size.h" -class Extension; class SkBitmap; +namespace extensions { +class Extension; +} + namespace gfx { class Image; } @@ -77,7 +80,7 @@ class ImageLoadingTracker : public content::NotificationObserver { // |max_size| it will be resized to those dimensions. IMPORTANT NOTE: this // function may call back your observer synchronously (ie before it returns) // if the image was found in the cache. - void LoadImage(const Extension* extension, + void LoadImage(const extensions::Extension* extension, const ExtensionResource& resource, const gfx::Size& max_size, CacheParam cache); @@ -85,7 +88,7 @@ class ImageLoadingTracker : public content::NotificationObserver { // Same as LoadImage() above except it loads multiple images from the same // extension. This is used to load multiple resolutions of the same image // type. - void LoadImages(const Extension* extension, + void LoadImages(const extensions::Extension* extension, const std::vector<ImageInfo>& info_list, CacheParam cache); @@ -100,7 +103,7 @@ class ImageLoadingTracker : public content::NotificationObserver { PendingLoadInfo(); ~PendingLoadInfo(); - const Extension* extension; + const extensions::Extension* extension; // This is cached separate from |extension| in case the extension in // unloaded. std::string extension_id; @@ -126,7 +129,7 @@ class ImageLoadingTracker : public content::NotificationObserver { // Checks whether image is a component extension resource. Returns false // if a given |resource| does not have a corresponding image in bundled // resources. Otherwise fills |resource_id|. - bool IsComponentExtensionResource(const Extension* extension, + bool IsComponentExtensionResource(const extensions::Extension* extension, const ExtensionResource& resource, int& resource_id) const; diff --git a/chrome/browser/extensions/image_loading_tracker_unittest.cc b/chrome/browser/extensions/image_loading_tracker_unittest.cc index edbbcee..9fd69f3 100644 --- a/chrome/browser/extensions/image_loading_tracker_unittest.cc +++ b/chrome/browser/extensions/image_loading_tracker_unittest.cc @@ -21,6 +21,7 @@ #include "ui/gfx/size.h" using content::BrowserThread; +using extensions::Extension; class ImageLoadingTrackerTest : public testing::Test, public ImageLoadingTracker::Observer { @@ -168,12 +169,12 @@ TEST_F(ImageLoadingTrackerTest, DeleteExtensionWhileWaitingForCache) { EXPECT_EQ(0, image_loaded_count()); // Send out notification the extension was uninstalled. - UnloadedExtensionInfo details(extension.get(), - extension_misc::UNLOAD_REASON_UNINSTALL); + extensions::UnloadedExtensionInfo details(extension.get(), + extension_misc::UNLOAD_REASON_UNINSTALL); content::NotificationService::current()->Notify( chrome::NOTIFICATION_EXTENSION_UNLOADED, content::NotificationService::AllSources(), - content::Details<UnloadedExtensionInfo>(&details)); + content::Details<extensions::UnloadedExtensionInfo>(&details)); // Chuck the extension, that way if anyone tries to access it we should crash // or get valgrind errors. diff --git a/chrome/browser/extensions/installed_loader.cc b/chrome/browser/extensions/installed_loader.cc index 4cd5af2..26fe121 100644 --- a/chrome/browser/extensions/installed_loader.cc +++ b/chrome/browser/extensions/installed_loader.cc @@ -23,6 +23,8 @@ using content::BrowserThread; using content::UserMetricsAction; +using extensions::Extension; +using extensions::ExtensionInfo; namespace errors = extension_manifest_errors; diff --git a/chrome/browser/extensions/installed_loader.h b/chrome/browser/extensions/installed_loader.h index 774f10c..bd4ef079 100644 --- a/chrome/browser/extensions/installed_loader.h +++ b/chrome/browser/extensions/installed_loader.h @@ -6,13 +6,13 @@ #define CHROME_BROWSER_EXTENSIONS_INSTALLED_LOADER_H_ #pragma once -class Extension; class ExtensionPrefs; class ExtensionService; -struct ExtensionInfo; namespace extensions { +struct ExtensionInfo; + // Loads installed extensions from the prefs. class InstalledLoader { public: diff --git a/chrome/browser/extensions/isolated_app_browsertest.cc b/chrome/browser/extensions/isolated_app_browsertest.cc index 94e993b..6664eac 100644 --- a/chrome/browser/extensions/isolated_app_browsertest.cc +++ b/chrome/browser/extensions/isolated_app_browsertest.cc @@ -35,8 +35,8 @@ class IsolatedAppTest : public ExtensionBrowserTest { return actual_cookie.find(cookie) != std::string::npos; } - const Extension* GetInstalledApp(WebContents* contents) { - const Extension* installed_app = NULL; + const extensions::Extension* GetInstalledApp(WebContents* contents) { + const extensions::Extension* installed_app = NULL; Profile* profile = Profile::FromBrowserContext(contents->GetBrowserContext()); ExtensionService* service = profile->GetExtensionService(); diff --git a/chrome/browser/extensions/lazy_background_page_apitest.cc b/chrome/browser/extensions/lazy_background_page_apitest.cc index d5ddf9d..d257fcc 100644 --- a/chrome/browser/extensions/lazy_background_page_apitest.cc +++ b/chrome/browser/extensions/lazy_background_page_apitest.cc @@ -26,6 +26,8 @@ #include "googleurl/src/gurl.h" #include "net/base/mock_host_resolver.h" +using extensions::Extension; + namespace { // Helper class to wait for a lazy background page to load and close again. class LazyBackgroundObserver { diff --git a/chrome/browser/extensions/lazy_background_task_queue.h b/chrome/browser/extensions/lazy_background_task_queue.h index abe71b2..d38c152 100644 --- a/chrome/browser/extensions/lazy_background_task_queue.h +++ b/chrome/browser/extensions/lazy_background_task_queue.h @@ -17,12 +17,13 @@ #include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_registrar.h" -class Extension; class ExtensionHost; class Profile; namespace extensions { +class Extension; + // This class maintains a queue of tasks that should execute when an // extension's lazy background page is loaded. It is also in charge of loading // the page when the first task is queued. diff --git a/chrome/browser/extensions/pending_extension_info.cc b/chrome/browser/extensions/pending_extension_info.cc index d874626..38089d9 100644 --- a/chrome/browser/extensions/pending_extension_info.cc +++ b/chrome/browser/extensions/pending_extension_info.cc @@ -10,7 +10,7 @@ PendingExtensionInfo::PendingExtensionInfo( ShouldAllowInstallPredicate should_allow_install, bool is_from_sync, bool install_silently, - Extension::Location install_source) + extensions::Extension::Location install_source) : update_url_(update_url), version_(version), should_allow_install_(should_allow_install), @@ -23,4 +23,4 @@ PendingExtensionInfo::PendingExtensionInfo() should_allow_install_(NULL), is_from_sync_(true), install_silently_(false), - install_source_(Extension::INVALID) {} + install_source_(extensions::Extension::INVALID) {} diff --git a/chrome/browser/extensions/pending_extension_info.h b/chrome/browser/extensions/pending_extension_info.h index fc7fd04..7af7074 100644 --- a/chrome/browser/extensions/pending_extension_info.h +++ b/chrome/browser/extensions/pending_extension_info.h @@ -18,7 +18,7 @@ // PendingExtensionManager, and remove all other users. class PendingExtensionInfo { public: - typedef bool (*ShouldAllowInstallPredicate)(const Extension&); + typedef bool (*ShouldAllowInstallPredicate)(const extensions::Extension&); PendingExtensionInfo( const GURL& update_url, @@ -26,7 +26,7 @@ class PendingExtensionInfo { ShouldAllowInstallPredicate should_allow_install, bool is_from_sync, bool install_silently, - Extension::Location install_source); + extensions::Extension::Location install_source); // Required for STL container membership. Should not be used directly. PendingExtensionInfo(); @@ -40,12 +40,14 @@ class PendingExtensionInfo { // If not, the extension is discarded. This allows creators of // PendingExtensionInfo objects to ensure that extensions meet some criteria // that can only be tested once the extension is unpacked. - bool ShouldAllowInstall(const Extension& extension) const { + bool ShouldAllowInstall(const extensions::Extension& extension) const { return should_allow_install_(extension); } bool is_from_sync() const { return is_from_sync_; } bool install_silently() const { return install_silently_; } - Extension::Location install_source() const { return install_source_; } + extensions::Extension::Location install_source() const { + return install_source_; + } private: GURL update_url_; @@ -58,7 +60,7 @@ class PendingExtensionInfo { bool is_from_sync_; // This update check was initiated from sync. bool install_silently_; - Extension::Location install_source_; + extensions::Extension::Location install_source_; FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, AddPendingExtensionFromSync); }; diff --git a/chrome/browser/extensions/pending_extension_manager.cc b/chrome/browser/extensions/pending_extension_manager.cc index 8677111..c2f9c60 100644 --- a/chrome/browser/extensions/pending_extension_manager.cc +++ b/chrome/browser/extensions/pending_extension_manager.cc @@ -11,6 +11,7 @@ #include "content/public/browser/browser_thread.h" using content::BrowserThread; +using extensions::Extension; namespace { diff --git a/chrome/browser/extensions/pending_extension_manager.h b/chrome/browser/extensions/pending_extension_manager.h index 4aeecbf..8668892 100644 --- a/chrome/browser/extensions/pending_extension_manager.h +++ b/chrome/browser/extensions/pending_extension_manager.h @@ -74,14 +74,14 @@ class PendingExtensionManager { // to be fetched, installed, and activated. bool AddFromExternalUpdateUrl(const std::string& id, const GURL& update_url, - Extension::Location location); + extensions::Extension::Location location); // Add a pending extension record for an external CRX file. // Return true if the CRX should be installed, false if an existing // pending record overrides it. bool AddFromExternalFile( const std::string& id, - Extension::Location location, + extensions::Extension::Location location, const Version& version); // Get the set of pending IDs that should be installed from an update URL. @@ -102,7 +102,7 @@ class PendingExtensionManager { PendingExtensionInfo::ShouldAllowInstallPredicate should_allow_install, bool is_from_sync, bool install_silently, - Extension::Location install_source); + extensions::Extension::Location install_source); // Add a pending extension record directly. Used for unit tests that need // to set an inital state. Use friendship to allow the tests to call this diff --git a/chrome/browser/extensions/permissions_updater.h b/chrome/browser/extensions/permissions_updater.h index 0640f2d..863e620 100644 --- a/chrome/browser/extensions/permissions_updater.h +++ b/chrome/browser/extensions/permissions_updater.h @@ -10,16 +10,18 @@ #include "base/memory/ref_counted.h" -namespace base { -class DictionaryValue; -} -class Extension; class ExtensionPermissionSet; class ExtensionPrefs; class Profile; +namespace base { +class DictionaryValue; +} + namespace extensions { +class Extension; + // Updates an Extension's active and granted permissions in persistent storage // and notifies interested parties of the changes. class PermissionsUpdater { diff --git a/chrome/browser/extensions/platform_app_browsertest.cc b/chrome/browser/extensions/platform_app_browsertest.cc index 44f615a..4fb84ae 100644 --- a/chrome/browser/extensions/platform_app_browsertest.cc +++ b/chrome/browser/extensions/platform_app_browsertest.cc @@ -65,7 +65,7 @@ class PlatformAppBrowserTest : public ExtensionApiTest { AppendASCII(name))); ExtensionService* service = browser()->profile()->GetExtensionService(); - const Extension* extension = service->GetExtensionById( + const extensions::Extension* extension = service->GetExtensionById( last_loaded_extension_id_, false); EXPECT_TRUE(extension); diff --git a/chrome/browser/extensions/process_management_browsertest.cc b/chrome/browser/extensions/process_management_browsertest.cc index 1639161f..9436e14 100644 --- a/chrome/browser/extensions/process_management_browsertest.cc +++ b/chrome/browser/extensions/process_management_browsertest.cc @@ -63,7 +63,7 @@ IN_PROC_BROWSER_TEST_F(ProcessManagementTest, ProcessOverflow) { base_url = base_url.ReplaceComponents(replace_host); // Load an extension before adding tabs. - const Extension* extension1 = LoadExtension( + const extensions::Extension* extension1 = LoadExtension( test_data_dir_.AppendASCII("api_test/browser_action/basics")); ASSERT_TRUE(extension1); GURL extension1_url = extension1->url(); @@ -101,7 +101,7 @@ IN_PROC_BROWSER_TEST_F(ProcessManagementTest, ProcessOverflow) { NEW_FOREGROUND_TAB, ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); // Load another extension. - const Extension* extension2 = LoadExtension( + const extensions::Extension* extension2 = LoadExtension( test_data_dir_.AppendASCII("api_test/browser_action/close_background")); ASSERT_TRUE(extension2); GURL extension2_url = extension2->url(); diff --git a/chrome/browser/extensions/sandboxed_extension_unpacker.cc b/chrome/browser/extensions/sandboxed_extension_unpacker.cc index 52cbebf..a919450 100644 --- a/chrome/browser/extensions/sandboxed_extension_unpacker.cc +++ b/chrome/browser/extensions/sandboxed_extension_unpacker.cc @@ -34,6 +34,7 @@ using content::BrowserThread; using content::UtilityProcessHost; +using extensions::Extension; // The following macro makes histograms that record the length of paths // in this file much easier to read. diff --git a/chrome/browser/extensions/sandboxed_extension_unpacker.h b/chrome/browser/extensions/sandboxed_extension_unpacker.h index 696c4cd..d28b8ed 100644 --- a/chrome/browser/extensions/sandboxed_extension_unpacker.h +++ b/chrome/browser/extensions/sandboxed_extension_unpacker.h @@ -15,8 +15,6 @@ #include "content/public/browser/browser_thread.h" #include "content/public/browser/utility_process_host_client.h" -class Extension; - namespace base { class DictionaryValue; } @@ -37,7 +35,7 @@ class SandboxedExtensionUnpackerClient virtual void OnUnpackSuccess(const FilePath& temp_dir, const FilePath& extension_root, const base::DictionaryValue* original_manifest, - const Extension* extension) = 0; + const extensions::Extension* extension) = 0; virtual void OnUnpackFailure(const string16& error) = 0; protected: @@ -102,7 +100,7 @@ class SandboxedExtensionUnpacker : public content::UtilityProcessHostClient { // is done in a sandboxed subprocess. Otherwise, it is done in-process. SandboxedExtensionUnpacker(const FilePath& crx_path, bool run_out_of_process, - Extension::Location location, + extensions::Extension::Location location, int creation_flags, SandboxedExtensionUnpackerClient* client); @@ -233,7 +231,7 @@ class SandboxedExtensionUnpacker : public content::UtilityProcessHostClient { FilePath extension_root_; // Represents the extension we're unpacking. - scoped_refptr<Extension> extension_; + scoped_refptr<extensions::Extension> extension_; // Whether we've received a response from the utility process yet. bool got_response_; @@ -249,7 +247,7 @@ class SandboxedExtensionUnpacker : public content::UtilityProcessHostClient { base::TimeTicks unpack_start_time_; // Location to use for the unpacked extension. - Extension::Location location_; + extensions::Extension::Location location_; // Creation flags to use for the extension. These flags will be used // when calling Extenion::Create() by the crx installer. diff --git a/chrome/browser/extensions/sandboxed_extension_unpacker_unittest.cc b/chrome/browser/extensions/sandboxed_extension_unpacker_unittest.cc index 205f14f..47887e8 100644 --- a/chrome/browser/extensions/sandboxed_extension_unpacker_unittest.cc +++ b/chrome/browser/extensions/sandboxed_extension_unpacker_unittest.cc @@ -24,6 +24,7 @@ namespace errors = extension_manifest_errors; namespace keys = extension_manifest_keys; using content::BrowserThread; +using extensions::Extension; using testing::_; using testing::Invoke; diff --git a/chrome/browser/extensions/script_badge_controller.h b/chrome/browser/extensions/script_badge_controller.h index 511ac86..436a404 100644 --- a/chrome/browser/extensions/script_badge_controller.h +++ b/chrome/browser/extensions/script_badge_controller.h @@ -16,13 +16,14 @@ #include "chrome/browser/extensions/script_executor_impl.h" #include "content/public/browser/web_contents_observer.h" -class Extension; class ExtensionAction; class ExtensionService; class TabContentsWrapper; namespace extensions { +class Extension; + // An ActionBoxController which corresponds to script badges, and implements // ScriptExecutor in order to show those scripts in the action box too. class ScriptBadgeController : public ActionBoxController, diff --git a/chrome/browser/extensions/test_extension_prefs.cc b/chrome/browser/extensions/test_extension_prefs.cc index fed319d..6ef8bf0 100644 --- a/chrome/browser/extensions/test_extension_prefs.cc +++ b/chrome/browser/extensions/test_extension_prefs.cc @@ -25,6 +25,7 @@ #include "testing/gtest/include/gtest/gtest.h" using content::BrowserThread; +using extensions::Extension; namespace { diff --git a/chrome/browser/extensions/test_extension_prefs.h b/chrome/browser/extensions/test_extension_prefs.h index 25862dd..dc35c42 100644 --- a/chrome/browser/extensions/test_extension_prefs.h +++ b/chrome/browser/extensions/test_extension_prefs.h @@ -38,20 +38,21 @@ class TestExtensionPrefs { // Creates a new Extension with the given name in our temp dir, adds it to // our ExtensionPrefs, and returns it. - scoped_refptr<Extension> AddExtension(std::string name); + scoped_refptr<extensions::Extension> AddExtension(std::string name); // As above, but the extension is an app. - scoped_refptr<Extension> AddApp(std::string name); + scoped_refptr<extensions::Extension> AddApp(std::string name); // Similar to AddExtension, but takes a dictionary with manifest values. - scoped_refptr<Extension> AddExtensionWithManifest( - const base::DictionaryValue& manifest, Extension::Location location); + scoped_refptr<extensions::Extension> AddExtensionWithManifest( + const base::DictionaryValue& manifest, + extensions::Extension::Location location); // Similar to AddExtension, but takes a dictionary with manifest values // and extension flags. - scoped_refptr<Extension> AddExtensionWithManifestAndFlags( + scoped_refptr<extensions::Extension> AddExtensionWithManifestAndFlags( const base::DictionaryValue& manifest, - Extension::Location location, + extensions::Extension::Location location, int extra_flags); // Similar to AddExtension, this adds a new test Extension. This is useful for diff --git a/chrome/browser/extensions/test_extension_service.cc b/chrome/browser/extensions/test_extension_service.cc index bab9ac9..6a8f1ea 100644 --- a/chrome/browser/extensions/test_extension_service.cc +++ b/chrome/browser/extensions/test_extension_service.cc @@ -8,6 +8,8 @@ #include "sync/api/sync_error_factory.h" #include "testing/gtest/include/gtest/gtest.h" +using extensions::Extension; + TestExtensionService::~TestExtensionService() {} const ExtensionSet* TestExtensionService::extensions() const { diff --git a/chrome/browser/extensions/test_extension_service.h b/chrome/browser/extensions/test_extension_service.h index 699f88c..e445f20 100644 --- a/chrome/browser/extensions/test_extension_service.h +++ b/chrome/browser/extensions/test_extension_service.h @@ -14,6 +14,10 @@ class CrxInstaller; class SyncErrorFactory; +namespace extensions { +class Extension; +} + // Implemention of ExtensionServiceInterface with default // implementations for methods that add failures. You should subclass // this and override the methods you care about. @@ -31,9 +35,9 @@ class TestExtensionService : public ExtensionServiceInterface { const FilePath& path, const GURL& download_url, CrxInstaller** out_crx_installer) OVERRIDE; - virtual const Extension* GetExtensionById( + virtual const extensions::Extension* GetExtensionById( const std::string& id, bool include_disabled) const OVERRIDE; - virtual const Extension* GetInstalledExtension( + virtual const extensions::Extension* GetInstalledExtension( const std::string& id) const OVERRIDE; virtual bool IsExtensionEnabled( const std::string& extension_id) const OVERRIDE; @@ -58,13 +62,14 @@ class TestExtensionService : public ExtensionServiceInterface { virtual bool is_ready() OVERRIDE; - virtual void AddExtension(const Extension* extension) OVERRIDE; + virtual void AddExtension(const extensions::Extension* extension) OVERRIDE; virtual void UnloadExtension( const std::string& extension_id, extension_misc::UnloadedExtensionReason reason) OVERRIDE; - virtual void SyncExtensionChangeIfNeeded(const Extension& extension) OVERRIDE; + virtual void SyncExtensionChangeIfNeeded( + const extensions::Extension& extension) OVERRIDE; }; #endif // CHROME_BROWSER_EXTENSIONS_TEST_EXTENSION_SERVICE_H_ diff --git a/chrome/browser/extensions/theme_installed_infobar_delegate.cc b/chrome/browser/extensions/theme_installed_infobar_delegate.cc index e6a9373..36f023b 100644 --- a/chrome/browser/extensions/theme_installed_infobar_delegate.cc +++ b/chrome/browser/extensions/theme_installed_infobar_delegate.cc @@ -23,7 +23,7 @@ ThemeInstalledInfoBarDelegate::ThemeInstalledInfoBarDelegate( InfoBarTabHelper* infobar_helper, ExtensionService* extension_service, ThemeService* theme_service, - const Extension* new_theme, + const extensions::Extension* new_theme, const std::string& previous_theme_id, bool previous_using_native_theme) : ConfirmInfoBarDelegate(infobar_helper), @@ -38,7 +38,8 @@ ThemeInstalledInfoBarDelegate::ThemeInstalledInfoBarDelegate( content::Source<ThemeService>(theme_service_)); } -bool ThemeInstalledInfoBarDelegate::MatchesTheme(const Extension* theme) const { +bool ThemeInstalledInfoBarDelegate::MatchesTheme( + const extensions::Extension* theme) const { return theme && (theme->id() == theme_id_); } @@ -51,7 +52,7 @@ ThemeInstalledInfoBarDelegate::~ThemeInstalledInfoBarDelegate() { bool ThemeInstalledInfoBarDelegate::Cancel() { if (!previous_theme_id_.empty()) { - const Extension* previous_theme = + const extensions::Extension* previous_theme = extension_service_->GetExtensionById(previous_theme_id_, true); if (previous_theme) { theme_service_->SetTheme(previous_theme); diff --git a/chrome/browser/extensions/theme_installed_infobar_delegate.h b/chrome/browser/extensions/theme_installed_infobar_delegate.h index 28cad72..3e7b0d1 100644 --- a/chrome/browser/extensions/theme_installed_infobar_delegate.h +++ b/chrome/browser/extensions/theme_installed_infobar_delegate.h @@ -13,10 +13,13 @@ #include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_registrar.h" -class Extension; class ExtensionService; class ThemeService; +namespace extensions { +class Extension; +} + // When a user installs a theme, we display it immediately, but provide an // infobar allowing them to cancel. class ThemeInstalledInfoBarDelegate : public ConfirmInfoBarDelegate, @@ -25,13 +28,13 @@ class ThemeInstalledInfoBarDelegate : public ConfirmInfoBarDelegate, ThemeInstalledInfoBarDelegate(InfoBarTabHelper* infobar_helper, ExtensionService* extension_service, ThemeService* theme_service, - const Extension* new_theme, + const extensions::Extension* new_theme, const std::string& previous_theme_id, bool previous_using_native_theme); // Returns true if the given theme is the same as the one associated with this // info bar. - bool MatchesTheme(const Extension* theme) const; + bool MatchesTheme(const extensions::Extension* theme) const; protected: virtual ~ThemeInstalledInfoBarDelegate(); diff --git a/chrome/browser/extensions/unpacked_installer.cc b/chrome/browser/extensions/unpacked_installer.cc index 964a69e..39e5513 100644 --- a/chrome/browser/extensions/unpacked_installer.cc +++ b/chrome/browser/extensions/unpacked_installer.cc @@ -16,6 +16,7 @@ #include "chrome/common/string_ordinal.h" using content::BrowserThread; +using extensions::Extension; namespace { diff --git a/chrome/browser/extensions/unpacked_installer.h b/chrome/browser/extensions/unpacked_installer.h index 437e223..ad60d0a 100644 --- a/chrome/browser/extensions/unpacked_installer.h +++ b/chrome/browser/extensions/unpacked_installer.h @@ -12,11 +12,12 @@ #include "base/memory/ref_counted.h" #include "base/memory/weak_ptr.h" -class Extension; class ExtensionService; namespace extensions { +class Extension; + // Installs and loads an unpacked extension. // TODO(erikkay): It might be useful to be able to load a packed extension // (presumably into memory) without installing it. diff --git a/chrome/browser/extensions/user_script_listener.cc b/chrome/browser/extensions/user_script_listener.cc index 689e7e2..987323c 100644 --- a/chrome/browser/extensions/user_script_listener.cc +++ b/chrome/browser/extensions/user_script_listener.cc @@ -164,8 +164,9 @@ void UserScriptListener::ReplaceURLPatterns(void* profile_id, data.url_patterns = patterns; } -void UserScriptListener::CollectURLPatterns(const Extension* extension, - URLPatterns* patterns) { +void UserScriptListener::CollectURLPatterns( + const extensions::Extension* extension, + URLPatterns* patterns) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); const UserScriptList& scripts = extension->content_scripts(); @@ -185,8 +186,8 @@ void UserScriptListener::Observe(int type, switch (type) { case chrome::NOTIFICATION_EXTENSION_LOADED: { Profile* profile = content::Source<Profile>(source).ptr(); - const Extension* extension = - content::Details<const Extension>(details).ptr(); + const extensions::Extension* extension = + content::Details<const extensions::Extension>(details).ptr(); if (extension->content_scripts().empty()) return; // no new patterns from this extension. @@ -202,8 +203,9 @@ void UserScriptListener::Observe(int type, case chrome::NOTIFICATION_EXTENSION_UNLOADED: { Profile* profile = content::Source<Profile>(source).ptr(); - const Extension* unloaded_extension = - content::Details<UnloadedExtensionInfo>(details)->extension; + const extensions::Extension* unloaded_extension = + content::Details<extensions::UnloadedExtensionInfo>( + details)->extension; if (unloaded_extension->content_scripts().empty()) return; // no patterns to delete for this extension. diff --git a/chrome/browser/extensions/user_script_listener.h b/chrome/browser/extensions/user_script_listener.h index 15797bd..163b555 100644 --- a/chrome/browser/extensions/user_script_listener.h +++ b/chrome/browser/extensions/user_script_listener.h @@ -18,7 +18,6 @@ #include "content/public/browser/notification_registrar.h" #include "webkit/glue/resource_type.h" -class Extension; class GURL; class URLPattern; @@ -26,6 +25,10 @@ namespace content { class ResourceThrottle; } +namespace extensions { +class Extension; +} + // This class handles delaying of resource loads that depend on unloaded user // scripts. For each request that comes in, we check if it depends on a user // script, and if so, whether that user script is ready; if not, we delay the @@ -95,7 +98,8 @@ class UserScriptListener // Helper to collect the extension's user script URL patterns in a list and // return it. - void CollectURLPatterns(const Extension* extension, URLPatterns* patterns); + void CollectURLPatterns(const extensions::Extension* extension, + URLPatterns* patterns); // content::NotificationObserver virtual void Observe(int type, diff --git a/chrome/browser/extensions/user_script_listener_unittest.cc b/chrome/browser/extensions/user_script_listener_unittest.cc index 7c0c808..38b628b 100644 --- a/chrome/browser/extensions/user_script_listener_unittest.cc +++ b/chrome/browser/extensions/user_script_listener_unittest.cc @@ -23,6 +23,7 @@ using content::ResourceThrottle; using content::ResourceThrottleController; +using extensions::Extension; namespace { diff --git a/chrome/browser/extensions/user_script_master.cc b/chrome/browser/extensions/user_script_master.cc index af152b4eb..a422139 100644 --- a/chrome/browser/extensions/user_script_master.cc +++ b/chrome/browser/extensions/user_script_master.cc @@ -350,8 +350,8 @@ void UserScriptMaster::Observe(int type, break; case chrome::NOTIFICATION_EXTENSION_LOADED: { // Add any content scripts inside the extension. - const Extension* extension = - content::Details<const Extension>(details).ptr(); + const extensions::Extension* extension = + content::Details<const extensions::Extension>(details).ptr(); extensions_info_[extension->id()] = ExtensionSet::ExtensionPathAndDefaultLocale( extension->path(), extension->default_locale()); @@ -369,8 +369,9 @@ void UserScriptMaster::Observe(int type, } case chrome::NOTIFICATION_EXTENSION_UNLOADED: { // Remove any content scripts. - const Extension* extension = - content::Details<UnloadedExtensionInfo>(details)->extension; + const extensions::Extension* extension = + content::Details<extensions::UnloadedExtensionInfo>( + details)->extension; extensions_info_.erase(extension->id()); UserScriptList new_user_scripts; for (UserScriptList::iterator iter = user_scripts_.begin(); diff --git a/chrome/browser/extensions/webstore_inline_install_browsertest.cc b/chrome/browser/extensions/webstore_inline_install_browsertest.cc index be7b279..e2a5d8a 100644 --- a/chrome/browser/extensions/webstore_inline_install_browsertest.cc +++ b/chrome/browser/extensions/webstore_inline_install_browsertest.cc @@ -94,8 +94,9 @@ IN_PROC_BROWSER_TEST_F(WebstoreInlineInstallTest, Install) { RunInlineInstallTest("runTest"); - const Extension* extension = browser()->profile()->GetExtensionService()-> - GetExtensionById("ecglahbcnmdpdciemllbhojghbkagdje", false); + const extensions::Extension* extension = browser()->profile()-> + GetExtensionService()->GetExtensionById( + "ecglahbcnmdpdciemllbhojghbkagdje", false); EXPECT_TRUE(extension); } diff --git a/chrome/browser/extensions/webstore_inline_installer.cc b/chrome/browser/extensions/webstore_inline_installer.cc index 8b7df47..2fca0f2 100644 --- a/chrome/browser/extensions/webstore_inline_installer.cc +++ b/chrome/browser/extensions/webstore_inline_installer.cc @@ -163,7 +163,7 @@ WebstoreInlineInstaller::WebstoreInlineInstaller(WebContents* web_contents, void WebstoreInlineInstaller::BeginInstall() { AddRef(); // Balanced in CompleteInstall or WebContentsDestroyed. - if (!Extension::IdIsValid(id_)) { + if (!extensions::Extension::IdIsValid(id_)) { CompleteInstall(kInvalidWebstoreItemId); return; } diff --git a/chrome/browser/extensions/webstore_inline_installer.h b/chrome/browser/extensions/webstore_inline_installer.h index 9a8cd60..bd35456 100644 --- a/chrome/browser/extensions/webstore_inline_installer.h +++ b/chrome/browser/extensions/webstore_inline_installer.h @@ -21,6 +21,10 @@ class SafeWebstoreResponseParser; +namespace extensions { +class Extension; +} + // Manages inline installs requested by a page (downloads and parses metadata // from the webstore, shows the install UI, starts the download once the user // confirms). Clients must implement the WebstoreInlineInstaller::Delegate @@ -127,7 +131,7 @@ class WebstoreInlineInstaller int rating_count_; scoped_ptr<DictionaryValue> webstore_data_; scoped_ptr<DictionaryValue> manifest_; - scoped_refptr<Extension> dummy_extension_; + scoped_refptr<extensions::Extension> dummy_extension_; SkBitmap icon_; DISALLOW_IMPLICIT_CONSTRUCTORS(WebstoreInlineInstaller); diff --git a/chrome/browser/extensions/webstore_installer.cc b/chrome/browser/extensions/webstore_installer.cc index b43c2c3..9b22133 100644 --- a/chrome/browser/extensions/webstore_installer.cc +++ b/chrome/browser/extensions/webstore_installer.cc @@ -46,6 +46,8 @@ using content::DownloadUrlParameters; namespace { +using extensions::Extension; + // Key used to attach the Approval to the DownloadItem. const char kApprovalKey[] = "extensions.webstore_installer"; diff --git a/chrome/browser/extensions/window_open_apitest.cc b/chrome/browser/extensions/window_open_apitest.cc index 63a216e..1d2c3fd 100644 --- a/chrome/browser/extensions/window_open_apitest.cc +++ b/chrome/browser/extensions/window_open_apitest.cc @@ -226,7 +226,7 @@ IN_PROC_BROWSER_TEST_F(WindowOpenPanelTest, new ExtensionTestMessageListener(test_strings[i], false)); } - const Extension* extension = LoadExtension( + const extensions::Extension* extension = LoadExtension( test_data_dir_.AppendASCII("window_open").AppendASCII( "close_panels_on_uninstall")); ASSERT_TRUE(extension); diff --git a/chrome/browser/geolocation/chrome_geolocation_permission_context.cc b/chrome/browser/geolocation/chrome_geolocation_permission_context.cc index 4d2465b..7d61875 100644 --- a/chrome/browser/geolocation/chrome_geolocation_permission_context.cc +++ b/chrome/browser/geolocation/chrome_geolocation_permission_context.cc @@ -604,7 +604,7 @@ void ChromeGeolocationPermissionContext::RequestGeolocationPermission( ExtensionService* extension_service = profile_->GetExtensionService(); if (extension_service) { - const Extension* extension = + const extensions::Extension* extension = extension_service->extensions()->GetExtensionOrAppByURL( ExtensionURLInfo( WebSecurityOrigin::createFromString( diff --git a/chrome/browser/history/multipart_browsertest.cc b/chrome/browser/history/multipart_browsertest.cc index ab0d6b1..42229aa 100644 --- a/chrome/browser/history/multipart_browsertest.cc +++ b/chrome/browser/history/multipart_browsertest.cc @@ -31,7 +31,7 @@ class MultipartResponseTest : public InProcessBrowserTest, IN_PROC_BROWSER_TEST_F(MultipartResponseTest, SingleVisit) { // Make sure that visiting a multipart/x-mixed-replace site only - // creates one entry in the visits table. + // creates one entry in the visits table. ASSERT_TRUE(test_server()->Start()); Observe(browser()->GetSelectedWebContents()); diff --git a/chrome/browser/infobars/infobar_extension_api.cc b/chrome/browser/infobars/infobar_extension_api.cc index 3e9c427..6875e6d 100644 --- a/chrome/browser/infobars/infobar_extension_api.cc +++ b/chrome/browser/infobars/infobar_extension_api.cc @@ -22,6 +22,8 @@ #include "content/public/browser/web_contents.h" #include "grit/generated_resources.h" +using extensions::Extension; + namespace { const char kHtmlPath[] = "path"; diff --git a/chrome/browser/intents/web_intents_registry.cc b/chrome/browser/intents/web_intents_registry.cc index ff9c139..558d912 100644 --- a/chrome/browser/intents/web_intents_registry.cc +++ b/chrome/browser/intents/web_intents_registry.cc @@ -19,6 +19,8 @@ #include "googleurl/src/gurl.h" #include "net/base/mime_util.h" +using extensions::Extension; + namespace { typedef WebIntentsRegistry::IntentServiceList IntentServiceList; diff --git a/chrome/browser/intents/web_intents_registry.h b/chrome/browser/intents/web_intents_registry.h index 2faa81c..7874e4f 100644 --- a/chrome/browser/intents/web_intents_registry.h +++ b/chrome/browser/intents/web_intents_registry.h @@ -16,6 +16,10 @@ struct DefaultWebIntentService; +namespace extensions { +class Extension; +} + // Handles storing and retrieving of web intents services in the web database. // The registry provides filtering logic to retrieve specific types of services. class WebIntentsRegistry @@ -107,7 +111,7 @@ class WebIntentsRegistry void CollapseIntents(IntentServiceList* services); private: - const Extension* ExtensionForURL(const std::string& url); + const extensions::Extension* ExtensionForURL(const std::string& url); struct IntentsQuery; diff --git a/chrome/browser/intents/web_intents_registry_unittest.cc b/chrome/browser/intents/web_intents_registry_unittest.cc index d1bc601..82673af 100644 --- a/chrome/browser/intents/web_intents_registry_unittest.cc +++ b/chrome/browser/intents/web_intents_registry_unittest.cc @@ -21,6 +21,7 @@ #include "testing/gtest/include/gtest/gtest.h" using content::BrowserThread; +using extensions::Extension; using webkit_glue::WebIntentServiceData; class MockExtensionService: public TestExtensionService { diff --git a/chrome/browser/memory_details.cc b/chrome/browser/memory_details.cc index 2a6015d..b739a23 100644 --- a/chrome/browser/memory_details.cc +++ b/chrome/browser/memory_details.cc @@ -43,6 +43,7 @@ using content::NavigationEntry; using content::RenderViewHost; using content::RenderWidgetHost; using content::WebContents; +using extensions::Extension; // static std::string ProcessMemoryInformation::GetRendererTypeNameInEnglish( diff --git a/chrome/browser/nacl_host/nacl_process_host.cc b/chrome/browser/nacl_host/nacl_process_host.cc index e1faeba..300a271 100644 --- a/chrome/browser/nacl_host/nacl_process_host.cc +++ b/chrome/browser/nacl_host/nacl_process_host.cc @@ -411,7 +411,7 @@ void NaClProcessHost::OnNaClGdbAttached() { #endif FilePath NaClProcessHost::GetManifestPath() { - const Extension* extension = extension_info_map_->extensions() + const extensions::Extension* extension = extension_info_map_->extensions() .GetExtensionOrAppByURL(ExtensionURLInfo(manifest_url_)); if (extension != NULL && manifest_url_.SchemeIs(chrome::kExtensionScheme)) { std::string path = manifest_url_.path(); diff --git a/chrome/browser/notifications/desktop_notification_service.cc b/chrome/browser/notifications/desktop_notification_service.cc index ff35176..f8527ab 100644 --- a/chrome/browser/notifications/desktop_notification_service.cc +++ b/chrome/browser/notifications/desktop_notification_service.cc @@ -270,8 +270,8 @@ void DesktopNotificationService::Observe( if (type == chrome::NOTIFICATION_EXTENSION_UNLOADED) { // Remove all notifications currently shown or queued by the extension // which was unloaded. - const Extension* extension = - content::Details<UnloadedExtensionInfo>(details)->extension; + const extensions::Extension* extension = + content::Details<extensions::UnloadedExtensionInfo>(details)->extension; if (extension) GetUIManager()->CancelAllBySourceOrigin(extension->url()); } else if (type == chrome::NOTIFICATION_PROFILE_DESTROYED) { @@ -408,7 +408,7 @@ string16 DesktopNotificationService::DisplayNameForOrigin( if (origin.SchemeIs(chrome::kExtensionScheme)) { ExtensionService* extension_service = profile_->GetExtensionService(); if (extension_service) { - const Extension* extension = + const extensions::Extension* extension = extension_service->extensions()->GetExtensionOrAppByURL( ExtensionURLInfo( WebSecurityOrigin::createFromString( diff --git a/chrome/browser/notifications/notification_options_menu_model.cc b/chrome/browser/notifications/notification_options_menu_model.cc index 33c1f00..b598ac8 100644 --- a/chrome/browser/notifications/notification_options_menu_model.cc +++ b/chrome/browser/notifications/notification_options_menu_model.cc @@ -124,7 +124,7 @@ NotificationOptionsMenuModel::NotificationOptionsMenuModel(Balloon* balloon) if (origin.SchemeIs(chrome::kExtensionScheme)) { ExtensionService* extension_service = balloon_->profile()->GetExtensionService(); - const Extension* extension = + const extensions::Extension* extension = extension_service->extensions()->GetExtensionOrAppByURL( ExtensionURLInfo(origin)); // We get back no extension here when we show the notification after @@ -176,7 +176,7 @@ string16 NotificationOptionsMenuModel::GetLabelForCommandId(int command_id) if (origin.SchemeIs(chrome::kExtensionScheme)) { ExtensionService* extension_service = balloon_->profile()->GetExtensionService(); - const Extension* extension = + const extensions::Extension* extension = extension_service->extensions()->GetExtensionOrAppByURL( ExtensionURLInfo(origin)); if (extension) { @@ -234,14 +234,14 @@ void NotificationOptionsMenuModel::ExecuteCommand(int command_id) { service->GrantPermission(origin); break; case kToggleExtensionCommand: { - const Extension* extension = + const extensions::Extension* extension = extension_service->extensions()->GetExtensionOrAppByURL( ExtensionURLInfo(origin)); if (extension) { const std::string& id = extension->id(); if (extension_service->IsExtensionEnabled(id)) extension_service->DisableExtension( - id, Extension::DISABLE_USER_ACTION); + id, extensions::Extension::DISABLE_USER_ACTION); else extension_service->EnableExtension(id); } diff --git a/chrome/browser/password_manager/password_store_factory.h b/chrome/browser/password_manager/password_store_factory.h index faadb87..14b0d37 100644 --- a/chrome/browser/password_manager/password_store_factory.h +++ b/chrome/browser/password_manager/password_store_factory.h @@ -11,7 +11,6 @@ #include "chrome/browser/profiles/refcounted_profile_keyed_service_factory.h" class PasswordStore; -class Extension; class Profile; #if !defined(OS_MACOSX) && !defined(OS_CHROMEOS) && defined(OS_POSIX) diff --git a/chrome/browser/policy/app_pack_updater.cc b/chrome/browser/policy/app_pack_updater.cc index 2de085d..b0f20bf 100644 --- a/chrome/browser/policy/app_pack_updater.cc +++ b/chrome/browser/policy/app_pack_updater.cc @@ -278,7 +278,7 @@ void AppPackUpdater::BlockingCheckCacheInternal( } } - if (!Extension::IdIsValid(id)) { + if (!extensions::Extension::IdIsValid(id)) { LOG(ERROR) << "Bad AppPack extension id in cache: " << id; id.clear(); } else if (!ContainsKey(*valid_ids, id)) { diff --git a/chrome/browser/policy/configuration_policy_handler.cc b/chrome/browser/policy/configuration_policy_handler.cc index 7dd32dd..023cb1d 100644 --- a/chrome/browser/policy/configuration_policy_handler.cc +++ b/chrome/browser/policy/configuration_policy_handler.cc @@ -265,7 +265,8 @@ bool ExtensionListPolicyHandler::CheckAndGetList( ValueTypeToString(base::Value::TYPE_STRING)); return false; } - if (!(allow_wildcards_ && id == "*") && !Extension::IdIsValid(id)) { + if (!(allow_wildcards_ && id == "*") && + !extensions::Extension::IdIsValid(id)) { errors->AddError(policy_name(), entry - list_value->begin(), IDS_POLICY_VALUE_FORMAT_ERROR); diff --git a/chrome/browser/profiles/off_the_record_profile_impl.cc b/chrome/browser/profiles/off_the_record_profile_impl.cc index 533c192..a7017e5 100644 --- a/chrome/browser/profiles/off_the_record_profile_impl.cc +++ b/chrome/browser/profiles/off_the_record_profile_impl.cc @@ -266,7 +266,7 @@ net::URLRequestContextGetter* OffTheRecordProfileImpl::GetRequestContextForRenderProcess( int renderer_child_id) { if (GetExtensionService()) { - const Extension* installed_app = GetExtensionService()-> + const extensions::Extension* installed_app = GetExtensionService()-> GetInstalledAppForRenderer(renderer_child_id); if (installed_app != NULL && installed_app->is_storage_isolated()) { return GetRequestContextForIsolatedApp(installed_app->id()); diff --git a/chrome/browser/profiles/profile.h b/chrome/browser/profiles/profile.h index a08a48b..8d75eee 100644 --- a/chrome/browser/profiles/profile.h +++ b/chrome/browser/profiles/profile.h @@ -21,7 +21,6 @@ class AutocompleteClassifier; class BookmarkModel; class ChromeAppCacheService; class ChromeURLDataManager; -class Extension; class ExtensionEventRouter; class ExtensionProcessManager; class ExtensionService; @@ -39,28 +38,29 @@ class UserScriptMaster; class VisitedLinkMaster; class WebDataService; +namespace android { +class TabContentsProvider; +} + namespace base { class Time; } +namespace chrome_browser_net { +class Predictor; +} + namespace chromeos { class LibCrosServiceLibraryImpl; class ResetDefaultProxyConfigServiceTask; } -namespace chrome_browser_net { -class Predictor; -} namespace content { class SpeechRecognitionPreferences; class WebUI; } -namespace android { -class TabContentsProvider; -} - namespace fileapi { class FileSystemContext; } diff --git a/chrome/browser/profiles/profile_impl.cc b/chrome/browser/profiles/profile_impl.cc index 9585dd0..1c1d3a6 100644 --- a/chrome/browser/profiles/profile_impl.cc +++ b/chrome/browser/profiles/profile_impl.cc @@ -717,7 +717,7 @@ net::URLRequestContextGetter* ProfileImpl::GetRequestContextForRenderProcess( ExtensionService* extension_service = ExtensionSystem::Get(this)->extension_service(); if (extension_service) { - const Extension* installed_app = extension_service-> + const extensions::Extension* installed_app = extension_service-> GetInstalledAppForRenderer(renderer_child_id); if (installed_app != NULL && installed_app->is_storage_isolated()) { return GetRequestContextForIsolatedApp(installed_app->id()); diff --git a/chrome/browser/renderer_host/chrome_render_message_filter.cc b/chrome/browser/renderer_host/chrome_render_message_filter.cc index 1b46e85..8a9d16c 100644 --- a/chrome/browser/renderer_host/chrome_render_message_filter.cc +++ b/chrome/browser/renderer_host/chrome_render_message_filter.cc @@ -27,6 +27,7 @@ #include "chrome/browser/task_manager/task_manager.h" #include "chrome/common/chrome_notification_types.h" #include "chrome/common/chrome_switches.h" +#include "chrome/common/extensions/extension.h" #include "chrome/common/extensions/extension_file_util.h" #include "chrome/common/extensions/extension_message_bundle.h" #include "chrome/common/extensions/extension_messages.h" @@ -304,7 +305,7 @@ void ChromeRenderMessageFilter::OpenChannelToTabOnUIThread( void ChromeRenderMessageFilter::OnGetExtensionMessageBundle( const std::string& extension_id, IPC::Message* reply_msg) { - const Extension* extension = + const extensions::Extension* extension = extension_info_map_->extensions().GetByID(extension_id); FilePath extension_path; std::string default_locale; diff --git a/chrome/browser/renderer_host/chrome_render_view_host_observer.cc b/chrome/browser/renderer_host/chrome_render_view_host_observer.cc index a064284..25198a0 100644 --- a/chrome/browser/renderer_host/chrome_render_view_host_observer.cc +++ b/chrome/browser/renderer_host/chrome_render_view_host_observer.cc @@ -23,6 +23,7 @@ using content::ChildProcessSecurityPolicy; using content::RenderViewHost; using content::SiteInstance; +using extensions::Extension; ChromeRenderViewHostObserver::ChromeRenderViewHostObserver( RenderViewHost* render_view_host, chrome_browser_net::Predictor* predictor) diff --git a/chrome/browser/renderer_host/chrome_render_view_host_observer.h b/chrome/browser/renderer_host/chrome_render_view_host_observer.h index 3d43e53..0092ba1 100644 --- a/chrome/browser/renderer_host/chrome_render_view_host_observer.h +++ b/chrome/browser/renderer_host/chrome_render_view_host_observer.h @@ -8,12 +8,15 @@ #include "content/public/browser/render_view_host_observer.h" +class Profile; + namespace chrome_browser_net { class Predictor; } +namespace extensions { class Extension; -class Profile; +} // This class holds the Chrome specific parts of RenderViewHost, and has the // same lifetime. @@ -37,7 +40,7 @@ class ChromeRenderViewHostObserver : public content::RenderViewHostObserver { // created by a RenderViewHost. void InitRenderViewForExtensions(); // Gets the extension or app (if any) that is associated with the RVH. - const Extension* GetExtension(); + const extensions::Extension* GetExtension(); // Cleans up when a RenderViewHost is removed, or on destruction. void RemoveRenderViewHostForExtensions(content::RenderViewHost* rvh); void OnFocusedEditableNodeTouched(); diff --git a/chrome/browser/search_engines/template_url_service.cc b/chrome/browser/search_engines/template_url_service.cc index 27e123c..b472533 100644 --- a/chrome/browser/search_engines/template_url_service.cc +++ b/chrome/browser/search_engines/template_url_service.cc @@ -436,7 +436,8 @@ void TemplateURLService::RemoveAutoGeneratedForOriginBetween( } -void TemplateURLService::RegisterExtensionKeyword(const Extension* extension) { +void TemplateURLService::RegisterExtensionKeyword( + const extensions::Extension* extension) { // TODO(mpcomplete): disable the keyword when the extension is disabled. if (extension->omnibox_keyword().empty()) return; @@ -460,7 +461,7 @@ void TemplateURLService::RegisterExtensionKeyword(const Extension* extension) { } void TemplateURLService::UnregisterExtensionKeyword( - const Extension* extension) { + const extensions::Extension* extension) { if (loaded_) { TemplateURL* url = GetTemplateURLForExtension(extension); if (url) @@ -474,7 +475,7 @@ void TemplateURLService::UnregisterExtensionKeyword( } TemplateURL* TemplateURLService::GetTemplateURLForExtension( - const Extension* extension) { + const extensions::Extension* extension) { for (TemplateURLVector::const_iterator i = template_urls_.begin(); i != template_urls_.end(); ++i) { if ((*i)->IsExtensionKeyword() && @@ -1397,7 +1398,7 @@ void TemplateURLService::NotifyLoaded() { for (PendingExtensionIDs::const_iterator i(pending_extension_ids_.begin()); i != pending_extension_ids_.end(); ++i) { - const Extension* extension = + const extensions::Extension* extension = profile_->GetExtensionService()->GetExtensionById(*i, true); if (extension) RegisterExtensionKeyword(extension); diff --git a/chrome/browser/search_engines/template_url_service.h b/chrome/browser/search_engines/template_url_service.h index 96338c6..b4a9f56 100644 --- a/chrome/browser/search_engines/template_url_service.h +++ b/chrome/browser/search_engines/template_url_service.h @@ -24,7 +24,6 @@ #include "sync/api/sync_change.h" #include "sync/api/syncable_service.h" -class Extension; class GURL; class PrefService; class Profile; @@ -34,6 +33,10 @@ class SyncData; class SyncErrorFactory; class TemplateURLServiceObserver; +namespace extensions { +class Extension; +} + namespace history { struct URLVisitedDetails; } @@ -174,16 +177,17 @@ class TemplateURLService : public WebDataServiceConsumer, // If the given extension has an omnibox keyword, adds a TemplateURL for that // keyword. Only 1 keyword is allowed for a given extension. If the keyword // already exists for this extension, does nothing. - void RegisterExtensionKeyword(const Extension* extension); + void RegisterExtensionKeyword(const extensions::Extension* extension); // Removes the TemplateURL containing the keyword for the given extension, // if any. - void UnregisterExtensionKeyword(const Extension* extension); + void UnregisterExtensionKeyword(const extensions::Extension* extension); // Returns the TemplateURL associated with the keyword for this extension. // This works by checking the extension ID, not the keyword, so it will work // even if the user changed the keyword. - TemplateURL* GetTemplateURLForExtension(const Extension* extension); + TemplateURL* GetTemplateURLForExtension( + const extensions::Extension* extension); // Returns the set of URLs describing the keywords. The elements are owned // by TemplateURLService and should not be deleted. diff --git a/chrome/browser/sessions/tab_restore_service.cc b/chrome/browser/sessions/tab_restore_service.cc index 7d66033..a6ed52f 100644 --- a/chrome/browser/sessions/tab_restore_service.cc +++ b/chrome/browser/sessions/tab_restore_service.cc @@ -537,7 +537,7 @@ void TabRestoreService::PopulateTab(Tab* tab, controller->GetWebContents()); // wrapper is NULL in some browser tests. if (wrapper) { - const Extension* extension = + const extensions::Extension* extension = wrapper->extension_tab_helper()->extension_app(); if (extension) tab->extension_app_id = extension->id(); diff --git a/chrome/browser/speech/extension_api/tts_engine_extension_api.cc b/chrome/browser/speech/extension_api/tts_engine_extension_api.cc index ffaf83d..62a1c6e 100644 --- a/chrome/browser/speech/extension_api/tts_engine_extension_api.cc +++ b/chrome/browser/speech/extension_api/tts_engine_extension_api.cc @@ -15,6 +15,8 @@ #include "chrome/browser/speech/extension_api/tts_extension_api_controller.h" #include "chrome/common/extensions/extension.h" +using extensions::Extension; + namespace constants = tts_extension_api_constants; namespace events { diff --git a/chrome/browser/speech/extension_api/tts_engine_extension_api.h b/chrome/browser/speech/extension_api/tts_engine_extension_api.h index eea8aa8..c8653cb 100644 --- a/chrome/browser/speech/extension_api/tts_engine_extension_api.h +++ b/chrome/browser/speech/extension_api/tts_engine_extension_api.h @@ -9,13 +9,16 @@ #include "base/memory/singleton.h" #include "chrome/browser/extensions/extension_function.h" -class Extension; class Utterance; namespace base { class ListValue; } +namespace extensions { +class Extension; +} + // Return a list of all available voices registered by extensions. void GetExtensionVoices(Profile* profile, base::ListValue* result_voices); @@ -25,13 +28,13 @@ void GetExtensionVoices(Profile* profile, base::ListValue* result_voices); // the index of the voice within the extension in |voice_index| and // return true. bool GetMatchingExtensionVoice(Utterance* utterance, - const Extension** matching_extension, + const extensions::Extension** matching_extension, size_t* voice_index); // Speak the given utterance by sending an event to the given TTS engine // extension voice. void ExtensionTtsEngineSpeak(Utterance* utterance, - const Extension* extension, + const extensions::Extension* extension, size_t voice_index); // Stop speaking the given utterance by sending an event to the extension diff --git a/chrome/browser/speech/extension_api/tts_extension_api_controller.cc b/chrome/browser/speech/extension_api/tts_extension_api_controller.cc index 6663ef6..0d20674 100644 --- a/chrome/browser/speech/extension_api/tts_extension_api_controller.cc +++ b/chrome/browser/speech/extension_api/tts_extension_api_controller.cc @@ -172,7 +172,7 @@ void ExtensionTtsController::SpeakOrEnqueue(Utterance* utterance) { } void ExtensionTtsController::SpeakNow(Utterance* utterance) { - const Extension* extension; + const extensions::Extension* extension; size_t voice_index; if (GetMatchingExtensionVoice(utterance, &extension, &voice_index)) { current_utterance_ = utterance; diff --git a/chrome/browser/speech/extension_api/tts_extension_api_controller.h b/chrome/browser/speech/extension_api/tts_extension_api_controller.h index 098271d..b374d50 100644 --- a/chrome/browser/speech/extension_api/tts_extension_api_controller.h +++ b/chrome/browser/speech/extension_api/tts_extension_api_controller.h @@ -14,7 +14,6 @@ #include "base/memory/singleton.h" #include "googleurl/src/gurl.h" -class Extension; class ExtensionTtsPlatformImpl; class Profile; diff --git a/chrome/browser/speech/speech_input_extension_manager.cc b/chrome/browser/speech/speech_input_extension_manager.cc index 67ab90c..047f1de 100644 --- a/chrome/browser/speech/speech_input_extension_manager.cc +++ b/chrome/browser/speech/speech_input_extension_manager.cc @@ -183,7 +183,8 @@ void SpeechInputExtensionManager::Observe(int type, const content::NotificationDetails& details) { if (type == chrome::NOTIFICATION_EXTENSION_UNLOADED) { ExtensionUnloaded( - content::Details<UnloadedExtensionInfo>(details)->extension->id()); + content::Details<extensions::UnloadedExtensionInfo>(details)-> + extension->id()); } else { NOTREACHED(); } @@ -319,7 +320,7 @@ void SpeechInputExtensionManager::DidStartReceivingAudioOnUIThread() { VLOG(1) << "State changed to recording"; state_ = kRecording; - const Extension* extension = profile_->GetExtensionService()-> + const extensions::Extension* extension = profile_->GetExtensionService()-> GetExtensionById(extension_id_in_use_, true); DCHECK(extension); diff --git a/chrome/browser/speech/speech_input_extension_manager.h b/chrome/browser/speech/speech_input_extension_manager.h index 4ef6b82..3923506 100644 --- a/chrome/browser/speech/speech_input_extension_manager.h +++ b/chrome/browser/speech/speech_input_extension_manager.h @@ -15,7 +15,6 @@ #include "content/public/browser/notification_observer.h" #include "content/public/browser/speech_recognition_event_listener.h" -class Extension; class Profile; class SpeechRecognitionTrayIconController; diff --git a/chrome/browser/sync/glue/chrome_extensions_activity_monitor.cc b/chrome/browser/sync/glue/chrome_extensions_activity_monitor.cc index 1b30f72..17ec604 100644 --- a/chrome/browser/sync/glue/chrome_extensions_activity_monitor.cc +++ b/chrome/browser/sync/glue/chrome_extensions_activity_monitor.cc @@ -51,7 +51,8 @@ void ChromeExtensionsActivityMonitor::Observe( const content::NotificationDetails& details) { base::AutoLock lock(records_lock_); DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - const Extension* extension = content::Source<const Extension>(source).ptr(); + const extensions::Extension* extension = + content::Source<const extensions::Extension>(source).ptr(); const BookmarksFunction* f = content::Details<const BookmarksFunction>(details).ptr(); if (f->name() == "bookmarks.update" || diff --git a/chrome/browser/sync/glue/chrome_extensions_activity_monitor_unittest.cc b/chrome/browser/sync/glue/chrome_extensions_activity_monitor_unittest.cc index 8456094..66253e5 100644 --- a/chrome/browser/sync/glue/chrome_extensions_activity_monitor_unittest.cc +++ b/chrome/browser/sync/glue/chrome_extensions_activity_monitor_unittest.cc @@ -17,6 +17,8 @@ #include "content/test/test_browser_thread.h" #include "testing/gtest/include/gtest/gtest.h" +using extensions::Extension; + namespace browser_sync { namespace { diff --git a/chrome/browser/sync/glue/theme_util.cc b/chrome/browser/sync/glue/theme_util.cc index 7f0f00c..5ce8132 100644 --- a/chrome/browser/sync/glue/theme_util.cc +++ b/chrome/browser/sync/glue/theme_util.cc @@ -17,6 +17,8 @@ #include "googleurl/src/gurl.h" #include "sync/protocol/theme_specifics.pb.h" +using extensions::Extension; + namespace browser_sync { const char kCurrentThemeClientTag[] = "current_theme"; diff --git a/chrome/browser/sync/glue/theme_util.h b/chrome/browser/sync/glue/theme_util.h index 988b39d..a502b73 100644 --- a/chrome/browser/sync/glue/theme_util.h +++ b/chrome/browser/sync/glue/theme_util.h @@ -6,9 +6,12 @@ #define CHROME_BROWSER_SYNC_GLUE_THEME_UTIL_H_ #pragma once -class Extension; class Profile; +namespace extensions { +class Extension; +} + namespace sync_pb { class ThemeSpecifics; } // sync_pb @@ -41,7 +44,7 @@ void GetThemeSpecificsFromCurrentTheme( // Exposed only for testing. void GetThemeSpecificsFromCurrentThemeHelper( - const Extension* current_theme, + const extensions::Extension* current_theme, bool is_system_theme_distinct_from_default_theme, bool use_system_theme_by_default, sync_pb::ThemeSpecifics* theme_specifics); diff --git a/chrome/browser/sync/glue/theme_util_unittest.cc b/chrome/browser/sync/glue/theme_util_unittest.cc index c895983..7aede1e 100644 --- a/chrome/browser/sync/glue/theme_util_unittest.cc +++ b/chrome/browser/sync/glue/theme_util_unittest.cc @@ -16,6 +16,8 @@ #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" +using extensions::Extension; + namespace browser_sync { namespace { diff --git a/chrome/browser/sync/test/integration/apps_helper.cc b/chrome/browser/sync/test/integration/apps_helper.cc index dea553d..a73c17d 100644 --- a/chrome/browser/sync/test/integration/apps_helper.cc +++ b/chrome/browser/sync/test/integration/apps_helper.cc @@ -42,7 +42,9 @@ bool AllProfilesHaveSameAppsAsVerifier() { std::string InstallApp(Profile* profile, int index) { return SyncExtensionHelper::GetInstance()->InstallExtension( - profile, CreateFakeAppName(index), Extension::TYPE_HOSTED_APP); + profile, + CreateFakeAppName(index), + extensions::Extension::TYPE_HOSTED_APP); } std::string InstallAppForAllProfiles(int index) { @@ -78,7 +80,7 @@ void IncognitoDisableApp(Profile* profile, int index) { void InstallAppsPendingForSync(Profile* profile) { SyncExtensionHelper::GetInstance()->InstallExtensionsPendingForSync( - profile, Extension::TYPE_HOSTED_APP); + profile, extensions::Extension::TYPE_HOSTED_APP); } StringOrdinal GetPageOrdinalForApp(Profile* profile, diff --git a/chrome/browser/sync/test/integration/extensions_helper.cc b/chrome/browser/sync/test/integration/extensions_helper.cc index e6873b3..66fd789 100644 --- a/chrome/browser/sync/test/integration/extensions_helper.cc +++ b/chrome/browser/sync/test/integration/extensions_helper.cc @@ -51,7 +51,9 @@ bool AllProfilesHaveSameExtensions() { std::string InstallExtension(Profile* profile, int index) { return SyncExtensionHelper::GetInstance()->InstallExtension( - profile, CreateFakeExtensionName(index), Extension::TYPE_EXTENSION); + profile, + CreateFakeExtensionName(index), + extensions::Extension::TYPE_EXTENSION); } std::string InstallExtensionForAllProfiles(int index) { @@ -111,7 +113,7 @@ bool IsIncognitoEnabled(Profile* profile, int index) { void InstallExtensionsPendingForSync(Profile* profile) { SyncExtensionHelper::GetInstance()->InstallExtensionsPendingForSync( - profile, Extension::TYPE_EXTENSION); + profile, extensions::Extension::TYPE_EXTENSION); } std::string CreateFakeExtensionName(int index) { diff --git a/chrome/browser/sync/test/integration/sync_app_helper.cc b/chrome/browser/sync/test/integration/sync_app_helper.cc index efa61c7..e70128d 100644 --- a/chrome/browser/sync/test/integration/sync_app_helper.cc +++ b/chrome/browser/sync/test/integration/sync_app_helper.cc @@ -60,7 +60,7 @@ AppStateMap GetAppStates(Profile* profile) { extension_service->GenerateInstalledExtensionsSet()); for (ExtensionSet::const_iterator it = extensions->begin(); it != extensions->end(); ++it) { - if ((*it)->GetSyncType() == Extension::SYNC_TYPE_APP) { + if ((*it)->GetSyncType() == extensions::Extension::SYNC_TYPE_APP) { const std::string& id = (*it)->id(); LoadApp(extension_service, id, &(app_state_map[id])); } diff --git a/chrome/browser/sync/test/integration/sync_extension_helper.cc b/chrome/browser/sync/test/integration/sync_extension_helper.cc index 41db664..f32989a 100644 --- a/chrome/browser/sync/test/integration/sync_extension_helper.cc +++ b/chrome/browser/sync/test/integration/sync_extension_helper.cc @@ -20,6 +20,8 @@ #include "chrome/browser/sync/test/integration/sync_datatype_helper.h" #include "testing/gtest/include/gtest/gtest.h" +using extensions::Extension; + SyncExtensionHelper::ExtensionState::ExtensionState() : enabled_state(ENABLED), incognito_enabled(false) {} diff --git a/chrome/browser/sync/test/integration/sync_extension_helper.h b/chrome/browser/sync/test/integration/sync_extension_helper.h index 1e85afe..2b1dc71 100644 --- a/chrome/browser/sync/test/integration/sync_extension_helper.h +++ b/chrome/browser/sync/test/integration/sync_extension_helper.h @@ -19,6 +19,10 @@ class Profile; class SyncTest; +namespace extensions { +class Extension; +} + class SyncExtensionHelper { public: // Singleton implementation. @@ -33,8 +37,9 @@ class SyncExtensionHelper { // Installs the extension with the given name to |profile|, and returns the // extension ID of the new extension. - std::string InstallExtension( - Profile* profile, const std::string& name, Extension::Type type); + std::string InstallExtension(Profile* profile, + const std::string& name, + extensions::Extension::Type type); // Uninstalls the extension with the given name from |profile|. void UninstallExtension(Profile* profile, const std::string& name); @@ -68,7 +73,8 @@ class SyncExtensionHelper { // Installs all extensions pending sync in |profile| of the given // type. - void InstallExtensionsPendingForSync(Profile* profile, Extension::Type type); + void InstallExtensionsPendingForSync(Profile* profile, + extensions::Extension::Type type); // Returns true iff |profile1| and |profile2| have the same extensions and // they are all in the same state. @@ -87,7 +93,8 @@ class SyncExtensionHelper { }; typedef std::map<std::string, ExtensionState> ExtensionStateMap; - typedef std::map<std::string, scoped_refptr<Extension> > ExtensionNameMap; + typedef std::map<std::string, scoped_refptr<extensions::Extension> > + ExtensionNameMap; typedef std::map<Profile*, ExtensionNameMap> ProfileExtensionNameMap; typedef std::map<std::string, std::string> StringMap; @@ -106,9 +113,9 @@ class SyncExtensionHelper { // Returns an extension for the given name in |profile|. type and // index. Two extensions with the name but different profiles will // have the same id. - scoped_refptr<Extension> GetExtension( + scoped_refptr<extensions::Extension> GetExtension( Profile* profile, const std::string& name, - Extension::Type type) WARN_UNUSED_RESULT; + extensions::Extension::Type type) WARN_UNUSED_RESULT; ProfileExtensionNameMap profile_extensions_; StringMap id_to_name_; diff --git a/chrome/browser/sync/test/integration/themes_helper.cc b/chrome/browser/sync/test/integration/themes_helper.cc index d2d9edd..0ff10ce 100644 --- a/chrome/browser/sync/test/integration/themes_helper.cc +++ b/chrome/browser/sync/test/integration/themes_helper.cc @@ -60,7 +60,7 @@ bool HasOrWillHaveCustomTheme(Profile* profile, const std::string& id) { void UseCustomTheme(Profile* profile, int index) { SyncExtensionHelper::GetInstance()->InstallExtension( - profile, MakeName(index), Extension::TYPE_THEME); + profile, MakeName(index), extensions::Extension::TYPE_THEME); } void UseDefaultTheme(Profile* profile) { diff --git a/chrome/browser/tab_contents/render_view_context_menu.cc b/chrome/browser/tab_contents/render_view_context_menu.cc index 59d76443..108c062 100644 --- a/chrome/browser/tab_contents/render_view_context_menu.cc +++ b/chrome/browser/tab_contents/render_view_context_menu.cc @@ -103,6 +103,7 @@ using content::RenderViewHost; using content::SSLStatus; using content::UserMetricsAction; using content::WebContents; +using extensions::Extension; namespace { diff --git a/chrome/browser/tab_contents/render_view_context_menu.h b/chrome/browser/tab_contents/render_view_context_menu.h index 94a6441..4f6323e 100644 --- a/chrome/browser/tab_contents/render_view_context_menu.h +++ b/chrome/browser/tab_contents/render_view_context_menu.h @@ -33,6 +33,10 @@ class RenderViewHost; class WebContents; } +namespace extensions { +class Extension; +} + namespace gfx { class Point; } @@ -204,7 +208,7 @@ class RenderViewContextMenu : public ui::SimpleMenuModel::Delegate, bool can_cross_incognito); // Gets the extension (if any) associated with the WebContents that we're in. - const Extension* GetExtension() const; + const extensions::Extension* GetExtension() const; void AppendPlatformAppItems(); void AppendPopupExtensionItems(); bool AppendCustomItems(); diff --git a/chrome/browser/task_manager/task_manager.cc b/chrome/browser/task_manager/task_manager.cc index 8aa2419..395493f 100644 --- a/chrome/browser/task_manager/task_manager.cc +++ b/chrome/browser/task_manager/task_manager.cc @@ -486,7 +486,8 @@ TabContentsWrapper* TaskManagerModel::GetResourceTabContents(int index) const { return resources_[index]->GetTabContents(); } -const Extension* TaskManagerModel::GetResourceExtension(int index) const { +const extensions::Extension* TaskManagerModel::GetResourceExtension( + int index) const { CHECK_LT(index, ResourceCount()); return resources_[index]->GetExtension(); } diff --git a/chrome/browser/task_manager/task_manager.h b/chrome/browser/task_manager/task_manager.h index 3e70748..23e582e 100644 --- a/chrome/browser/task_manager/task_manager.h +++ b/chrome/browser/task_manager/task_manager.h @@ -21,7 +21,6 @@ #include "chrome/browser/renderer_host/web_cache_manager.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebCache.h" -class Extension; class SkBitmap; class TabContentsWrapper; class TaskManagerModel; @@ -29,6 +28,11 @@ class TaskManagerModel; namespace base { class ProcessMetrics; } + +namespace extensions { +class Extension; +} + namespace net { class URLRequest; } @@ -85,7 +89,7 @@ class TaskManager { // Return extension associated with the resource, or NULL // if not applicable. - virtual const Extension* GetExtension() const { return NULL; } + virtual const extensions::Extension* GetExtension() const { return NULL; } virtual bool ReportsV8MemoryStats() const { return false; } virtual size_t GetV8MemoryAllocated() const { return 0; } @@ -399,7 +403,7 @@ class TaskManagerModel : public base::RefCountedThreadSafe<TaskManagerModel> { TabContentsWrapper* GetResourceTabContents(int index) const; // Returns Extension of given resource or NULL if not applicable. - const Extension* GetResourceExtension(int index) const; + const extensions::Extension* GetResourceExtension(int index) const; void AddResource(TaskManager::Resource* resource); void RemoveResource(TaskManager::Resource* resource); diff --git a/chrome/browser/task_manager/task_manager_browsertest.cc b/chrome/browser/task_manager/task_manager_browsertest.cc index f049e5d..e19c6fb 100644 --- a/chrome/browser/task_manager/task_manager_browsertest.cc +++ b/chrome/browser/task_manager/task_manager_browsertest.cc @@ -254,7 +254,7 @@ IN_PROC_BROWSER_TEST_F(TaskManagerBrowserTest, NoticeAppTabs) { ASSERT_TRUE(LoadExtension( test_data_dir_.AppendASCII("packaged_app"))); ExtensionService* service = browser()->profile()->GetExtensionService(); - const Extension* extension = + const extensions::Extension* extension = service->GetExtensionById(last_loaded_extension_id_, false); // Browser and the New Tab Page. @@ -422,7 +422,7 @@ IN_PROC_BROWSER_TEST_F(TaskManagerBrowserTest, MAYBE_ReloadExtension) { EXPECT_TRUE(model()->GetResourceExtension(1) == NULL); ASSERT_TRUE(model()->GetResourceExtension(2) != NULL); - const Extension* extension = model()->GetResourceExtension(2); + const extensions::Extension* extension = model()->GetResourceExtension(2); ASSERT_TRUE(extension != NULL); // Reload the extension a few times and make sure our resource count diff --git a/chrome/browser/task_manager/task_manager_resource_providers.cc b/chrome/browser/task_manager/task_manager_resource_providers.cc index 96be494..472069e 100644 --- a/chrome/browser/task_manager/task_manager_resource_providers.cc +++ b/chrome/browser/task_manager/task_manager_resource_providers.cc @@ -72,6 +72,7 @@ using content::BrowserChildProcessHostIterator; using content::BrowserThread; using content::WebContents; +using extensions::Extension; namespace { diff --git a/chrome/browser/task_manager/task_manager_resource_providers.h b/chrome/browser/task_manager/task_manager_resource_providers.h index 721e3ec..612a5ca 100644 --- a/chrome/browser/task_manager/task_manager_resource_providers.h +++ b/chrome/browser/task_manager/task_manager_resource_providers.h @@ -21,13 +21,16 @@ class BackgroundContents; class BalloonHost; -class Extension; class TabContentsWrapper; namespace content { class RenderViewHost; } +namespace extensions { +class Extension; +} + // These file contains the resource providers used in the task manager. // Base class for various types of render process resources that provides common @@ -112,7 +115,7 @@ class TaskManagerTabContentsResource : public TaskManagerRendererResource { virtual string16 GetProfileName() const OVERRIDE; virtual SkBitmap GetIcon() const OVERRIDE; virtual TabContentsWrapper* GetTabContents() const OVERRIDE; - virtual const Extension* GetExtension() const OVERRIDE; + virtual const extensions::Extension* GetExtension() const OVERRIDE; private: bool IsPrerendering() const; @@ -358,7 +361,7 @@ class TaskManagerExtensionProcessResource : public TaskManager::Resource { virtual void Inspect() const OVERRIDE; virtual bool SupportNetworkUsage() const OVERRIDE; virtual void SetSupportNetworkUsage() OVERRIDE; - virtual const Extension* GetExtension() const OVERRIDE; + virtual const extensions::Extension* GetExtension() const OVERRIDE; // Returns the pid of the extension process. int process_id() const { return pid_; } diff --git a/chrome/browser/themes/browser_theme_pack.cc b/chrome/browser/themes/browser_theme_pack.cc index b5f17eb..a62807f 100644 --- a/chrome/browser/themes/browser_theme_pack.cc +++ b/chrome/browser/themes/browser_theme_pack.cc @@ -29,6 +29,7 @@ #include "ui/gfx/skbitmap_operations.h" using content::BrowserThread; +using extensions::Extension; namespace { diff --git a/chrome/browser/themes/browser_theme_pack.h b/chrome/browser/themes/browser_theme_pack.h index 1a5e648..e582692 100644 --- a/chrome/browser/themes/browser_theme_pack.h +++ b/chrome/browser/themes/browser_theme_pack.h @@ -18,15 +18,22 @@ #include "ui/gfx/color_utils.h" class FilePath; -namespace ui { -class DataPack; + +namespace base { +class DictionaryValue; +class RefCountedMemory; +} + +namespace extensions { +class Extensions; } + namespace gfx { class Image; } -namespace base { -class DictionaryValue; -class RefCountedMemory; + +namespace ui { +class DataPack; } // An optimized representation of a theme, backed by a mmapped DataPack. @@ -53,7 +60,7 @@ class BrowserThemePack : public base::RefCountedThreadSafe< // on a separate thread as it takes so long. This can fail and return NULL in // the case where the theme has invalid data. static scoped_refptr<BrowserThemePack> BuildFromExtension( - const Extension* extension); + const extensions::Extension* extension); // Builds the theme pack from a previously performed WriteToDisk(). This // operation should be relatively fast, as it should be an mmap() and some @@ -118,7 +125,7 @@ class BrowserThemePack : public base::RefCountedThreadSafe< virtual ~BrowserThemePack(); // Builds a header ready to write to disk. - void BuildHeader(const Extension* extension); + void BuildHeader(const extensions::Extension* extension); // Transforms the JSON tint values into their final versions in the |tints_| // array. diff --git a/chrome/browser/themes/browser_theme_pack_unittest.cc b/chrome/browser/themes/browser_theme_pack_unittest.cc index bcf81ef..008e5c2 100644 --- a/chrome/browser/themes/browser_theme_pack_unittest.cc +++ b/chrome/browser/themes/browser_theme_pack_unittest.cc @@ -20,6 +20,7 @@ #include "ui/gfx/color_utils.h" using content::BrowserThread; +using extensions::Extension; class BrowserThemePackTest : public ::testing::Test { public: diff --git a/chrome/browser/themes/theme_service.cc b/chrome/browser/themes/theme_service.cc index f9be837..ce26a24 100644 --- a/chrome/browser/themes/theme_service.cc +++ b/chrome/browser/themes/theme_service.cc @@ -30,6 +30,7 @@ using content::BrowserThread; using content::UserMetricsAction; +using extensions::Extension; using ui::ResourceBundle; // Strings used in alignment properties. diff --git a/chrome/browser/themes/theme_service.h b/chrome/browser/themes/theme_service.h index c5cc1ba..f9c7b30 100644 --- a/chrome/browser/themes/theme_service.h +++ b/chrome/browser/themes/theme_service.h @@ -21,7 +21,6 @@ class BrowserThemePack; class ThemeServiceTest; -class Extension; class FilePath; class Profile; @@ -29,6 +28,10 @@ namespace color_utils { struct HSL; } +namespace extensions { +class Extension; +} + namespace gfx { class Image; } @@ -178,7 +181,7 @@ class ThemeService : public base::NonThreadSafe, #endif // Set the current theme to the theme defined in |extension|. - virtual void SetTheme(const Extension* extension); + virtual void SetTheme(const extensions::Extension* extension); // Reset the theme to default. virtual void UseDefaultTheme(); @@ -281,7 +284,7 @@ class ThemeService : public base::NonThreadSafe, // Implementation of SetTheme() (and the fallback from LoadThemePrefs() in // case we don't have a theme pack). - void BuildFromExtension(const Extension* extension); + void BuildFromExtension(const extensions::Extension* extension); #if defined(TOOLKIT_GTK) // Loads an image and flips it horizontally if |rtl_enabled| is true. diff --git a/chrome/browser/themes/theme_service_factory.cc b/chrome/browser/themes/theme_service_factory.cc index aeefcc8..8d37c3e 100644 --- a/chrome/browser/themes/theme_service_factory.cc +++ b/chrome/browser/themes/theme_service_factory.cc @@ -23,7 +23,8 @@ ThemeService* ThemeServiceFactory::GetForProfile(Profile* profile) { } // static -const Extension* ThemeServiceFactory::GetThemeForProfile(Profile* profile) { +const extensions::Extension* ThemeServiceFactory::GetThemeForProfile( + Profile* profile) { std::string id = GetForProfile(profile)->GetThemeID(); if (id == ThemeService::kDefaultThemeID) return NULL; diff --git a/chrome/browser/themes/theme_service_factory.h b/chrome/browser/themes/theme_service_factory.h index 9b590b1..2b688ec 100644 --- a/chrome/browser/themes/theme_service_factory.h +++ b/chrome/browser/themes/theme_service_factory.h @@ -9,9 +9,12 @@ #include "base/memory/singleton.h" #include "chrome/browser/profiles/profile_keyed_service_factory.h" +class Profile; class ThemeService; + +namespace extensions { class Extension; -class Profile; +} // Singleton that owns all ThemeServices and associates them with // Profiles. Listens for the Profile's destruction notification and cleans up @@ -26,7 +29,7 @@ class ThemeServiceFactory : public ProfileKeyedServiceFactory { // Returns the Extension that implements the theme associated with // |profile|. Returns NULL if the theme is no longer installed, if there is // no installed theme, or the theme was cleared. - static const Extension* GetThemeForProfile(Profile* profile); + static const extensions::Extension* GetThemeForProfile(Profile* profile); static ThemeServiceFactory* GetInstance(); diff --git a/chrome/browser/ui/app_modal_dialogs/message_box_handler.cc b/chrome/browser/ui/app_modal_dialogs/message_box_handler.cc index 54f22ad..1f7e2fb 100644 --- a/chrome/browser/ui/app_modal_dialogs/message_box_handler.cc +++ b/chrome/browser/ui/app_modal_dialogs/message_box_handler.cc @@ -227,7 +227,7 @@ string16 ChromeJavaScriptDialogCreator::GetTitle(const GURL& origin_url, // If the URL is a chrome extension one, return the extension name. if (extension_host_) { - const Extension* extension = extension_host_-> + const extensions::Extension* extension = extension_host_-> profile()->GetExtensionService()->extensions()-> GetExtensionOrAppByURL(ExtensionURLInfo(origin_url)); if (extension) { diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc index f001aa5..987af6c 100644 --- a/chrome/browser/ui/browser.cc +++ b/chrome/browser/ui/browser.cc @@ -226,6 +226,7 @@ using content::SiteInstance; using content::SSLStatus; using content::UserMetricsAction; using content::WebContents; +using extensions::Extension; /////////////////////////////////////////////////////////////////////////////// @@ -4112,10 +4113,11 @@ void Browser::Observe(int type, // Close any tabs from the unloaded extension, unless it's terminated, // in which case let the sad tabs remain. - if (content::Details<UnloadedExtensionInfo>(details)->reason != - extension_misc::UNLOAD_REASON_TERMINATE) { + if (content::Details<extensions::UnloadedExtensionInfo>( + details)->reason != extension_misc::UNLOAD_REASON_TERMINATE) { const Extension* extension = - content::Details<UnloadedExtensionInfo>(details)->extension; + content::Details<extensions::UnloadedExtensionInfo>( + details)->extension; for (int i = tab_strip_model_->count() - 1; i >= 0; --i) { WebContents* tc = tab_strip_model_->GetTabContentsAt(i)->web_contents(); diff --git a/chrome/browser/ui/browser.h b/chrome/browser/ui/browser.h index 5dc3dce..048de21 100644 --- a/chrome/browser/ui/browser.h +++ b/chrome/browser/ui/browser.h @@ -56,7 +56,6 @@ class BrowserSyncedWindowDelegate; class BrowserToolbarModelDelegate; class BrowserTabRestoreServiceDelegate; class BrowserWindow; -class Extension; class ExtensionWindowController; class FindBarController; class FullscreenController; @@ -76,6 +75,10 @@ class NavigationController; class SessionStorageNamespace; } +namespace extensions { +class Extension; +} + namespace gfx { class Point; } @@ -290,7 +293,7 @@ class Browser : public TabStripModelDelegate, // |override_url| is used in place of the app launch url. static content::WebContents* OpenApplication( Profile* profile, - const Extension* extension, + const extensions::Extension* extension, extension_misc::LaunchContainer container, const GURL& override_url, WindowOpenDisposition disposition); @@ -299,7 +302,7 @@ class Browser : public TabStripModelDelegate, // Opens |url| in a new application panel window for the specified url. static content::WebContents* OpenApplicationPanel( Profile* profile, - const Extension* extension, + const extensions::Extension* extension, const GURL& url); #endif @@ -312,7 +315,7 @@ class Browser : public TabStripModelDelegate, // returned tab. static content::WebContents* OpenApplicationWindow( Profile* profile, - const Extension* extension, + const extensions::Extension* extension, extension_misc::LaunchContainer container, const GURL& url, Browser** app_browser); @@ -332,7 +335,7 @@ class Browser : public TabStripModelDelegate, // non-empty, |override_url| is used in place of the app launch url. static content::WebContents* OpenApplicationTab( Profile* profile, - const Extension* extension, + const extensions::Extension* extension, const GURL& override_url, WindowOpenDisposition disposition); diff --git a/chrome/browser/ui/browser_browsertest.cc b/chrome/browser/ui/browser_browsertest.cc index 02a51c3..26e7ece 100644 --- a/chrome/browser/ui/browser_browsertest.cc +++ b/chrome/browser/ui/browser_browsertest.cc @@ -76,6 +76,7 @@ using content::OpenURLParams; using content::Referrer; using content::WebContents; using content::WebContentsObserver; +using extensions::Extension; namespace { diff --git a/chrome/browser/ui/browser_dialogs.h b/chrome/browser/ui/browser_dialogs.h index a885730..16174fa 100644 --- a/chrome/browser/ui/browser_dialogs.h +++ b/chrome/browser/ui/browser_dialogs.h @@ -10,7 +10,6 @@ #include "ui/gfx/native_widget_types.h" class Browser; -class Extension; class Profile; class SkBitmap; class TabContentsWrapper; @@ -22,6 +21,10 @@ namespace content { class WebContents; } +namespace extensions { +class Extension; +} + namespace browser { #if defined(IPC_MESSAGE_LOG_ENABLED) @@ -54,7 +57,7 @@ void ShowCollectedCookiesDialog(gfx::NativeWindow parent_window, // the extension has loaded. |extension| is the installed extension. |browser| // is the browser window which will host the bubble. |icon| is the install // icon of the extension. -void ShowExtensionInstalledBubble(const Extension* extension, +void ShowExtensionInstalledBubble(const extensions::Extension* extension, Browser* browser, const SkBitmap& icon, Profile* profile); diff --git a/chrome/browser/ui/browser_window.h b/chrome/browser/ui/browser_window.h index 12aa098..508249a 100644 --- a/chrome/browser/ui/browser_window.h +++ b/chrome/browser/ui/browser_window.h @@ -35,12 +35,15 @@ struct NativeWebKeyboardEvent; struct SSLStatus; } +namespace extensions { +class Extension; +} + namespace gfx { class Rect; class Size; } -class Extension; enum DevToolsDockSide { DEVTOOLS_DOCK_SIDE_BOTTOM = 0, @@ -293,7 +296,8 @@ class BrowserWindow : public BaseWindow { // Shows the create chrome app shortcut dialog box. virtual void ShowCreateChromeAppShortcutsDialog(Profile* profile, - const Extension* app) = 0; + const extensions::Extension* app) = 0; + // Clipboard commands applied to the whole browser window. virtual void Cut() = 0; diff --git a/chrome/browser/ui/cocoa/browser_window_cocoa.h b/chrome/browser/ui/cocoa/browser_window_cocoa.h index 43c52e6..d7640f4 100644 --- a/chrome/browser/ui/cocoa/browser_window_cocoa.h +++ b/chrome/browser/ui/cocoa/browser_window_cocoa.h @@ -21,6 +21,10 @@ class Browser; @class NSMenu; @class NSWindow; +namespace extensions { +class Extension; +} + // An implementation of BrowserWindow for Cocoa. Bridges between C++ and // the Cocoa NSWindow. Cross-platform code will interact with this object when // it needs to manipulate the window. @@ -123,7 +127,7 @@ class BrowserWindowCocoa : public BrowserWindow, TabContentsWrapper* tab_contents) OVERRIDE; virtual void ShowCreateChromeAppShortcutsDialog( Profile* profile, - const Extension* app) OVERRIDE; + const extensions::Extension* app) OVERRIDE; virtual void Cut() OVERRIDE; virtual void Copy() OVERRIDE; virtual void Paste() OVERRIDE; diff --git a/chrome/browser/ui/cocoa/browser_window_cocoa.mm b/chrome/browser/ui/cocoa/browser_window_cocoa.mm index 4e01a62..c0bf3ce 100644 --- a/chrome/browser/ui/cocoa/browser_window_cocoa.mm +++ b/chrome/browser/ui/cocoa/browser_window_cocoa.mm @@ -547,7 +547,7 @@ void BrowserWindowCocoa::ShowCreateWebAppShortcutsDialog( } void BrowserWindowCocoa::ShowCreateChromeAppShortcutsDialog( - Profile* profile, const Extension* app) { + Profile* profile, const extensions::Extension* app) { NOTIMPLEMENTED(); } diff --git a/chrome/browser/ui/cocoa/extensions/browser_action_button.h b/chrome/browser/ui/cocoa/extensions/browser_action_button.h index e8bad88..1b4eceb 100644 --- a/chrome/browser/ui/cocoa/extensions/browser_action_button.h +++ b/chrome/browser/ui/cocoa/extensions/browser_action_button.h @@ -12,11 +12,14 @@ #include "base/memory/scoped_ptr.h" #import "chrome/browser/ui/cocoa/gradient_button_cell.h" -class Extension; class ExtensionAction; class ExtensionImageTrackerBridge; class Profile; +namespace extensions { +class Extension; +} + // Fired when the Browser Action's state has changed. Usually the image needs to // be updated. extern NSString* const kBrowserActionButtonUpdatedNotification; @@ -42,7 +45,7 @@ extern NSString* const kBrowserActionButtonDragEndNotification; scoped_nsobject<NSViewAnimation> moveAnimation_; // The extension for this button. Weak. - const Extension* extension_; + const extensions::Extension* extension_; // The ID of the active tab. int tabId_; @@ -57,7 +60,7 @@ extern NSString* const kBrowserActionButtonDragEndNotification; } - (id)initWithFrame:(NSRect)frame - extension:(const Extension*)extension + extension:(const extensions::Extension*)extension profile:(Profile*)profile tabId:(int)tabId; @@ -76,7 +79,7 @@ extern NSString* const kBrowserActionButtonDragEndNotification; - (NSImage*)compositedImage; @property(readonly, nonatomic) BOOL isBeingDragged; -@property(readonly, nonatomic) const Extension* extension; +@property(readonly, nonatomic) const extensions::Extension* extension; @property(readwrite, nonatomic) int tabId; @end diff --git a/chrome/browser/ui/cocoa/extensions/browser_action_button.mm b/chrome/browser/ui/cocoa/extensions/browser_action_button.mm index 3c5617d..bdd25c7 100644 --- a/chrome/browser/ui/cocoa/extensions/browser_action_button.mm +++ b/chrome/browser/ui/cocoa/extensions/browser_action_button.mm @@ -29,6 +29,8 @@ #include "ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h" #include "ui/gfx/size.h" +using extensions::Extension; + NSString* const kBrowserActionButtonUpdatedNotification = @"BrowserActionButtonUpdatedNotification"; diff --git a/chrome/browser/ui/cocoa/extensions/browser_actions_controller.h b/chrome/browser/ui/cocoa/extensions/browser_actions_controller.h index 02a26d9..59001cd 100644 --- a/chrome/browser/ui/cocoa/extensions/browser_actions_controller.h +++ b/chrome/browser/ui/cocoa/extensions/browser_actions_controller.h @@ -14,7 +14,6 @@ class Browser; @class BrowserActionButton; @class BrowserActionsContainerView; -class Extension; @class ExtensionPopupController; class ExtensionToolbarModel; class ExtensionServiceObserverBridge; @@ -22,6 +21,10 @@ class ExtensionServiceObserverBridge; class PrefService; class Profile; +namespace extensions { +class Extension; +} + // Sent when the visibility of the Browser Actions changes. extern NSString* const kBrowserActionVisibilityChangedNotification; @@ -88,7 +91,8 @@ extern NSString* const kBrowserActionVisibilityChangedNotification; - (void)resizeContainerAndAnimate:(BOOL)animate; // Returns the NSView for the action button associated with an extension. -- (NSView*)browserActionViewForExtension:(const Extension*)extension; +- (NSView*)browserActionViewForExtension:( + const extensions::Extension*)extension; // Returns the saved width determined by the number of shown Browser Actions // preference property. If no preference is found, then the width for the @@ -98,7 +102,7 @@ extern NSString* const kBrowserActionVisibilityChangedNotification; // Returns where the popup arrow should point to for a given Browser Action. If // it is passed an extension that is not a Browser Action, then it will return // NSZeroPoint. -- (NSPoint)popupPointForBrowserAction:(const Extension*)extension; +- (NSPoint)popupPointForBrowserAction:(const extensions::Extension*)extension; // Returns whether the chevron button is currently hidden or in the process of // being hidden (fading out). Will return NO if it is not hidden or is in the diff --git a/chrome/browser/ui/cocoa/extensions/browser_actions_controller.mm b/chrome/browser/ui/cocoa/extensions/browser_actions_controller.mm index 046f2e5..a946a22 100644 --- a/chrome/browser/ui/cocoa/extensions/browser_actions_controller.mm +++ b/chrome/browser/ui/cocoa/extensions/browser_actions_controller.mm @@ -34,6 +34,9 @@ #import "third_party/GTM/AppKit/GTMNSAnimation+Duration.h" #include "ui/gfx/mac/nsimage_cache.h" +using extensions::Extension; +using extensions::ExtensionList; + NSString* const kBrowserActionVisibilityChangedNotification = @"BrowserActionVisibilityChangedNotification"; diff --git a/chrome/browser/ui/cocoa/extensions/extension_action_context_menu.h b/chrome/browser/ui/cocoa/extensions/extension_action_context_menu.h index 8904fa8..addb655 100644 --- a/chrome/browser/ui/cocoa/extensions/extension_action_context_menu.h +++ b/chrome/browser/ui/cocoa/extensions/extension_action_context_menu.h @@ -12,10 +12,13 @@ #include "base/memory/scoped_ptr.h" class AsyncUninstaller; -class Extension; class ExtensionAction; class Profile; +namespace extensions { +class Extension; +} + namespace extension_action_context_menu { } // namespace extension_action_context_menu @@ -24,7 +27,7 @@ namespace extension_action_context_menu { @interface ExtensionActionContextMenu : NSMenu { @private // The extension that this menu belongs to. Weak. - const Extension* extension_; + const extensions::Extension* extension_; // The extension action this menu belongs to. Weak. ExtensionAction* action_; @@ -38,7 +41,7 @@ namespace extension_action_context_menu { } // Initializes and returns a context menu for the given extension and profile. -- (id)initWithExtension:(const Extension*)extension +- (id)initWithExtension:(const extensions::Extension*)extension profile:(Profile*)profile extensionAction:(ExtensionAction*)action; diff --git a/chrome/browser/ui/cocoa/extensions/extension_action_context_menu.mm b/chrome/browser/ui/cocoa/extensions/extension_action_context_menu.mm index 1b63043a..401481c 100644 --- a/chrome/browser/ui/cocoa/extensions/extension_action_context_menu.mm +++ b/chrome/browser/ui/cocoa/extensions/extension_action_context_menu.mm @@ -38,6 +38,7 @@ using content::OpenURLParams; using content::Referrer; using content::WebContents; +using extensions::Extension; // A class that loads the extension icon on the I/O thread before showing the // confirmation dialog to uninstall the given extension. diff --git a/chrome/browser/ui/cocoa/extensions/extension_install_dialog_controller.h b/chrome/browser/ui/cocoa/extensions/extension_install_dialog_controller.h index 6a58c94..9cab254 100644 --- a/chrome/browser/ui/cocoa/extensions/extension_install_dialog_controller.h +++ b/chrome/browser/ui/cocoa/extensions/extension_install_dialog_controller.h @@ -15,7 +15,6 @@ #include "chrome/browser/extensions/extension_install_ui.h" #include "third_party/skia/include/core/SkBitmap.h" -class Extension; class Profile; // Displays the extension or bundle install prompt, and notifies the diff --git a/chrome/browser/ui/cocoa/extensions/extension_install_dialog_controller_unittest.mm b/chrome/browser/ui/cocoa/extensions/extension_install_dialog_controller_unittest.mm index 2daa7f1..2e9b7d6 100644 --- a/chrome/browser/ui/cocoa/extensions/extension_install_dialog_controller_unittest.mm +++ b/chrome/browser/ui/cocoa/extensions/extension_install_dialog_controller_unittest.mm @@ -25,6 +25,7 @@ #include "ui/gfx/image/image.h" #include "webkit/glue/image_decoder.h" +using extensions::Extension; // Base class for our tests. class ExtensionInstallDialogControllerTest : public CocoaProfileTest { diff --git a/chrome/browser/ui/cocoa/extensions/extension_installed_bubble_bridge.mm b/chrome/browser/ui/cocoa/extensions/extension_installed_bubble_bridge.mm index 133beda..678f83c 100644 --- a/chrome/browser/ui/cocoa/extensions/extension_installed_bubble_bridge.mm +++ b/chrome/browser/ui/cocoa/extensions/extension_installed_bubble_bridge.mm @@ -28,7 +28,7 @@ using extensions::BundleInstaller; // When an extension is installed on Mac with neither browser action nor // page action icons, show an infobar instead of a popup bubble. static void ShowGenericExtensionInstalledInfoBar( - const Extension* new_extension, + const extensions::Extension* new_extension, const SkBitmap& icon, Profile* profile) { Browser* browser = browser::FindLastActiveWithProfile(profile); @@ -55,7 +55,7 @@ static void ShowGenericExtensionInstalledInfoBar( namespace browser { void ShowExtensionInstalledBubble( - const Extension* extension, + const extensions::Extension* extension, Browser* browser, const SkBitmap& icon, Profile* profile) { diff --git a/chrome/browser/ui/cocoa/extensions/extension_installed_bubble_controller.h b/chrome/browser/ui/cocoa/extensions/extension_installed_bubble_controller.h index b31d6c6..a4a76b9 100644 --- a/chrome/browser/ui/cocoa/extensions/extension_installed_bubble_controller.h +++ b/chrome/browser/ui/cocoa/extensions/extension_installed_bubble_controller.h @@ -15,13 +15,13 @@ #include "third_party/skia/include/core/SkBitmap.h" class Browser; -class Extension; class ExtensionLoadedNotificationObserver; @class HoverCloseButton; @class InfoBubbleView; namespace extensions { class BundleInstaller; +class Extension; } namespace extension_installed_bubble { @@ -52,7 +52,7 @@ typedef enum { // future. @interface ExtensionInstalledBubbleController : BaseBubbleController { @private - const Extension* extension_; // weak + const extensions::Extension* extension_; // weak const extensions::BundleInstaller* bundle_; // weak Browser* browser_; // weak scoped_nsobject<NSImage> icon_; @@ -83,14 +83,14 @@ typedef enum { IBOutlet NSTextField* failedItemsMsg_; } -@property(nonatomic, readonly) const Extension* extension; +@property(nonatomic, readonly) const extensions::Extension* extension; @property(nonatomic, readonly) const extensions::BundleInstaller* bundle; @property(nonatomic) BOOL pageActionRemoved; // Initialize the window, and then create observers to wait for the extension // to complete loading, or the browser window to close. - (id)initWithParentWindow:(NSWindow*)parentWindow - extension:(const Extension*)extension + extension:(const extensions::Extension*)extension bundle:(const extensions::BundleInstaller*)bundle browser:(Browser*)browser icon:(SkBitmap)icon; diff --git a/chrome/browser/ui/cocoa/extensions/extension_installed_bubble_controller.mm b/chrome/browser/ui/cocoa/extensions/extension_installed_bubble_controller.mm index 9d4317e..1869dbf 100644 --- a/chrome/browser/ui/cocoa/extensions/extension_installed_bubble_controller.mm +++ b/chrome/browser/ui/cocoa/extensions/extension_installed_bubble_controller.mm @@ -33,6 +33,7 @@ using content::BrowserThread; using extensions::BundleInstaller; +using extensions::Extension; // C++ class that receives EXTENSION_LOADED notifications and proxies them back // to |controller|. diff --git a/chrome/browser/ui/cocoa/extensions/extension_installed_bubble_controller_unittest.mm b/chrome/browser/ui/cocoa/extensions/extension_installed_bubble_controller_unittest.mm index aa36932..a26eaa0 100644 --- a/chrome/browser/ui/cocoa/extensions/extension_installed_bubble_controller_unittest.mm +++ b/chrome/browser/ui/cocoa/extensions/extension_installed_bubble_controller_unittest.mm @@ -21,6 +21,8 @@ #import "third_party/ocmock/OCMock/OCMock.h" #include "webkit/glue/image_decoder.h" +using extensions::Extension; + // ExtensionInstalledBubbleController with removePageActionPreview overridden // to a no-op, because pageActions are not yet hooked up in the test browser. @interface ExtensionInstalledBubbleControllerForTest : diff --git a/chrome/browser/ui/cocoa/extensions/shell_window_cocoa.h b/chrome/browser/ui/cocoa/extensions/shell_window_cocoa.h index b5020ec..5dfd030 100644 --- a/chrome/browser/ui/cocoa/extensions/shell_window_cocoa.h +++ b/chrome/browser/ui/cocoa/extensions/shell_window_cocoa.h @@ -31,7 +31,7 @@ class ShellWindowCocoa; class ShellWindowCocoa : public ShellWindow { public: ShellWindowCocoa(Profile* profile, - const Extension* extension, + const extensions::Extension* extension, const GURL& url); // BaseWindow implementation. diff --git a/chrome/browser/ui/cocoa/extensions/shell_window_cocoa.mm b/chrome/browser/ui/cocoa/extensions/shell_window_cocoa.mm index 01e41fb..03ec1fe 100644 --- a/chrome/browser/ui/cocoa/extensions/shell_window_cocoa.mm +++ b/chrome/browser/ui/cocoa/extensions/shell_window_cocoa.mm @@ -25,7 +25,7 @@ @end ShellWindowCocoa::ShellWindowCocoa(Profile* profile, - const Extension* extension, + const extensions::Extension* extension, const GURL& url) : ShellWindow(profile, extension, url), attention_request_id_(0) { @@ -170,7 +170,7 @@ NSWindow* ShellWindowCocoa::window() const { // static ShellWindow* ShellWindow::CreateImpl(Profile* profile, - const Extension* extension, + const extensions::Extension* extension, const GURL& url) { return new ShellWindowCocoa(profile, extension, url); } diff --git a/chrome/browser/ui/cocoa/infobars/extension_infobar_controller.mm b/chrome/browser/ui/cocoa/infobars/extension_infobar_controller.mm index cff2141..6bae992 100644 --- a/chrome/browser/ui/cocoa/infobars/extension_infobar_controller.mm +++ b/chrome/browser/ui/cocoa/infobars/extension_infobar_controller.mm @@ -69,7 +69,8 @@ class InfobarBridge : public ExtensionInfoBarDelegate::DelegateObserver, // Load the Extension's icon image. void LoadIcon() { - const Extension* extension = delegate_->extension_host()->extension(); + const extensions::Extension* extension = delegate_->extension_host()-> + extension(); ExtensionResource icon_resource = extension->GetIconResource(ExtensionIconSet::EXTENSION_ICON_BITTY, ExtensionIconSet::MATCH_EXACTLY); diff --git a/chrome/browser/ui/cocoa/location_bar/page_action_decoration.mm b/chrome/browser/ui/cocoa/location_bar/page_action_decoration.mm index 29a1bcf..aa7976c 100644 --- a/chrome/browser/ui/cocoa/location_bar/page_action_decoration.mm +++ b/chrome/browser/ui/cocoa/location_bar/page_action_decoration.mm @@ -22,6 +22,7 @@ #include "skia/ext/skia_utils_mac.h" using content::WebContents; +using extensions::Extension; namespace { diff --git a/chrome/browser/ui/extensions/shell_window.cc b/chrome/browser/ui/extensions/shell_window.cc index ff7881d..701e97c 100644 --- a/chrome/browser/ui/extensions/shell_window.cc +++ b/chrome/browser/ui/extensions/shell_window.cc @@ -84,14 +84,14 @@ void ShellWindowController::SetFullscreenMode(bool is_fullscreen, } // namespace internal ShellWindow* ShellWindow::Create(Profile* profile, - const Extension* extension, + const extensions::Extension* extension, const GURL& url) { // This object will delete itself when the window is closed. return ShellWindow::CreateImpl(profile, extension, url); } ShellWindow::ShellWindow(Profile* profile, - const Extension* extension, + const extensions::Extension* extension, const GURL& url) : profile_(profile), extension_(extension), @@ -180,8 +180,9 @@ void ShellWindow::Observe(int type, const content::NotificationDetails& details) { switch (type) { case chrome::NOTIFICATION_EXTENSION_UNLOADED: { - const Extension* unloaded_extension = - content::Details<UnloadedExtensionInfo>(details)->extension; + const extensions::Extension* unloaded_extension = + content::Details<extensions::UnloadedExtensionInfo>( + details)->extension; if (extension_ == unloaded_extension) Close(); break; diff --git a/chrome/browser/ui/extensions/shell_window.h b/chrome/browser/ui/extensions/shell_window.h index cd42822..386f431 100644 --- a/chrome/browser/ui/extensions/shell_window.h +++ b/chrome/browser/ui/extensions/shell_window.h @@ -15,7 +15,6 @@ #include "content/public/browser/web_contents_delegate.h" #include "content/public/browser/web_contents_observer.h" -class Extension; class ExtensionWindowController; class GURL; class Profile; @@ -25,6 +24,10 @@ namespace content { class WebContents; } +namespace extensions { +class Extension; +} + // ShellWindow is the type of window used by platform apps. Shell windows // have a WebContents but none of the chrome of normal browser windows. class ShellWindow : public content::NotificationObserver, @@ -34,7 +37,7 @@ class ShellWindow : public content::NotificationObserver, public BaseWindow { public: static ShellWindow* Create(Profile* profile, - const Extension* extension, + const extensions::Extension* extension, const GURL& url); const SessionID& session_id() const { return session_id_; } @@ -49,11 +52,11 @@ class ShellWindow : public content::NotificationObserver, static const int kDefaultHeight = 384; ShellWindow(Profile* profile, - const Extension* extension, + const extensions::Extension* extension, const GURL& url); virtual ~ShellWindow(); - const Extension* extension() const { return extension_; } + const extensions::Extension* extension() const { return extension_; } content::WebContents* web_contents() const { return web_contents_; } private: @@ -63,7 +66,7 @@ class ShellWindow : public content::NotificationObserver, // Instantiates a platform-specific ShellWindow subclass (one implementation // per platform). Public users of ShellWindow should use ShellWindow::Create. static ShellWindow* CreateImpl(Profile* profile, - const Extension* extension, + const extensions::Extension* extension, const GURL& url); // content::WebContentsObserver implementation. @@ -92,7 +95,8 @@ class ShellWindow : public content::NotificationObserver, void OnRequest(const ExtensionHostMsg_Request_Params& params); Profile* profile_; // weak pointer - owned by ProfileManager. - const Extension* extension_; // weak pointer - owned by ExtensionService. + // weak pointer - owned by ExtensionService. + const extensions::Extension* extension_; const SessionID session_id_; scoped_ptr<TabContentsWrapper> contents_wrapper_; diff --git a/chrome/browser/ui/fullscreen_exit_bubble_type.cc b/chrome/browser/ui/fullscreen_exit_bubble_type.cc index 6b27e8e..c5a8565 100644 --- a/chrome/browser/ui/fullscreen_exit_bubble_type.cc +++ b/chrome/browser/ui/fullscreen_exit_bubble_type.cc @@ -21,7 +21,7 @@ string16 GetLabelTextForType(FullscreenExitBubbleType type, if (extension_service) { const ExtensionSet* extensions = extension_service->extensions(); DCHECK(extensions); - const Extension* extension = + const extensions::Extension* extension = extensions->GetExtensionOrAppByURL(ExtensionURLInfo(url)); if (extension) { host = UTF8ToUTF16(extension->name()); diff --git a/chrome/browser/ui/gtk/browser_actions_toolbar_gtk.cc b/chrome/browser/ui/gtk/browser_actions_toolbar_gtk.cc index 98337fb..cf1cbef 100644 --- a/chrome/browser/ui/gtk/browser_actions_toolbar_gtk.cc +++ b/chrome/browser/ui/gtk/browser_actions_toolbar_gtk.cc @@ -49,6 +49,8 @@ #include "ui/gfx/gtk_util.h" #include "ui/gfx/image/image.h" +using extensions::Extension; + namespace { // The width of the browser action buttons. @@ -609,7 +611,7 @@ void BrowserActionsToolbarGtk::CreateAllButtons() { extension_button_map_.clear(); int i = 0; - for (ExtensionList::iterator iter = model_->begin(); + for (extensions::ExtensionList::iterator iter = model_->begin(); iter != model_->end(); ++iter) { CreateButtonForExtension(*iter, i++); } diff --git a/chrome/browser/ui/gtk/browser_actions_toolbar_gtk.h b/chrome/browser/ui/gtk/browser_actions_toolbar_gtk.h index 2aa9185..58b3660 100644 --- a/chrome/browser/ui/gtk/browser_actions_toolbar_gtk.h +++ b/chrome/browser/ui/gtk/browser_actions_toolbar_gtk.h @@ -27,10 +27,13 @@ class Browser; class BrowserActionButton; -class Extension; class GtkThemeService; class Profile; +namespace extensions { +class Extension; +} + typedef struct _GdkDragContext GdkDragContext; typedef struct _GtkWidget GtkWidget; @@ -49,7 +52,7 @@ class BrowserActionsToolbarGtk : public ExtensionToolbarModel::Observer, // Returns the widget in use by the BrowserActionButton corresponding to // |extension|. Used in positioning the ExtensionInstalledBubble for // BrowserActions. - GtkWidget* GetBrowserActionWidget(const Extension* extension); + GtkWidget* GetBrowserActionWidget(const extensions::Extension* extension); int button_count() { return extension_button_map_.size(); } @@ -87,10 +90,11 @@ class BrowserActionsToolbarGtk : public ExtensionToolbarModel::Observer, // Create the UI for a single browser action. This will stick the button // at the end of the toolbar. - void CreateButtonForExtension(const Extension* extension, int index); + void CreateButtonForExtension(const extensions::Extension* extension, + int index); // Delete resources associated with UI for a browser action. - void RemoveButtonForExtension(const Extension* extension); + void RemoveButtonForExtension(const extensions::Extension* extension); // Change the visibility of widget() based on whether we have any buttons // to show. @@ -106,13 +110,14 @@ class BrowserActionsToolbarGtk : public ExtensionToolbarModel::Observer, // Returns true if this extension should be shown in this toolbar. This can // return false if we are in an incognito window and the extension is disabled // for incognito. - bool ShouldDisplayBrowserAction(const Extension* extension); + bool ShouldDisplayBrowserAction(const extensions::Extension* extension); // ExtensionToolbarModel::Observer implementation. - virtual void BrowserActionAdded(const Extension* extension, + virtual void BrowserActionAdded(const extensions::Extension* extension, int index) OVERRIDE; - virtual void BrowserActionRemoved(const Extension* extension) OVERRIDE; - virtual void BrowserActionMoved(const Extension* extension, + virtual void BrowserActionRemoved( + const extensions::Extension* extension) OVERRIDE; + virtual void BrowserActionMoved(const extensions::Extension* extension, int index) OVERRIDE; virtual void ModelLoaded() OVERRIDE; diff --git a/chrome/browser/ui/gtk/browser_window_gtk.cc b/chrome/browser/ui/gtk/browser_window_gtk.cc index 7ede5fb..85ba20e 100644 --- a/chrome/browser/ui/gtk/browser_window_gtk.cc +++ b/chrome/browser/ui/gtk/browser_window_gtk.cc @@ -1224,7 +1224,7 @@ void BrowserWindowGtk::ShowCreateWebAppShortcutsDialog( } void BrowserWindowGtk::ShowCreateChromeAppShortcutsDialog( - Profile* profile, const Extension* app) { + Profile* profile, const extensions::Extension* app) { CreateChromeApplicationShortcutsDialogGtk::Show(window_, profile, app); } diff --git a/chrome/browser/ui/gtk/browser_window_gtk.h b/chrome/browser/ui/gtk/browser_window_gtk.h index 4b79cc7..5924cbe 100644 --- a/chrome/browser/ui/gtk/browser_window_gtk.h +++ b/chrome/browser/ui/gtk/browser_window_gtk.h @@ -40,6 +40,10 @@ class StatusBubbleGtk; class TabContentsContainerGtk; class TabStripGtk; +namespace extensions { +class Extension; +} + // An implementation of BrowserWindow for GTK. // Cross-platform code will interact with this object when // it needs to manipulate the window. @@ -153,7 +157,7 @@ class BrowserWindowGtk : public BrowserWindow, TabContentsWrapper* tab_contents) OVERRIDE; virtual void ShowCreateChromeAppShortcutsDialog( Profile* profile, - const Extension* app) OVERRIDE; + const extensions::Extension* app) OVERRIDE; virtual void Cut() OVERRIDE; virtual void Copy() OVERRIDE; virtual void Paste() OVERRIDE; diff --git a/chrome/browser/ui/gtk/create_application_shortcuts_dialog_gtk.cc b/chrome/browser/ui/gtk/create_application_shortcuts_dialog_gtk.cc index 1ae913b..c73ed67 100644 --- a/chrome/browser/ui/gtk/create_application_shortcuts_dialog_gtk.cc +++ b/chrome/browser/ui/gtk/create_application_shortcuts_dialog_gtk.cc @@ -32,6 +32,7 @@ #include "ui/gfx/gtk_util.h" using content::BrowserThread; +using extensions::Extension; namespace { diff --git a/chrome/browser/ui/gtk/create_application_shortcuts_dialog_gtk.h b/chrome/browser/ui/gtk/create_application_shortcuts_dialog_gtk.h index 01de16c..6253f8b 100644 --- a/chrome/browser/ui/gtk/create_application_shortcuts_dialog_gtk.h +++ b/chrome/browser/ui/gtk/create_application_shortcuts_dialog_gtk.h @@ -22,10 +22,13 @@ typedef struct _GdkPixbuf GdkPixbuf; typedef struct _GtkWidget GtkWidget; typedef struct _GtkWindow GtkWindow; -class Extension; class Profile; class TabContentsWrapper; +namespace extensions{ +class Extension; +} + class CreateApplicationShortcutsDialogGtk : public base::RefCountedThreadSafe<CreateApplicationShortcutsDialogGtk, BrowserThread::DeleteOnUIThread> { @@ -103,11 +106,12 @@ class CreateChromeApplicationShortcutsDialogGtk public ImageLoadingTracker::Observer { public: // Displays the dialog box to create application shortcuts for |app|. - static void Show(GtkWindow* parent, Profile* profile, const Extension* app); + static void Show(GtkWindow* parent, Profile* profile, + const extensions::Extension* app); CreateChromeApplicationShortcutsDialogGtk(GtkWindow* parent, Profile* profile, - const Extension* app); + const extensions::Extension* app); // Implement ImageLoadingTracker::Observer. |tracker_| is used to // load the app's icon. This method recieves the icon, and adds @@ -123,7 +127,7 @@ class CreateChromeApplicationShortcutsDialogGtk const ShellIntegration::ShortcutInfo& shortcut_info) OVERRIDE; private: - const Extension* app_; + const extensions::Extension* app_; FilePath profile_path_; ImageLoadingTracker tracker_; DISALLOW_COPY_AND_ASSIGN(CreateChromeApplicationShortcutsDialogGtk); diff --git a/chrome/browser/ui/gtk/extensions/extension_installed_bubble_gtk.cc b/chrome/browser/ui/gtk/extensions/extension_installed_bubble_gtk.cc index 6ca7c08..b9ae719 100644 --- a/chrome/browser/ui/gtk/extensions/extension_installed_bubble_gtk.cc +++ b/chrome/browser/ui/gtk/extensions/extension_installed_bubble_gtk.cc @@ -31,6 +31,8 @@ #include "ui/base/resource/resource_bundle.h" #include "ui/gfx/gtk_util.h" +using extensions::Extension; + namespace { const int kHorizontalColumnSpacing = 10; @@ -115,7 +117,7 @@ void ExtensionInstalledBubbleGtk::Observe( } } else if (type == chrome::NOTIFICATION_EXTENSION_UNLOADED) { const Extension* extension = - content::Details<UnloadedExtensionInfo>(details)->extension; + content::Details<extensions::UnloadedExtensionInfo>(details)->extension; if (extension == extension_) extension_ = NULL; } else { diff --git a/chrome/browser/ui/gtk/extensions/extension_installed_bubble_gtk.h b/chrome/browser/ui/gtk/extensions/extension_installed_bubble_gtk.h index cf21723..54f9d06 100644 --- a/chrome/browser/ui/gtk/extensions/extension_installed_bubble_gtk.h +++ b/chrome/browser/ui/gtk/extensions/extension_installed_bubble_gtk.h @@ -16,9 +16,12 @@ #include "third_party/skia/include/core/SkBitmap.h" class Browser; -class Extension; class SkBitmap; +namespace extensions { +class Extension; +} + // Provides feedback to the user upon successful installation of an // extension. Depending on the type of extension, the BubbleGtk will // point to: @@ -47,14 +50,16 @@ class ExtensionInstalledBubbleGtk // the extension has loaded. |extension| is the installed extension. |browser| // is the browser window which will host the bubble. |icon| is the install // icon of the extension. - static void Show( - const Extension* extension, Browser *browser, const SkBitmap& icon); + static void Show(const extensions::Extension* extension, + Browser *browser, + const SkBitmap& icon); private: friend class base::RefCountedThreadSafe<ExtensionInstalledBubbleGtk>; // Private ctor. Registers a listener for EXTENSION_LOADED. - ExtensionInstalledBubbleGtk(const Extension* extension, Browser *browser, + ExtensionInstalledBubbleGtk(const extensions::Extension* extension, + Browser *browser, const SkBitmap& icon); virtual ~ExtensionInstalledBubbleGtk(); @@ -76,7 +81,7 @@ class ExtensionInstalledBubbleGtk static void OnButtonClick(GtkWidget* button, ExtensionInstalledBubbleGtk* toolbar); - const Extension* extension_; + const extensions::Extension* extension_; Browser* browser_; SkBitmap icon_; content::NotificationRegistrar registrar_; diff --git a/chrome/browser/ui/gtk/extensions/extension_keybinding_registry_gtk.cc b/chrome/browser/ui/gtk/extensions/extension_keybinding_registry_gtk.cc index d3709df..39c8c3b 100644 --- a/chrome/browser/ui/gtk/extensions/extension_keybinding_registry_gtk.cc +++ b/chrome/browser/ui/gtk/extensions/extension_keybinding_registry_gtk.cc @@ -43,7 +43,7 @@ gboolean ExtensionKeybindingRegistryGtk::HasPriorityHandler( } void ExtensionKeybindingRegistryGtk::AddExtensionKeybinding( - const Extension* extension) { + const extensions::Extension* extension) { ExtensionCommandService* command_service = ExtensionCommandServiceFactory::GetForProfile(profile_); const extensions::CommandMap& commands = @@ -97,7 +97,7 @@ void ExtensionKeybindingRegistryGtk::AddExtensionKeybinding( } void ExtensionKeybindingRegistryGtk::RemoveExtensionKeybinding( - const Extension* extension) { + const extensions::Extension* extension) { EventTargets::iterator iter = event_targets_.begin(); while (iter != event_targets_.end()) { if (iter->second.first != extension->id()) { diff --git a/chrome/browser/ui/gtk/extensions/extension_keybinding_registry_gtk.h b/chrome/browser/ui/gtk/extensions/extension_keybinding_registry_gtk.h index 41d0006..e17977c 100644 --- a/chrome/browser/ui/gtk/extensions/extension_keybinding_registry_gtk.h +++ b/chrome/browser/ui/gtk/extensions/extension_keybinding_registry_gtk.h @@ -14,9 +14,12 @@ #include "ui/base/accelerators/accelerator_gtk.h" #include "ui/base/gtk/gtk_signal.h" -class Extension; class Profile; +namespace extensions { +class Extension; +} + typedef struct _GtkAccelGroup GtkAccelGroup; typedef struct _GdkEventKey GdkEventKey; @@ -42,8 +45,10 @@ class ExtensionKeybindingRegistryGtk protected: // Overridden from ExtensionKeybindingRegistry: - virtual void AddExtensionKeybinding(const Extension* extension) OVERRIDE; - virtual void RemoveExtensionKeybinding(const Extension* extension) OVERRIDE; + virtual void AddExtensionKeybinding( + const extensions::Extension* extension) OVERRIDE; + virtual void RemoveExtensionKeybinding( + const extensions::Extension* extension) OVERRIDE; private: // The accelerator handler for when the extension command shortcuts are diff --git a/chrome/browser/ui/gtk/extensions/shell_window_gtk.cc b/chrome/browser/ui/gtk/extensions/shell_window_gtk.cc index 04aaf78..466a217 100644 --- a/chrome/browser/ui/gtk/extensions/shell_window_gtk.cc +++ b/chrome/browser/ui/gtk/extensions/shell_window_gtk.cc @@ -13,7 +13,7 @@ #include "ui/gfx/rect.h" ShellWindowGtk::ShellWindowGtk(Profile* profile, - const Extension* extension, + const extensions::Extension* extension, const GURL& url) : ShellWindow(profile, extension, url), state_(GDK_WINDOW_STATE_WITHDRAWN), @@ -168,7 +168,7 @@ gboolean ShellWindowGtk::OnWindowState(GtkWidget* sender, // static ShellWindow* ShellWindow::CreateImpl(Profile* profile, - const Extension* extension, + const extensions::Extension* extension, const GURL& url) { return new ShellWindowGtk(profile, extension, url); } diff --git a/chrome/browser/ui/gtk/extensions/shell_window_gtk.h b/chrome/browser/ui/gtk/extensions/shell_window_gtk.h index 1e14c89..6705ec9 100644 --- a/chrome/browser/ui/gtk/extensions/shell_window_gtk.h +++ b/chrome/browser/ui/gtk/extensions/shell_window_gtk.h @@ -16,12 +16,16 @@ class Profile; +namespace extensions { +class Extension; +} + class ShellWindowGtk : public ShellWindow, public ExtensionViewGtk::Container, public ui::ActiveWindowWatcherXObserver { public: ShellWindowGtk(Profile* profile, - const Extension* extension, + const extensions::Extension* extension, const GURL& url); // BaseWindow implementation. diff --git a/chrome/browser/ui/gtk/gtk_theme_service.cc b/chrome/browser/ui/gtk/gtk_theme_service.cc index 3b74081..a9123a9 100644 --- a/chrome/browser/ui/gtk/gtk_theme_service.cc +++ b/chrome/browser/ui/gtk/gtk_theme_service.cc @@ -25,6 +25,7 @@ #include "chrome/browser/ui/gtk/gtk_util.h" #include "chrome/browser/ui/gtk/hover_controller_gtk.h" #include "chrome/common/chrome_notification_types.h" +#include "chrome/common/extensions/extension.h" #include "chrome/common/pref_names.h" #include "content/public/browser/notification_details.h" #include "content/public/browser/notification_service.h" @@ -346,7 +347,7 @@ void GtkThemeService::InitThemesFor(NotificationObserver* observer) { content::NotificationService::NoDetails()); } -void GtkThemeService::SetTheme(const Extension* extension) { +void GtkThemeService::SetTheme(const extensions::Extension* extension) { profile()->GetPrefs()->SetBoolean(prefs::kUsesSystemTheme, false); LoadDefaultValues(); ThemeService::SetTheme(extension); diff --git a/chrome/browser/ui/gtk/gtk_theme_service.h b/chrome/browser/ui/gtk/gtk_theme_service.h index d421ffb..d253aa0 100644 --- a/chrome/browser/ui/gtk/gtk_theme_service.h +++ b/chrome/browser/ui/gtk/gtk_theme_service.h @@ -21,6 +21,10 @@ class Profile; +namespace extensions { +class Extension; +} + namespace gfx { class CairoCachedSurface; } @@ -68,7 +72,7 @@ class GtkThemeService : public ThemeService { virtual const gfx::Image* GetImageNamed(int id) const OVERRIDE; virtual SkColor GetColor(int id) const OVERRIDE; virtual bool HasCustomImage(int id) const OVERRIDE; - virtual void SetTheme(const Extension* extension) OVERRIDE; + virtual void SetTheme(const extensions::Extension* extension) OVERRIDE; virtual void UseDefaultTheme() OVERRIDE; virtual void SetNativeTheme() OVERRIDE; virtual bool UsingDefaultTheme() const OVERRIDE; diff --git a/chrome/browser/ui/gtk/infobars/extension_infobar_gtk.cc b/chrome/browser/ui/gtk/infobars/extension_infobar_gtk.cc index b78d006..cdac8db 100644 --- a/chrome/browser/ui/gtk/infobars/extension_infobar_gtk.cc +++ b/chrome/browser/ui/gtk/infobars/extension_infobar_gtk.cc @@ -109,7 +109,8 @@ void ExtensionInfoBarGtk::BuildWidgets() { gtk_util::CenterWidgetInHBox(hbox_, button_, false, 0); // Start loading the image for the menu button. - const Extension* extension = delegate_->extension_host()->extension(); + const extensions::Extension* extension = delegate_->extension_host()-> + extension(); ExtensionResource icon_resource = extension->GetIconResource( ExtensionIconSet::EXTENSION_ICON_BITTY, ExtensionIconSet::MATCH_EXACTLY); // Create a tracker to load the image. It will report back on OnImageLoaded. @@ -154,7 +155,7 @@ Browser* ExtensionInfoBarGtk::GetBrowser() { } ui::MenuModel* ExtensionInfoBarGtk::BuildMenuModel() { - const Extension* extension = delegate_->extension(); + const extensions::Extension* extension = delegate_->extension(); if (!extension->ShowConfigureContextMenus()) return NULL; diff --git a/chrome/browser/ui/gtk/location_bar_view_gtk.cc b/chrome/browser/ui/gtk/location_bar_view_gtk.cc index 3b8cdfc..fbd73a8 100644 --- a/chrome/browser/ui/gtk/location_bar_view_gtk.cc +++ b/chrome/browser/ui/gtk/location_bar_view_gtk.cc @@ -84,6 +84,7 @@ using content::NavigationEntry; using content::OpenURLParams; using content::WebContents; using extensions::ActionBoxController; +using extensions::Extension; namespace { diff --git a/chrome/browser/ui/intents/web_intent_picker_controller_browsertest.cc b/chrome/browser/ui/intents/web_intent_picker_controller_browsertest.cc index df67227..6528dab 100644 --- a/chrome/browser/ui/intents/web_intent_picker_controller_browsertest.cc +++ b/chrome/browser/ui/intents/web_intent_picker_controller_browsertest.cc @@ -463,8 +463,8 @@ IN_PROC_BROWSER_TEST_F(WebIntentPickerControllerBrowserTest, OnExtensionInstallRequested(extension_id); picker_.Wait(); EXPECT_EQ(1, picker_.num_extensions_installed_); - const Extension* extension = browser()->profile()->GetExtensionService()-> - GetExtensionById(extension_id, false); + const extensions::Extension* extension = browser()->profile()-> + GetExtensionService()->GetExtensionById(extension_id, false); EXPECT_TRUE(extension); // Installing an extension should also choose it. Since this extension uses diff --git a/chrome/browser/ui/panels/base_panel_browser_test.cc b/chrome/browser/ui/panels/base_panel_browser_test.cc index a6df5ee..c7a2e25 100644 --- a/chrome/browser/ui/panels/base_panel_browser_test.cc +++ b/chrome/browser/ui/panels/base_panel_browser_test.cc @@ -40,6 +40,7 @@ #endif using content::WebContentsTester; +using extensions::Extension; namespace { diff --git a/chrome/browser/ui/panels/base_panel_browser_test.h b/chrome/browser/ui/panels/base_panel_browser_test.h index 8afc099..eca8bbb 100644 --- a/chrome/browser/ui/panels/base_panel_browser_test.h +++ b/chrome/browser/ui/panels/base_panel_browser_test.h @@ -92,9 +92,10 @@ class BasePanelBrowserTest : public InProcessBrowserTest { void CreateTestTabContents(Browser* browser); - scoped_refptr<Extension> CreateExtension(const FilePath::StringType& path, - Extension::Location location, - const DictionaryValue& extra_value); + scoped_refptr<extensions::Extension> CreateExtension( + const FilePath::StringType& path, + extensions::Extension::Location location, + const DictionaryValue& extra_value); void MoveMouseAndWaitForExpansionStateChange(Panel* panel, const gfx::Point& position); diff --git a/chrome/browser/ui/panels/panel.cc b/chrome/browser/ui/panels/panel.cc index e4f54d1..f9a8db8 100644 --- a/chrome/browser/ui/panels/panel.cc +++ b/chrome/browser/ui/panels/panel.cc @@ -602,7 +602,7 @@ void Panel::ShowCreateWebAppShortcutsDialog(TabContentsWrapper* tab_contents) { } void Panel::ShowCreateChromeAppShortcutsDialog(Profile* profile, - const Extension* app) { + const extensions::Extension* app) { NOTIMPLEMENTED(); } diff --git a/chrome/browser/ui/panels/panel.h b/chrome/browser/ui/panels/panel.h index 9f2eaca..363c6a5 100644 --- a/chrome/browser/ui/panels/panel.h +++ b/chrome/browser/ui/panels/panel.h @@ -20,6 +20,10 @@ class NativePanel; class PanelManager; class PanelStrip; +namespace extensions { +class Extension; +} + // A platform independent implementation of BrowserWindow for Panels. This // class would get the first crack at all the BrowserWindow calls for Panels and // do one or more of the following: @@ -175,7 +179,7 @@ class Panel : public BrowserWindow, virtual void ShowCreateWebAppShortcutsDialog( TabContentsWrapper* tab_contents) OVERRIDE; virtual void ShowCreateChromeAppShortcutsDialog( - Profile* profile, const Extension* app) OVERRIDE; + Profile* profile, const extensions::Extension* app) OVERRIDE; virtual void Cut() OVERRIDE; virtual void Copy() OVERRIDE; virtual void Paste() OVERRIDE; diff --git a/chrome/browser/ui/panels/panel_app_browsertest.cc b/chrome/browser/ui/panels/panel_app_browsertest.cc index 541aef5..ba3b086d 100644 --- a/chrome/browser/ui/panels/panel_app_browsertest.cc +++ b/chrome/browser/ui/panels/panel_app_browsertest.cc @@ -42,7 +42,7 @@ class PanelAppBrowserTest : public ExtensionBrowserTest { EXPECT_TRUE(LoadExtension(test_data_dir_.AppendASCII(name))); ExtensionService* service = browser()->profile()->GetExtensionService(); - const Extension* extension = service->GetExtensionById( + const extensions::Extension* extension = service->GetExtensionById( last_loaded_extension_id_, false); EXPECT_TRUE(extension); diff --git a/chrome/browser/ui/panels/panel_browser_frame_view.h b/chrome/browser/ui/panels/panel_browser_frame_view.h index 953b19c..bc542a8 100644 --- a/chrome/browser/ui/panels/panel_browser_frame_view.h +++ b/chrome/browser/ui/panels/panel_browser_frame_view.h @@ -13,7 +13,6 @@ #include "chrome/browser/ui/views/tab_icon_view.h" #include "ui/views/controls/button/button.h" -class Extension; class PanelBrowserView; class SkPaint; namespace gfx { diff --git a/chrome/browser/ui/panels/panel_browsertest.cc b/chrome/browser/ui/panels/panel_browsertest.cc index 87f4681..4068b7a 100644 --- a/chrome/browser/ui/panels/panel_browsertest.cc +++ b/chrome/browser/ui/panels/panel_browsertest.cc @@ -50,6 +50,7 @@ using content::BrowserThread; using content::DownloadItem; using content::DownloadManager; using content::WebContents; +using extensions::Extension; class PanelBrowserTest : public BasePanelBrowserTest { public: @@ -1332,12 +1333,12 @@ IN_PROC_BROWSER_TEST_F(PanelBrowserTest, content::Source<Browser>(panel1->browser())); // Send unload notification on the first extension. - UnloadedExtensionInfo details(extension, + extensions::UnloadedExtensionInfo details(extension, extension_misc::UNLOAD_REASON_UNINSTALL); content::NotificationService::current()->Notify( chrome::NOTIFICATION_EXTENSION_UNLOADED, content::Source<Profile>(browser()->profile()), - content::Details<UnloadedExtensionInfo>(&details)); + content::Details<extensions::UnloadedExtensionInfo>(&details)); // Wait for the panels opened by the first extension to close. signal.Wait(); diff --git a/chrome/browser/ui/startup/startup_browser_creator_browsertest.cc b/chrome/browser/ui/startup/startup_browser_creator_browsertest.cc index 8f83a6a..e13e32d 100644 --- a/chrome/browser/ui/startup/startup_browser_creator_browsertest.cc +++ b/chrome/browser/ui/startup/startup_browser_creator_browsertest.cc @@ -31,6 +31,8 @@ #include "content/public/browser/web_contents.h" #include "testing/gtest/include/gtest/gtest.h" +using extensions::Extension; + class StartupBrowserCreatorTest : public ExtensionBrowserTest { protected: virtual bool SetUpUserDataDirectory() OVERRIDE { diff --git a/chrome/browser/ui/startup/startup_browser_creator_impl.cc b/chrome/browser/ui/startup/startup_browser_creator_impl.cc index bcf88f8..fca8b92 100644 --- a/chrome/browser/ui/startup/startup_browser_creator_impl.cc +++ b/chrome/browser/ui/startup/startup_browser_creator_impl.cc @@ -89,6 +89,7 @@ using content::ChildProcessSecurityPolicy; using content::WebContents; +using extensions::Extension; using protector::ProtectedPrefsWatcher; using protector::ProtectorService; using protector::ProtectorServiceFactory; diff --git a/chrome/browser/ui/tabs/pinned_tab_codec.cc b/chrome/browser/ui/tabs/pinned_tab_codec.cc index 849033a..00258dc 100644 --- a/chrome/browser/ui/tabs/pinned_tab_codec.cc +++ b/chrome/browser/ui/tabs/pinned_tab_codec.cc @@ -54,7 +54,7 @@ static void EncodePinnedTab(TabStripModel* model, TabContentsWrapper* tab_contents = model->GetTabContentsAt(index); if (model->IsAppTab(index)) { - const Extension* extension = + const extensions::Extension* extension = tab_contents->extension_tab_helper()->extension_app(); DCHECK(extension); value->SetString(kAppID, extension->id()); diff --git a/chrome/browser/ui/tabs/tab_strip_model.cc b/chrome/browser/ui/tabs/tab_strip_model.cc index bf8b302..d7d600a2 100644 --- a/chrome/browser/ui/tabs/tab_strip_model.cc +++ b/chrome/browser/ui/tabs/tab_strip_model.cc @@ -1020,8 +1020,9 @@ void TabStripModel::Observe(int type, } case chrome::NOTIFICATION_EXTENSION_UNLOADED: { - const Extension* extension = - content::Details<UnloadedExtensionInfo>(details)->extension; + const extensions::Extension* extension = + content::Details<extensions::UnloadedExtensionInfo>( + details)->extension; // Iterate backwards as we may remove items while iterating. for (int i = count() - 1; i >= 0; i--) { TabContentsWrapper* contents = GetTabContentsAt(i); diff --git a/chrome/browser/ui/tabs/tab_strip_model_unittest.cc b/chrome/browser/ui/tabs/tab_strip_model_unittest.cc index e9b4153..b8099f1 100644 --- a/chrome/browser/ui/tabs/tab_strip_model_unittest.cc +++ b/chrome/browser/ui/tabs/tab_strip_model_unittest.cc @@ -46,6 +46,7 @@ using content::BrowserThread; using content::NavigationController; using content::SiteInstance; using content::WebContents; +using extensions::Extension; using testing::_; namespace { diff --git a/chrome/browser/ui/views/ash/app_list/app_list_model_builder.cc b/chrome/browser/ui/views/ash/app_list/app_list_model_builder.cc index ce6c67f..a660105 100644 --- a/chrome/browser/ui/views/ash/app_list/app_list_model_builder.cc +++ b/chrome/browser/ui/views/ash/app_list/app_list_model_builder.cc @@ -23,6 +23,8 @@ #include "ui/base/l10n/l10n_util_collator.h" #include "ui/base/resource/resource_bundle.h" +using extensions::Extension; + namespace { const char* kSpecialApps[] = { @@ -251,7 +253,8 @@ void AppListModelBuilder::Observe(int type, } case chrome::NOTIFICATION_EXTENSION_UNLOADED: { const Extension* extension = - content::Details<UnloadedExtensionInfo>(details)->extension; + content::Details<extensions::UnloadedExtensionInfo>( + details)->extension; int index = FindApp(extension->id()); if (index >= 0) model_->DeleteItemAt(index); diff --git a/chrome/browser/ui/views/ash/app_list/extension_app_item.cc b/chrome/browser/ui/views/ash/app_list/extension_app_item.cc index 6aef8c7..632887b 100644 --- a/chrome/browser/ui/views/ash/app_list/extension_app_item.cc +++ b/chrome/browser/ui/views/ash/app_list/extension_app_item.cc @@ -21,6 +21,8 @@ #include "ui/base/l10n/l10n_util.h" #include "ui/gfx/image/image.h" +using extensions::Extension; + namespace { enum CommandId { diff --git a/chrome/browser/ui/views/ash/app_list/extension_app_item.h b/chrome/browser/ui/views/ash/app_list/extension_app_item.h index 3621ded..c4dcdf8 100644 --- a/chrome/browser/ui/views/ash/app_list/extension_app_item.h +++ b/chrome/browser/ui/views/ash/app_list/extension_app_item.h @@ -13,22 +13,25 @@ #include "chrome/browser/ui/views/ash/app_list/chrome_app_list_item.h" #include "ui/base/models/simple_menu_model.h" -class Extension; class ExtensionResource; class Profile; class SkBitmap; +namespace extensions { +class Extension; +} + // ExtensionAppItem represents an extension app in app list. class ExtensionAppItem : public ChromeAppListItem, public ImageLoadingTracker::Observer, public ui::SimpleMenuModel::Delegate { public: - ExtensionAppItem(Profile* profile, const Extension* extension); + ExtensionAppItem(Profile* profile, const extensions::Extension* extension); virtual ~ExtensionAppItem(); // Gets extension associated with this model. Returns NULL if extension // no longer exists. - const Extension* GetExtension() const; + const extensions::Extension* GetExtension() const; const std::string& extension_id() const { return extension_id_; @@ -36,7 +39,7 @@ class ExtensionAppItem : public ChromeAppListItem, private: // Loads extension icon. - void LoadImage(const Extension* extension); + void LoadImage(const extensions::Extension* extension); void ShowExtensionOptions(); void StartExtensionUninstall(); diff --git a/chrome/browser/ui/views/ash/extension_utils.cc b/chrome/browser/ui/views/ash/extension_utils.cc index c31411b..3e3633e 100644 --- a/chrome/browser/ui/views/ash/extension_utils.cc +++ b/chrome/browser/ui/views/ash/extension_utils.cc @@ -17,7 +17,7 @@ namespace extension_utils { // Opens an extension. |event_flags| holds the flags of the event // which invokes this extension. void OpenExtension(Profile* profile, - const Extension* extension, + const extensions::Extension* extension, int event_flags) { DCHECK(profile); DCHECK(extension); diff --git a/chrome/browser/ui/views/ash/extension_utils.h b/chrome/browser/ui/views/ash/extension_utils.h index 95d4f76..f38f030 100644 --- a/chrome/browser/ui/views/ash/extension_utils.h +++ b/chrome/browser/ui/views/ash/extension_utils.h @@ -7,14 +7,17 @@ #pragma once class Profile; + +namespace extensions { class Extension; +} namespace extension_utils { // Opens an extension. |event_flags| holds the flags of the event // which triggered this extension. void OpenExtension(Profile* profile, - const Extension* extension, + const extensions::Extension* extension, int event_flags); } // namespace extension_utils diff --git a/chrome/browser/ui/views/ash/launcher/browser_launcher_item_controller.cc b/chrome/browser/ui/views/ash/launcher/browser_launcher_item_controller.cc index 3563c3c..6fba790 100644 --- a/chrome/browser/ui/views/ash/launcher/browser_launcher_item_controller.cc +++ b/chrome/browser/ui/views/ash/launcher/browser_launcher_item_controller.cc @@ -188,7 +188,7 @@ void BrowserLauncherItemController::UpdateLauncher(TabContentsWrapper* tab) { if (!new_image.empty()) item.image = new_image; else if (item.image.empty()) - item.image = Extension::GetDefaultIcon(true); + item.image = extensions::Extension::GetDefaultIcon(true); } else { DCHECK_EQ(TYPE_TABBED, type_); ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); diff --git a/chrome/browser/ui/views/ash/launcher/chrome_launcher_controller.cc b/chrome/browser/ui/views/ash/launcher/chrome_launcher_controller.cc index 6ca146e..96ca234 100644 --- a/chrome/browser/ui/views/ash/launcher/chrome_launcher_controller.cc +++ b/chrome/browser/ui/views/ash/launcher/chrome_launcher_controller.cc @@ -39,6 +39,8 @@ #include "ui/aura/window.h" #include "ui/views/widget/widget.h" +using extensions::Extension; + namespace { // Values used for prefs::kShelfAutoHideBehavior. @@ -534,7 +536,8 @@ void ChromeLauncherController::Observe( } case chrome::NOTIFICATION_EXTENSION_UNLOADED: { const Extension* extension = - content::Details<UnloadedExtensionInfo>(details)->extension; + content::Details<extensions::UnloadedExtensionInfo>( + details)->extension; if (IsAppPinned(extension->id())) { // TODO(dpolukhin): also we need to remember index of the app to show // it on the same place when it gets loaded again. diff --git a/chrome/browser/ui/views/ash/launcher/chrome_launcher_controller_unittest.cc b/chrome/browser/ui/views/ash/launcher/chrome_launcher_controller_unittest.cc index 9c47f9c..deb821c 100644 --- a/chrome/browser/ui/views/ash/launcher/chrome_launcher_controller_unittest.cc +++ b/chrome/browser/ui/views/ash/launcher/chrome_launcher_controller_unittest.cc @@ -19,6 +19,8 @@ #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" +using extensions::Extension; + class ChromeLauncherControllerTest : public testing::Test { protected: ChromeLauncherControllerTest() diff --git a/chrome/browser/ui/views/ash/launcher/launcher_app_icon_loader.cc b/chrome/browser/ui/views/ash/launcher/launcher_app_icon_loader.cc index 9d0ac08..12f8839 100644 --- a/chrome/browser/ui/views/ash/launcher/launcher_app_icon_loader.cc +++ b/chrome/browser/ui/views/ash/launcher/launcher_app_icon_loader.cc @@ -22,7 +22,7 @@ LauncherAppIconLoader::~LauncherAppIconLoader() { } std::string LauncherAppIconLoader::GetAppID(TabContentsWrapper* tab) { - const Extension* extension = GetExtensionForTab(tab); + const extensions::Extension* extension = GetExtensionForTab(tab); return extension ? extension->id() : std::string(); } @@ -37,7 +37,7 @@ void LauncherAppIconLoader::FetchImage(const std::string& id) { return; // Already loading the image. } - const Extension* extension = GetExtensionByID(id); + const extensions::Extension* extension = GetExtensionByID(id); if (!extension) return; if (!image_loader_.get()) @@ -67,7 +67,7 @@ void LauncherAppIconLoader::OnImageLoaded(const gfx::Image& image, host_->SetAppImage(id, image.ToSkBitmap()); } -const Extension* LauncherAppIconLoader::GetExtensionForTab( +const extensions::Extension* LauncherAppIconLoader::GetExtensionForTab( TabContentsWrapper* tab) { ExtensionService* extension_service = profile_->GetExtensionService(); if (!extension_service) @@ -75,7 +75,7 @@ const Extension* LauncherAppIconLoader::GetExtensionForTab( return extension_service->GetInstalledApp(tab->web_contents()->GetURL()); } -const Extension* LauncherAppIconLoader::GetExtensionByID( +const extensions::Extension* LauncherAppIconLoader::GetExtensionByID( const std::string& id) { ExtensionService* service = profile_->GetExtensionService(); if (!service) diff --git a/chrome/browser/ui/views/ash/launcher/launcher_app_icon_loader.h b/chrome/browser/ui/views/ash/launcher/launcher_app_icon_loader.h index 1740f5a..ff26b42 100644 --- a/chrome/browser/ui/views/ash/launcher/launcher_app_icon_loader.h +++ b/chrome/browser/ui/views/ash/launcher/launcher_app_icon_loader.h @@ -13,9 +13,13 @@ #include "chrome/browser/extensions/image_loading_tracker.h" #include "chrome/browser/ui/views/ash/launcher/chrome_launcher_controller.h" -class Extension; class Profile; +namespace extensions { +class Extension; +} + + // Default implementation of LauncherUpdater::AppIconLoader that interacts // with the ExtensionService and ImageLoadingTracker to load images. class LauncherAppIconLoader : public ChromeLauncherController::AppIconLoader, @@ -38,10 +42,10 @@ class LauncherAppIconLoader : public ChromeLauncherController::AppIconLoader, typedef std::map<int, std::string> ImageLoaderIDToExtensionIDMap; // Returns the extension for the specified tab. - const Extension* GetExtensionForTab(TabContentsWrapper* tab); + const extensions::Extension* GetExtensionForTab(TabContentsWrapper* tab); // Returns the extension by ID. - const Extension* GetExtensionByID(const std::string& id); + const extensions::Extension* GetExtensionByID(const std::string& id); Profile* profile_; diff --git a/chrome/browser/ui/views/browser_actions_container.cc b/chrome/browser/ui/views/browser_actions_container.cc index 5fb9050..04fb9e8 100644 --- a/chrome/browser/ui/views/browser_actions_container.cc +++ b/chrome/browser/ui/views/browser_actions_container.cc @@ -55,6 +55,8 @@ #include "ui/views/controls/resize_area.h" #include "ui/views/metrics.h" +using extensions::Extension; + namespace { // Horizontal spacing between most items in the container, as well as after the @@ -483,8 +485,8 @@ void BrowserActionsContainer::CreateBrowserActionViews() { if (!model_) return; - for (ExtensionList::iterator iter = model_->begin(); iter != model_->end(); - ++iter) { + for (extensions::ExtensionList::iterator iter = model_->begin(); + iter != model_->end(); ++iter) { if (!ShouldDisplayBrowserAction(*iter)) continue; diff --git a/chrome/browser/ui/views/browser_actions_container.h b/chrome/browser/ui/views/browser_actions_container.h index d1677f7..b88c6a9 100644 --- a/chrome/browser/ui/views/browser_actions_container.h +++ b/chrome/browser/ui/views/browser_actions_container.h @@ -33,12 +33,15 @@ class Browser; class BrowserActionsContainer; -class Extension; class ExtensionAction; class ExtensionPopup; class PrefService; class Profile; +namespace extensions { +class Extension; +} + namespace ui { class SlideAnimation; } @@ -59,14 +62,14 @@ class BrowserActionButton : public views::MenuButton, public ImageLoadingTracker::Observer, public content::NotificationObserver { public: - BrowserActionButton(const Extension* extension, + BrowserActionButton(const extensions::Extension* extension, BrowserActionsContainer* panel); // Call this instead of delete. void Destroy(); ExtensionAction* browser_action() const { return browser_action_; } - const Extension* extension() { return extension_; } + const extensions::Extension* extension() { return extension_; } // Called to update the display to match the browser action's state. void UpdateState(); @@ -127,7 +130,7 @@ class BrowserActionButton : public views::MenuButton, ExtensionAction* browser_action_; // The extension associated with the browser action we're displaying. - const Extension* extension_; + const extensions::Extension* extension_; // The object that is waiting for the image loading to complete // asynchronously. @@ -162,7 +165,8 @@ class BrowserActionButton : public views::MenuButton, class BrowserActionView : public views::View { public: - BrowserActionView(const Extension* extension, BrowserActionsContainer* panel); + BrowserActionView(const extensions::Extension* extension, + BrowserActionsContainer* panel); virtual ~BrowserActionView(); BrowserActionButton* button() { return button_; } @@ -406,10 +410,11 @@ class BrowserActionsContainer static int IconHeight(); // ExtensionToolbarModel::Observer implementation. - virtual void BrowserActionAdded(const Extension* extension, + virtual void BrowserActionAdded(const extensions::Extension* extension, int index) OVERRIDE; - virtual void BrowserActionRemoved(const Extension* extension) OVERRIDE; - virtual void BrowserActionMoved(const Extension* extension, + virtual void BrowserActionRemoved( + const extensions::Extension* extension) OVERRIDE; + virtual void BrowserActionMoved(const extensions::Extension* extension, int index) OVERRIDE; virtual void ModelLoaded() OVERRIDE; @@ -459,7 +464,7 @@ class BrowserActionsContainer // Returns true if this extension should be shown in this toolbar. This can // return false if we are in an incognito window and the extension is disabled // for incognito. - bool ShouldDisplayBrowserAction(const Extension* extension); + bool ShouldDisplayBrowserAction(const extensions::Extension* extension); // The vector of browser actions (icons/image buttons for each action). Note // that not every BrowserAction in the ToolbarModel will necessarily be in diff --git a/chrome/browser/ui/views/browser_actions_container_browsertest.cc b/chrome/browser/ui/views/browser_actions_container_browsertest.cc index a9e1e9a..3294ad4 100644 --- a/chrome/browser/ui/views/browser_actions_container_browsertest.cc +++ b/chrome/browser/ui/views/browser_actions_container_browsertest.cc @@ -11,6 +11,8 @@ #include "chrome/common/extensions/extension_action.h" #include "chrome/common/extensions/extension_resource.h" +using extensions::Extension; + class BrowserActionsContainerTest : public ExtensionBrowserTest { public: BrowserActionsContainerTest() { diff --git a/chrome/browser/ui/views/browser_dialogs.h b/chrome/browser/ui/views/browser_dialogs.h index 16f8d1b..3a0a464 100644 --- a/chrome/browser/ui/views/browser_dialogs.h +++ b/chrome/browser/ui/views/browser_dialogs.h @@ -19,7 +19,6 @@ class BrowserView; class EditSearchEngineControllerDelegate; -class Extension; class FindBar; class GURL; class Profile; @@ -30,6 +29,10 @@ namespace content { struct SSLStatus; } +namespace extensions { +class Extension; +} + namespace gfx { class Size; } @@ -91,7 +94,7 @@ void ShowCreateWebAppShortcutsDialog(gfx::NativeWindow parent_window, // Shows the create chrome app shortcut dialog box. void ShowCreateChromeAppShortcutsDialog(gfx::NativeWindow parent_window, Profile* profile, - const Extension* app); + const extensions::Extension* app); } // namespace browser diff --git a/chrome/browser/ui/views/create_application_shortcut_view.cc b/chrome/browser/ui/views/create_application_shortcut_view.cc index a627bc2..0e94c05 100644 --- a/chrome/browser/ui/views/create_application_shortcut_view.cc +++ b/chrome/browser/ui/views/create_application_shortcut_view.cc @@ -208,7 +208,7 @@ void ShowCreateWebAppShortcutsDialog(gfx::NativeWindow parent_window, void ShowCreateChromeAppShortcutsDialog(gfx::NativeWindow parent_window, Profile* profile, - const Extension* app) { + const extensions::Extension* app) { views::Widget::CreateWindowWithParent( new CreateChromeApplicationShortcutView(profile, app), parent_window)->Show(); @@ -482,7 +482,7 @@ void CreateUrlApplicationShortcutView::OnIconDownloaded(bool errored, CreateChromeApplicationShortcutView::CreateChromeApplicationShortcutView( Profile* profile, - const Extension* app) : + const extensions::Extension* app) : CreateApplicationShortcutView(profile), app_(app), ALLOW_THIS_IN_INITIALIZER_LIST(tracker_(this)) { diff --git a/chrome/browser/ui/views/create_application_shortcut_view.h b/chrome/browser/ui/views/create_application_shortcut_view.h index 8a49f9b..f7d5738 100644 --- a/chrome/browser/ui/views/create_application_shortcut_view.h +++ b/chrome/browser/ui/views/create_application_shortcut_view.h @@ -15,11 +15,14 @@ #include "ui/views/controls/button/button.h" #include "ui/views/window/dialog_delegate.h" -class Extension; class Profile; class TabContentsWrapper; class SkBitmap; +namespace extensions { +class Extension; +} + namespace views { class Checkbox; class Label; @@ -110,7 +113,8 @@ class CreateChromeApplicationShortcutView : public CreateApplicationShortcutView, public ImageLoadingTracker::Observer { public: - CreateChromeApplicationShortcutView(Profile* profile, const Extension* app); + CreateChromeApplicationShortcutView(Profile* profile, + const extensions::Extension* app); virtual ~CreateChromeApplicationShortcutView(); // Implement ImageLoadingTracker::Observer. |tracker_| is used to @@ -121,7 +125,7 @@ class CreateChromeApplicationShortcutView int index) OVERRIDE; private: - const Extension* app_; + const extensions::Extension* app_; ImageLoadingTracker tracker_; DISALLOW_COPY_AND_ASSIGN(CreateChromeApplicationShortcutView); diff --git a/chrome/browser/ui/views/extensions/browser_action_overflow_menu_controller.cc b/chrome/browser/ui/views/extensions/browser_action_overflow_menu_controller.cc index e9fad5c..0f6b748 100644 --- a/chrome/browser/ui/views/extensions/browser_action_overflow_menu_controller.cc +++ b/chrome/browser/ui/views/extensions/browser_action_overflow_menu_controller.cc @@ -96,7 +96,7 @@ bool BrowserActionOverflowMenuController::ShowContextMenu( int id, const gfx::Point& p, bool is_mouse_gesture) { - const Extension* extension = + const extensions::Extension* extension = (*views_)[start_index_ + id - 1]->button()->extension(); if (!extension->ShowConfigureContextMenus()) return false; diff --git a/chrome/browser/ui/views/extensions/extension_installed_bubble.cc b/chrome/browser/ui/views/extensions/extension_installed_bubble.cc index acd3792..b36e673 100644 --- a/chrome/browser/ui/views/extensions/extension_installed_bubble.cc +++ b/chrome/browser/ui/views/extensions/extension_installed_bubble.cc @@ -41,6 +41,8 @@ #include "ui/views/layout/fill_layout.h" #include "ui/views/layout/layout_constants.h" +using extensions::Extension; + namespace { const int kIconSize = 43; @@ -387,7 +389,7 @@ void ExtensionInstalledBubble::Observe( } } else if (type == chrome::NOTIFICATION_EXTENSION_UNLOADED) { const Extension* extension = - content::Details<UnloadedExtensionInfo>(details)->extension; + content::Details<extensions::UnloadedExtensionInfo>(details)->extension; if (extension == extension_) extension_ = NULL; } else { diff --git a/chrome/browser/ui/views/extensions/extension_installed_bubble.h b/chrome/browser/ui/views/extensions/extension_installed_bubble.h index 4da3d0e..5cc828d 100644 --- a/chrome/browser/ui/views/extensions/extension_installed_bubble.h +++ b/chrome/browser/ui/views/extensions/extension_installed_bubble.h @@ -12,7 +12,10 @@ #include "ui/views/bubble/bubble_delegate.h" class Browser; + +namespace extensions { class Extension; +} // Provides feedback to the user upon successful installation of an // extension. Depending on the type of extension, the Bubble will @@ -41,12 +44,13 @@ class ExtensionInstalledBubble // the extension has loaded. |extension| is the installed extension. |browser| // is the browser window which will host the bubble. |icon| is the install // icon of the extension. - static void Show( - const Extension* extension, Browser *browser, const SkBitmap& icon); + static void Show(const extensions::Extension* extension, + Browser *browser, + const SkBitmap& icon); private: // Private ctor. Registers a listener for EXTENSION_LOADED. - ExtensionInstalledBubble(const Extension* extension, + ExtensionInstalledBubble(const extensions::Extension* extension, Browser *browser, const SkBitmap& icon); @@ -66,7 +70,7 @@ class ExtensionInstalledBubble // views::BubbleDelegate virtual gfx::Rect GetAnchorRect() OVERRIDE; - const Extension* extension_; + const extensions::Extension* extension_; Browser* browser_; SkBitmap icon_; content::NotificationRegistrar registrar_; diff --git a/chrome/browser/ui/views/extensions/extension_keybinding_registry_views.cc b/chrome/browser/ui/views/extensions/extension_keybinding_registry_views.cc index d0a4a48..5a95612 100644 --- a/chrome/browser/ui/views/extensions/extension_keybinding_registry_views.cc +++ b/chrome/browser/ui/views/extensions/extension_keybinding_registry_views.cc @@ -27,7 +27,7 @@ ExtensionKeybindingRegistryViews::~ExtensionKeybindingRegistryViews() { } void ExtensionKeybindingRegistryViews::AddExtensionKeybinding( - const Extension* extension) { + const extensions::Extension* extension) { ExtensionCommandService* command_service = ExtensionCommandServiceFactory::GetForProfile(profile_); // Add all the active keybindings (except page actions and browser actions, @@ -45,7 +45,7 @@ void ExtensionKeybindingRegistryViews::AddExtensionKeybinding( } void ExtensionKeybindingRegistryViews::RemoveExtensionKeybinding( - const Extension* extension) { + const extensions::Extension* extension) { EventTargets::iterator iter = event_targets_.begin(); while (iter != event_targets_.end()) { if (iter->second.first != extension->id()) { diff --git a/chrome/browser/ui/views/extensions/extension_keybinding_registry_views.h b/chrome/browser/ui/views/extensions/extension_keybinding_registry_views.h index f675808..2e83519 100644 --- a/chrome/browser/ui/views/extensions/extension_keybinding_registry_views.h +++ b/chrome/browser/ui/views/extensions/extension_keybinding_registry_views.h @@ -13,9 +13,12 @@ #include "chrome/browser/extensions/extension_keybinding_registry.h" #include "ui/base/accelerators/accelerator.h" -class Extension; class Profile; +namespace extensions { +class Extension; +} + namespace views { class FocusManager; } @@ -40,8 +43,10 @@ class ExtensionKeybindingRegistryViews private: // Overridden from ExtensionKeybindingRegistry: - virtual void AddExtensionKeybinding(const Extension* extension) OVERRIDE; - virtual void RemoveExtensionKeybinding(const Extension* extension) OVERRIDE; + virtual void AddExtensionKeybinding( + const extensions::Extension* extension) OVERRIDE; + virtual void RemoveExtensionKeybinding( + const extensions::Extension* extension) OVERRIDE; // Weak pointer to the our profile. Not owned by us. Profile* profile_; diff --git a/chrome/browser/ui/views/extensions/extension_uninstall_dialog_view.cc b/chrome/browser/ui/views/extensions/extension_uninstall_dialog_view.cc index bfebd0e..75d0fed 100644 --- a/chrome/browser/ui/views/extensions/extension_uninstall_dialog_view.cc +++ b/chrome/browser/ui/views/extensions/extension_uninstall_dialog_view.cc @@ -80,7 +80,7 @@ class ExtensionUninstallDialogDelegateView : public views::DialogDelegateView { public: ExtensionUninstallDialogDelegateView( ExtensionUninstallDialogViews* dialog_view, - const Extension* extension, + const extensions::Extension* extension, SkBitmap* icon); virtual ~ExtensionUninstallDialogDelegateView(); @@ -156,7 +156,7 @@ void ExtensionUninstallDialogViews::ExtensionUninstallCanceled() { ExtensionUninstallDialogDelegateView::ExtensionUninstallDialogDelegateView( ExtensionUninstallDialogViews* dialog_view, - const Extension* extension, + const extensions::Extension* extension, SkBitmap* icon) : dialog_(dialog_view) { // Scale down to icon size, but allow smaller icons (don't scale up). diff --git a/chrome/browser/ui/views/extensions/extension_view.cc b/chrome/browser/ui/views/extensions/extension_view.cc index a6cdcc7..98592cc 100644 --- a/chrome/browser/ui/views/extensions/extension_view.cc +++ b/chrome/browser/ui/views/extensions/extension_view.cc @@ -34,7 +34,7 @@ ExtensionView::~ExtensionView() { CleanUp(); } -const Extension* ExtensionView::extension() const { +const extensions::Extension* ExtensionView::extension() const { return host_->extension(); } diff --git a/chrome/browser/ui/views/extensions/extension_view.h b/chrome/browser/ui/views/extensions/extension_view.h index 5254075..37562f7 100644 --- a/chrome/browser/ui/views/extensions/extension_view.h +++ b/chrome/browser/ui/views/extensions/extension_view.h @@ -12,10 +12,13 @@ #include "ui/views/controls/native/native_view_host.h" class Browser; -class Extension; class ExtensionHost; class ExtensionView; +namespace extensions { +class Extension; +} + namespace content { class RenderViewHost; } @@ -37,7 +40,7 @@ class ExtensionView : public views::NativeViewHost { ExtensionHost* host() const { return host_; } Browser* browser() const { return browser_; } - const Extension* extension() const; + const extensions::Extension* extension() const; content::RenderViewHost* render_view_host() const; void DidStopLoading(); void SetIsClipped(bool is_clipped); diff --git a/chrome/browser/ui/views/extensions/shell_window_views.cc b/chrome/browser/ui/views/extensions/shell_window_views.cc index 8ff024b..522c7c6 100644 --- a/chrome/browser/ui/views/extensions/shell_window_views.cc +++ b/chrome/browser/ui/views/extensions/shell_window_views.cc @@ -99,7 +99,7 @@ void ShellWindowFrameView::GetWindowMask(const gfx::Size& size, } ShellWindowViews::ShellWindowViews(Profile* profile, - const Extension* extension, + const extensions::Extension* extension, const GURL& url) : ShellWindow(profile, extension, url), initialized_(false), @@ -348,7 +348,7 @@ void ShellWindowViews::OnBoundsChanged(const gfx::Rect& previous_bounds) { // static ShellWindow* ShellWindow::CreateImpl(Profile* profile, - const Extension* extension, + const extensions::Extension* extension, const GURL& url) { return new ShellWindowViews(profile, extension, url); } diff --git a/chrome/browser/ui/views/extensions/shell_window_views.h b/chrome/browser/ui/views/extensions/shell_window_views.h index ef35d47..6102ef1 100644 --- a/chrome/browser/ui/views/extensions/shell_window_views.h +++ b/chrome/browser/ui/views/extensions/shell_window_views.h @@ -14,12 +14,16 @@ class Profile; +namespace extensions { +class Extension; +} + class ShellWindowViews : public ShellWindow, public views::NativeViewHost, public views::WidgetDelegate { public: ShellWindowViews(Profile* profile, - const Extension* extension, + const extensions::Extension* extension, const GURL& url); // BaseWindow implementation. diff --git a/chrome/browser/ui/views/frame/browser_view.cc b/chrome/browser/ui/views/frame/browser_view.cc index cafd5fb..79846e2 100644 --- a/chrome/browser/ui/views/frame/browser_view.cc +++ b/chrome/browser/ui/views/frame/browser_view.cc @@ -1108,8 +1108,9 @@ void BrowserView::ShowCreateWebAppShortcutsDialog( browser::ShowCreateWebAppShortcutsDialog(GetNativeHandle(), tab_contents); } -void BrowserView::ShowCreateChromeAppShortcutsDialog(Profile* profile, - const Extension* app) { +void BrowserView::ShowCreateChromeAppShortcutsDialog( + Profile* profile, + const extensions::Extension* app) { browser::ShowCreateChromeAppShortcutsDialog(GetNativeHandle(), profile, app); } diff --git a/chrome/browser/ui/views/frame/browser_view.h b/chrome/browser/ui/views/frame/browser_view.h index 8be8d25..27c974a 100644 --- a/chrome/browser/ui/views/frame/browser_view.h +++ b/chrome/browser/ui/views/frame/browser_view.h @@ -42,7 +42,6 @@ class Browser; class BrowserViewLayout; class ContentsContainer; class DownloadShelfView; -class Extension; class FullscreenExitBubbleViews; class InfoBarContainerView; class LocationBarView; @@ -59,6 +58,10 @@ class JumpList; class BrowserLauncherItemController; #endif +namespace extensions { +class Extension; +} + namespace views { class AccessiblePaneView; class ExternalFocusTracker; @@ -302,7 +305,7 @@ class BrowserView : public BrowserWindow, virtual void ShowCreateWebAppShortcutsDialog( TabContentsWrapper* tab_contents) OVERRIDE; virtual void ShowCreateChromeAppShortcutsDialog( - Profile*, const Extension* app) OVERRIDE; + Profile*, const extensions::Extension* app) OVERRIDE; virtual void Cut() OVERRIDE; virtual void Copy() OVERRIDE; virtual void Paste() OVERRIDE; diff --git a/chrome/browser/ui/views/infobars/extension_infobar.cc b/chrome/browser/ui/views/infobars/extension_infobar.cc index 43cb151..646ec46 100644 --- a/chrome/browser/ui/views/infobars/extension_infobar.cc +++ b/chrome/browser/ui/views/infobars/extension_infobar.cc @@ -90,7 +90,7 @@ void ExtensionInfoBar::ViewHierarchyChanged(bool is_add, // This must happen after adding all children because it can trigger layout, // which assumes that particular children (e.g. the close button) have already // been added. - const Extension* extension = extension_host->extension(); + const extensions::Extension* extension = extension_host->extension(); ExtensionIconSet::Icons image_size = ExtensionIconSet::EXTENSION_ICON_BITTY; ExtensionResource icon_resource = extension->GetIconResource( image_size, ExtensionIconSet::MATCH_EXACTLY); @@ -142,7 +142,8 @@ void ExtensionInfoBar::OnMenuButtonClicked(views::View* source, const gfx::Point& point) { if (!owned()) return; // We're closing; don't call anything, it might access the owner. - const Extension* extension = GetDelegate()->extension_host()->extension(); + const extensions::Extension* extension = GetDelegate()->extension_host()-> + extension(); if (!extension->ShowConfigureContextMenus()) return; diff --git a/chrome/browser/ui/views/location_bar/page_action_image_view.cc b/chrome/browser/ui/views/location_bar/page_action_image_view.cc index a7bcf21a..43a1db9 100644 --- a/chrome/browser/ui/views/location_bar/page_action_image_view.cc +++ b/chrome/browser/ui/views/location_bar/page_action_image_view.cc @@ -29,6 +29,7 @@ #include "ui/views/controls/menu/menu_runner.h" using content::WebContents; +using extensions::Extension; PageActionImageView::PageActionImageView(LocationBarView* owner, ExtensionAction* page_action, @@ -272,7 +273,7 @@ void PageActionImageView::Observe(int type, const content::NotificationDetails& details) { DCHECK_EQ(chrome::NOTIFICATION_EXTENSION_UNLOADED, type); const Extension* unloaded_extension = - content::Details<UnloadedExtensionInfo>(details)->extension; + content::Details<extensions::UnloadedExtensionInfo>(details)->extension; if (page_action_ == unloaded_extension ->page_action()) owner_->UpdatePageActions(); } diff --git a/chrome/browser/ui/views/location_bar/page_action_with_badge_view.cc b/chrome/browser/ui/views/location_bar/page_action_with_badge_view.cc index 569ea44..821119a 100644 --- a/chrome/browser/ui/views/location_bar/page_action_with_badge_view.cc +++ b/chrome/browser/ui/views/location_bar/page_action_with_badge_view.cc @@ -22,8 +22,8 @@ void PageActionWithBadgeView::GetAccessibleState( } gfx::Size PageActionWithBadgeView::GetPreferredSize() { - return gfx::Size(Extension::kPageActionIconMaxSize, - Extension::kPageActionIconMaxSize); + return gfx::Size(extensions::Extension::kPageActionIconMaxSize, + extensions::Extension::kPageActionIconMaxSize); } void PageActionWithBadgeView::Layout() { diff --git a/chrome/browser/ui/webui/extensions/extension_activity_ui.cc b/chrome/browser/ui/webui/extensions/extension_activity_ui.cc index 155cf4a..90996d9 100644 --- a/chrome/browser/ui/webui/extensions/extension_activity_ui.cc +++ b/chrome/browser/ui/webui/extensions/extension_activity_ui.cc @@ -90,7 +90,7 @@ void ExtensionActivityUI::HandleRequestExtensionData( } void ExtensionActivityUI::OnExtensionActivity( - const Extension* extension, + const extensions::Extension* extension, ExtensionActivityLog::Activity activity, const std::string& msg) { DictionaryValue result; diff --git a/chrome/browser/ui/webui/extensions/extension_activity_ui.h b/chrome/browser/ui/webui/extensions/extension_activity_ui.h index 54728ed..abcdcbc 100644 --- a/chrome/browser/ui/webui/extensions/extension_activity_ui.h +++ b/chrome/browser/ui/webui/extensions/extension_activity_ui.h @@ -9,6 +9,10 @@ #include "chrome/browser/extensions/extension_activity_log.h" #include "content/public/browser/web_ui_controller.h" +namespace extensions { +class Extension; +} + class ExtensionActivityUI : public content::WebUIController, public ExtensionActivityLog::Observer { public: @@ -19,12 +23,12 @@ class ExtensionActivityUI : public content::WebUIController, void HandleRequestExtensionData(const base::ListValue* args); // ExtensionActivityLog::Observer implementation. - virtual void OnExtensionActivity(const Extension* extension, + virtual void OnExtensionActivity(const extensions::Extension* extension, ExtensionActivityLog::Activity activity, const std::string& msg) OVERRIDE; private: - const Extension* extension_; + const extensions::Extension* extension_; DISALLOW_COPY_AND_ASSIGN(ExtensionActivityUI); }; diff --git a/chrome/browser/ui/webui/extensions/extension_icon_source.cc b/chrome/browser/ui/webui/extensions/extension_icon_source.cc index a8bbec6..850db95 100644 --- a/chrome/browser/ui/webui/extensions/extension_icon_source.cc +++ b/chrome/browser/ui/webui/extensions/extension_icon_source.cc @@ -60,14 +60,14 @@ ExtensionIconSource::ExtensionIconSource(Profile* profile) struct ExtensionIconSource::ExtensionIconRequest { int request_id; - const Extension* extension; + const extensions::Extension* extension; bool grayscale; int size; ExtensionIconSet::MatchType match; }; // static -GURL ExtensionIconSource::GetIconURL(const Extension* extension, +GURL ExtensionIconSource::GetIconURL(const extensions::Extension* extension, int icon_size, ExtensionIconSet::MatchType match, bool grayscale, @@ -296,7 +296,7 @@ bool ExtensionIconSource::ParseData(const std::string& path, match_type = ExtensionIconSet::MATCH_EXACTLY; std::string extension_id = path_parts.at(0); - const Extension* extension = + const extensions::Extension* extension = profile_->GetExtensionService()->GetInstalledExtension(extension_id); if (!extension) return false; @@ -316,7 +316,7 @@ void ExtensionIconSource::SendDefaultResponse(int request_id) { } void ExtensionIconSource::SetData(int request_id, - const Extension* extension, + const extensions::Extension* extension, bool grayscale, int size, ExtensionIconSet::MatchType match) { diff --git a/chrome/browser/ui/webui/extensions/extension_icon_source.h b/chrome/browser/ui/webui/extensions/extension_icon_source.h index 8cf5827..4195137 100644 --- a/chrome/browser/ui/webui/extensions/extension_icon_source.h +++ b/chrome/browser/ui/webui/extensions/extension_icon_source.h @@ -19,6 +19,10 @@ class ExtensionIconSet; class Profile; +namespace extensions { +class Extension; +} + // ExtensionIconSource serves extension icons through network level chrome: // requests. Icons can be retrieved for any installed extension or app. // @@ -55,7 +59,7 @@ class ExtensionIconSource : public ChromeURLDataManager::DataSource, // desaturated version of the icon. |exists|, if non-NULL, will be set to true // if the icon exists; false if it will lead to a default or not-present // image. - static GURL GetIconURL(const Extension* extension, + static GURL GetIconURL(const extensions::Extension* extension, int icon_size, ExtensionIconSet::MatchType match, bool grayscale, @@ -131,7 +135,7 @@ class ExtensionIconSource : public ChromeURLDataManager::DataSource, // Stores the parameters associated with the |request_id|, making them // as an ExtensionIconRequest via GetData. void SetData(int request_id, - const Extension* extension, + const extensions::Extension* extension, bool grayscale, int size, ExtensionIconSet::MatchType match); diff --git a/chrome/browser/ui/webui/extensions/extension_settings_handler.cc b/chrome/browser/ui/webui/extensions/extension_settings_handler.cc index 3993240..6294f94 100644 --- a/chrome/browser/ui/webui/extensions/extension_settings_handler.cc +++ b/chrome/browser/ui/webui/extensions/extension_settings_handler.cc @@ -54,6 +54,7 @@ using content::RenderViewHost; using content::WebContents; +using extensions::Extension; using extensions::ExtensionUpdater; /////////////////////////////////////////////////////////////////////////////// diff --git a/chrome/browser/ui/webui/extensions/extension_settings_handler.h b/chrome/browser/ui/webui/extensions/extension_settings_handler.h index fb22192..ff6804c 100644 --- a/chrome/browser/ui/webui/extensions/extension_settings_handler.h +++ b/chrome/browser/ui/webui/extensions/extension_settings_handler.h @@ -25,7 +25,6 @@ #include "content/public/browser/web_ui_message_handler.h" #include "googleurl/src/gurl.h" -class Extension; class ExtensionHost; class ExtensionService; class FilePath; @@ -36,6 +35,10 @@ class DictionaryValue; class ListValue; } +namespace extensions { +class Extension; +} + // Information about a page running in an extension, for example a popup bubble, // a background page, or a tab contents. struct ExtensionPage { @@ -67,7 +70,7 @@ class ExtensionSettingsHandler : public content::WebUIMessageHandler, // testing. // Note: |warning_set| can be NULL in unit tests. base::DictionaryValue* CreateExtensionDetailValue( - const Extension* extension, + const extensions::Extension* extension, const std::vector<ExtensionPage>& pages, const ExtensionWarningSet* warning_set); @@ -144,7 +147,7 @@ class ExtensionSettingsHandler : public content::WebUIMessageHandler, // Utility for callbacks that get an extension ID as the sole argument. // Returns NULL if the extension isn't active. - const Extension* GetActiveExtension(const base::ListValue* args); + const extensions::Extension* GetActiveExtension(const base::ListValue* args); // Forces a UI update if appropriate after a notification is received. void MaybeUpdateAfterNotification(); @@ -154,7 +157,7 @@ class ExtensionSettingsHandler : public content::WebUIMessageHandler, // Helper that lists the current inspectable html pages for an extension. std::vector<ExtensionPage> GetInspectablePagesForExtension( - const Extension* extension, bool extension_is_enabled); + const extensions::Extension* extension, bool extension_is_enabled); void GetInspectablePagesForExtensionProcess( const std::set<content::RenderViewHost*>& views, std::vector<ExtensionPage> *result); diff --git a/chrome/browser/ui/webui/inspect_ui.cc b/chrome/browser/ui/webui/inspect_ui.cc index a5a0194..482aa86 100644 --- a/chrome/browser/ui/webui/inspect_ui.cc +++ b/chrome/browser/ui/webui/inspect_ui.cc @@ -132,8 +132,8 @@ DictionaryValue* BuildTargetDescriptor(RenderViewHost* rvh, bool is_tab) { web_contents->GetBrowserContext()); if (profile) { ExtensionService* extension_service = profile->GetExtensionService(); - const Extension* extension = extension_service->extensions()->GetByID( - web_contents->GetURL().host()); + const extensions::Extension* extension = extension_service-> + extensions()->GetByID(web_contents->GetURL().host()); if (extension) { target_type = kExtensionTargetType; title = extension->name(); diff --git a/chrome/browser/ui/webui/ntp/app_launcher_handler.cc b/chrome/browser/ui/webui/ntp/app_launcher_handler.cc index e56bcef..9963f23 100644 --- a/chrome/browser/ui/webui/ntp/app_launcher_handler.cc +++ b/chrome/browser/ui/webui/ntp/app_launcher_handler.cc @@ -52,6 +52,7 @@ #include "ui/gfx/codec/png_codec.h" using content::WebContents; +using extensions::Extension; namespace { @@ -273,15 +274,16 @@ void AppLauncherHandler::Observe(int type, } case chrome::NOTIFICATION_EXTENSION_UNLOADED: { const Extension* extension = - content::Details<UnloadedExtensionInfo>(details)->extension; + content::Details<extensions::UnloadedExtensionInfo>( + details)->extension; if (!extension->is_app()) return; scoped_ptr<DictionaryValue> app_info(GetAppInfo(extension)); scoped_ptr<base::FundamentalValue> uninstall_value( Value::CreateBooleanValue( - content::Details<UnloadedExtensionInfo>(details)->reason == - extension_misc::UNLOAD_REASON_UNINSTALL)); + content::Details<extensions::UnloadedExtensionInfo>( + details)->reason == extension_misc::UNLOAD_REASON_UNINSTALL)); if (app_info.get()) { scoped_ptr<base::FundamentalValue> from_page( Value::CreateBooleanValue(!extension_id_prompting_.empty())); @@ -982,8 +984,8 @@ ExtensionInstallUI* AppLauncherHandler::GetExtensionInstallUI() { void AppLauncherHandler::UninstallDefaultApps() { AppsPromo* apps_promo = extension_service_->apps_promo(); - const ExtensionIdSet& app_ids = apps_promo->old_default_apps(); - for (ExtensionIdSet::const_iterator iter = app_ids.begin(); + const extensions::ExtensionIdSet& app_ids = apps_promo->old_default_apps(); + for (extensions::ExtensionIdSet::const_iterator iter = app_ids.begin(); iter != app_ids.end(); ++iter) { if (extension_service_->GetExtensionById(*iter, true)) extension_service_->UninstallExtension(*iter, false, NULL); diff --git a/chrome/browser/ui/webui/ntp/app_launcher_handler.h b/chrome/browser/ui/webui/ntp/app_launcher_handler.h index 66a731f..88494c5 100644 --- a/chrome/browser/ui/webui/ntp/app_launcher_handler.h +++ b/chrome/browser/ui/webui/ntp/app_launcher_handler.h @@ -37,7 +37,7 @@ class AppLauncherHandler : public content::WebUIMessageHandler, // Populate a dictionary with the information from an extension. static void CreateAppInfo( - const Extension* extension, + const extensions::Extension* extension, const AppNotification* notification, ExtensionService* service, base::DictionaryValue* value); @@ -56,7 +56,7 @@ class AppLauncherHandler : public content::WebUIMessageHandler, // Create a dictionary value for the given extension. May return NULL, e.g. if // the given extension is not an app. If non-NULL, the caller assumes // ownership of the pointer. - base::DictionaryValue* GetAppInfo(const Extension* extension); + base::DictionaryValue* GetAppInfo(const extensions::Extension* extension); // Populate the given dictionary with the web store promo content. void FillPromoDictionary(base::DictionaryValue* value); diff --git a/chrome/browser/ui/webui/ntp/favicon_webui_handler.cc b/chrome/browser/ui/webui/ntp/favicon_webui_handler.cc index 7286db9..1002ddd 100644 --- a/chrome/browser/ui/webui/ntp/favicon_webui_handler.cc +++ b/chrome/browser/ui/webui/ntp/favicon_webui_handler.cc @@ -142,7 +142,7 @@ void FaviconWebUIHandler::HandleGetAppIconDominantColor( ExtensionService* extension_service = Profile::FromWebUI(web_ui())->GetExtensionService(); - const Extension* extension = extension_service->GetExtensionById( + const extensions::Extension* extension = extension_service->GetExtensionById( extension_id, false); if (!extension) return; diff --git a/chrome/browser/ui/webui/options2/search_engine_manager_handler2.cc b/chrome/browser/ui/webui/options2/search_engine_manager_handler2.cc index 38f03a3..02fffb5 100644 --- a/chrome/browser/ui/webui/options2/search_engine_manager_handler2.cc +++ b/chrome/browser/ui/webui/options2/search_engine_manager_handler2.cc @@ -166,7 +166,7 @@ void SearchEngineManagerHandler::OnItemsRemoved(int start, int length) { } base::DictionaryValue* SearchEngineManagerHandler::CreateDictionaryForExtension( - const Extension& extension) { + const extensions::Extension& extension) { base::DictionaryValue* dict = new base::DictionaryValue(); dict->SetString("name", extension.name()); dict->SetString("displayName", extension.name()); diff --git a/chrome/browser/ui/webui/options2/search_engine_manager_handler2.h b/chrome/browser/ui/webui/options2/search_engine_manager_handler2.h index 95af05ed..e2bddaf 100644 --- a/chrome/browser/ui/webui/options2/search_engine_manager_handler2.h +++ b/chrome/browser/ui/webui/options2/search_engine_manager_handler2.h @@ -9,9 +9,12 @@ #include "chrome/browser/ui/webui/options2/options_ui2.h" #include "ui/base/models/table_model_observer.h" -class Extension; class KeywordEditorController; +namespace extensions { +class Extension; +} + namespace options2 { class SearchEngineManagerHandler : public OptionsPageUIHandler, @@ -73,7 +76,7 @@ class SearchEngineManagerHandler : public OptionsPageUIHandler, // Returns a dictionary to pass to WebUI representing the extension. base::DictionaryValue* CreateDictionaryForExtension( - const Extension& extension); + const extensions::Extension& extension); DISALLOW_COPY_AND_ASSIGN(SearchEngineManagerHandler); }; diff --git a/chrome/browser/ui/webui/uber/uber_ui.cc b/chrome/browser/ui/webui/uber/uber_ui.cc index ae431a9..c671115 100644 --- a/chrome/browser/ui/webui/uber/uber_ui.cc +++ b/chrome/browser/ui/webui/uber/uber_ui.cc @@ -72,8 +72,9 @@ bool HasExtensionType(Profile* profile, const char* extensionType) { for (ExtensionSet::const_iterator iter = extensionSet->begin(); iter != extensionSet->end(); ++iter) { - Extension::URLOverrideMap map = (*iter)->GetChromeURLOverrides(); - Extension::URLOverrideMap::const_iterator result = + extensions::Extension::URLOverrideMap map = + (*iter)->GetChromeURLOverrides(); + extensions::Extension::URLOverrideMap::const_iterator result = map.find(std::string(extensionType)); if (result != map.end()) diff --git a/chrome/browser/web_applications/web_app.cc b/chrome/browser/web_applications/web_app.cc index cc58900..a502b5a 100644 --- a/chrome/browser/web_applications/web_app.cc +++ b/chrome/browser/web_applications/web_app.cc @@ -81,7 +81,7 @@ FilePath GetWebAppDataDirectory(const FilePath& profile_path, } FilePath GetWebAppDataDirectory(const FilePath& profile_path, - const Extension& extension) { + const extensions::Extension& extension) { return GetWebAppDataDirectory( profile_path, extension.id(), GURL(extension.launch_web_url())); } diff --git a/chrome/browser/web_applications/web_app.h b/chrome/browser/web_applications/web_app.h index a9e55a6..253c88f 100644 --- a/chrome/browser/web_applications/web_app.h +++ b/chrome/browser/web_applications/web_app.h @@ -14,7 +14,9 @@ #include "chrome/browser/shell_integration.h" #include "chrome/common/web_apps.h" +namespace extensions { class Extension; +} namespace web_app { @@ -28,7 +30,7 @@ FilePath GetWebAppDataDirectory(const FilePath& profile_path, // Gets the user data directory to use for |extension| located inside // |profile_path|. FilePath GetWebAppDataDirectory(const FilePath& profile_path, - const Extension& extension); + const extensions::Extension& extension); // Compute a deterministic name based on data in the shortcut_info. std::string GenerateApplicationNameFromInfo( diff --git a/chrome/common/extensions/api/extension_api.h b/chrome/common/extensions/api/extension_api.h index cbbdaad..9cfba19 100644 --- a/chrome/common/extensions/api/extension_api.h +++ b/chrome/common/extensions/api/extension_api.h @@ -27,11 +27,11 @@ class Value; } class GURL; -class Extension; class ExtensionPermissionSet; namespace extensions { +class Extension; class Feature; // C++ Wrapper for the JSON API definitions in chrome/common/extensions/api/. diff --git a/chrome/common/extensions/extension.cc b/chrome/common/extensions/extension.cc index 0c88438..539e238 100644 --- a/chrome/common/extensions/extension.cc +++ b/chrome/common/extensions/extension.cc @@ -59,6 +59,8 @@ namespace switch_utils = extensions::switch_utils; using extensions::csp_validator::ContentSecurityPolicyIsLegal; using extensions::csp_validator::ContentSecurityPolicyIsSecure; +namespace extensions { + namespace { const int kModernManifestVersion = 1; @@ -3560,3 +3562,5 @@ UpdatedExtensionPermissionsInfo::UpdatedExtensionPermissionsInfo( : reason(reason), extension(extension), permissions(permissions) {} + +} // namespace extensions diff --git a/chrome/common/extensions/extension.h b/chrome/common/extensions/extension.h index 5e7df6f..2e68ab1 100644 --- a/chrome/common/extensions/extension.h +++ b/chrome/common/extensions/extension.h @@ -42,14 +42,16 @@ class DictionaryValue; class ListValue; } -namespace extensions { -class Manifest; -} - namespace webkit_glue { struct WebIntentServiceData; } +FORWARD_DECLARE_TEST(TabStripModelTest, Apps); + +namespace extensions { + +class Manifest; + // Represents a Chrome extension. class Extension : public base::RefCountedThreadSafe<Extension> { public: @@ -1062,7 +1064,7 @@ class Extension : public base::RefCountedThreadSafe<Extension> { std::string content_security_policy_; FRIEND_TEST_ALL_PREFIXES(ExtensionTest, LoadPageActionHelper); - FRIEND_TEST_ALL_PREFIXES(TabStripModelTest, Apps); + FRIEND_TEST_ALL_PREFIXES(::TabStripModelTest, Apps); DISALLOW_COPY_AND_ASSIGN(Extension); }; @@ -1124,4 +1126,6 @@ struct UpdatedExtensionPermissionsInfo { Reason reason); }; +} // namespace extensions + #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_H_ diff --git a/chrome/common/extensions/extension_file_util.cc b/chrome/common/extensions/extension_file_util.cc index 848625e..ec72db7 100644 --- a/chrome/common/extensions/extension_file_util.cc +++ b/chrome/common/extensions/extension_file_util.cc @@ -29,12 +29,15 @@ #include "net/base/file_stream.h" #include "ui/base/l10n/l10n_util.h" +using extensions::Extension; + namespace errors = extension_manifest_errors; namespace extension_file_util { // Validates locale info. Doesn't check if messages.json files are valid. -static bool ValidateLocaleInfo(const Extension& extension, std::string* error); +static bool ValidateLocaleInfo(const Extension& extension, + std::string* error); // Returns false and sets the error if script file can't be loaded, // or if it's not UTF-8 encoded. @@ -124,8 +127,7 @@ scoped_refptr<Extension> LoadExtension(const FilePath& extension_path, Extension::Location location, int flags, std::string* error) { - return LoadExtension( - extension_path, std::string(), location, flags, error); + return LoadExtension(extension_path, std::string(), location, flags, error); } scoped_refptr<Extension> LoadExtension(const FilePath& extension_path, @@ -140,13 +142,12 @@ scoped_refptr<Extension> LoadExtension(const FilePath& extension_path, error)) return NULL; - scoped_refptr<Extension> extension(Extension::Create( - extension_path, - location, - *manifest, - flags, - extension_id, - error)); + scoped_refptr<Extension> extension(Extension::Create(extension_path, + location, + *manifest, + flags, + extension_id, + error)); if (!extension.get()) return NULL; @@ -190,7 +191,8 @@ DictionaryValue* LoadManifest(const FilePath& extension_path, return static_cast<DictionaryValue*>(root.release()); } -bool ValidateExtension(const Extension* extension, std::string* error) { +bool ValidateExtension(const Extension* extension, + std::string* error) { // Validate icons exist. for (ExtensionIconSet::IconMap::const_iterator iter = extension->icons().map().begin(); @@ -435,7 +437,8 @@ ExtensionMessageBundle* LoadExtensionMessageBundle( std::string* error) { error->clear(); // Load locale information if available. - FilePath locale_path = extension_path.Append(Extension::kLocaleFolder); + FilePath locale_path = extension_path.Append( + Extension::kLocaleFolder); if (!file_util::PathExists(locale_path)) return NULL; @@ -484,9 +487,11 @@ SubstitutionMap* LoadExtensionMessageBundleSubstitutionMap( return returnValue; } -static bool ValidateLocaleInfo(const Extension& extension, std::string* error) { +static bool ValidateLocaleInfo(const Extension& extension, + std::string* error) { // default_locale and _locales have to be both present or both missing. - const FilePath path = extension.path().Append(Extension::kLocaleFolder); + const FilePath path = extension.path().Append( + Extension::kLocaleFolder); bool path_exists = file_util::PathExists(path); std::string default_locale = extension.default_locale(); diff --git a/chrome/common/extensions/extension_file_util.h b/chrome/common/extensions/extension_file_util.h index 1ad1120..96f38fb 100644 --- a/chrome/common/extensions/extension_file_util.h +++ b/chrome/common/extensions/extension_file_util.h @@ -12,7 +12,6 @@ #include "chrome/common/extensions/extension.h" #include "chrome/common/extensions/extension_message_bundle.h" -class Extension; class ExtensionMessageBundle; class FilePath; class GURL; @@ -41,17 +40,19 @@ void UninstallExtension(const FilePath& extensions_dir, // Loads and validates an extension from the specified directory. Returns NULL // on failure, with a description of the error in |error|. -scoped_refptr<Extension> LoadExtension(const FilePath& extension_root, - Extension::Location location, - int flags, - std::string* error); +scoped_refptr<extensions::Extension> LoadExtension( + const FilePath& extension_root, + extensions::Extension::Location location, + int flags, + std::string* error); // The same as LoadExtension except use the provided |extension_id|. -scoped_refptr<Extension> LoadExtension(const FilePath& extension_root, - const std::string& extension_id, - Extension::Location location, - int flags, - std::string* error); +scoped_refptr<extensions::Extension> LoadExtension( + const FilePath& extension_root, + const std::string& extension_id, + extensions::Extension::Location location, + int flags, + std::string* error); // Loads an extension manifest from the specified directory. Returns NULL // on failure, with a description of the error in |error|. @@ -60,7 +61,8 @@ base::DictionaryValue* LoadManifest(const FilePath& extension_root, // Returns true if the given extension object is valid and consistent. // Otherwise, a description of the error is returned in |error|. -bool ValidateExtension(const Extension* extension, std::string* error); +bool ValidateExtension(const extensions::Extension* extension, + std::string* error); // Cleans up the extension install directory. It can end up with garbage in it // if extensions can't initially be removed when they are uninstalled (eg if a diff --git a/chrome/common/extensions/extension_file_util_unittest.cc b/chrome/common/extensions/extension_file_util_unittest.cc index eef0a63..04d8b91 100644 --- a/chrome/common/extensions/extension_file_util_unittest.cc +++ b/chrome/common/extensions/extension_file_util_unittest.cc @@ -17,6 +17,8 @@ #include "testing/gtest/include/gtest/gtest.h" #include "ui/base/l10n/l10n_util.h" +using extensions::Extension; + namespace keys = extension_manifest_keys; #if defined(OS_WIN) diff --git a/chrome/common/extensions/extension_l10n_util.cc b/chrome/common/extensions/extension_l10n_util.cc index 117ac74..1fa88e7 100644 --- a/chrome/common/extensions/extension_l10n_util.cc +++ b/chrome/common/extensions/extension_l10n_util.cc @@ -48,7 +48,7 @@ std::string GetDefaultLocaleFromManifest(const DictionaryValue& manifest, } -bool ShouldRelocalizeManifest(const ExtensionInfo& info) { +bool ShouldRelocalizeManifest(const extensions::ExtensionInfo& info) { DictionaryValue* manifest = info.extension_manifest.get(); if (!manifest) return false; @@ -206,7 +206,7 @@ bool AddLocale(const std::set<std::string>& chrome_locales, } // Check if messages file is actually present (but don't check content). if (file_util::PathExists( - locale_folder.Append(Extension::kMessagesFilename))) { + locale_folder.Append(extensions::Extension::kMessagesFilename))) { valid_locales->insert(locale_name); } else { *error = base::StringPrintf("Catalog file is missing for locale %s.", @@ -279,7 +279,7 @@ static DictionaryValue* LoadMessageFile(const FilePath& locale_path, std::string* error) { std::string extension_locale = locale; FilePath file = locale_path.AppendASCII(extension_locale) - .Append(Extension::kMessagesFilename); + .Append(extensions::Extension::kMessagesFilename); JSONFileValueSerializer messages_serializer(file); Value *dictionary = messages_serializer.Deserialize(NULL, error); if (!dictionary && error->empty()) { diff --git a/chrome/common/extensions/extension_l10n_util.h b/chrome/common/extensions/extension_l10n_util.h index 8b08e4a..e96a858 100644 --- a/chrome/common/extensions/extension_l10n_util.h +++ b/chrome/common/extensions/extension_l10n_util.h @@ -12,15 +12,17 @@ #include <string> #include <vector> -class Extension; class ExtensionMessageBundle; class FilePath; -struct ExtensionInfo; namespace base { class DictionaryValue; } +namespace extensions { +struct ExtensionInfo; +} + namespace extension_l10n_util { // Set the locale for this process to a fixed value, rather than using the @@ -35,7 +37,7 @@ std::string GetDefaultLocaleFromManifest(const base::DictionaryValue& manifest, // Returns true iff the extension was localized, and the current locale // doesn't match the locale written into info.extension_manifest. -bool ShouldRelocalizeManifest(const ExtensionInfo& info); +bool ShouldRelocalizeManifest(const extensions::ExtensionInfo& info); // Localize extension name, description, browser_action and other fields // in the manifest. diff --git a/chrome/common/extensions/extension_l10n_util_unittest.cc b/chrome/common/extensions/extension_l10n_util_unittest.cc index 182875e..5e0b46a 100644 --- a/chrome/common/extensions/extension_l10n_util_unittest.cc +++ b/chrome/common/extensions/extension_l10n_util_unittest.cc @@ -17,6 +17,9 @@ #include "testing/gtest/include/gtest/gtest.h" #include "ui/base/l10n/l10n_util.h" +using extensions::Extension; +using extensions::ExtensionInfo; + namespace errors = extension_manifest_errors; namespace keys = extension_manifest_keys; diff --git a/chrome/common/extensions/extension_messages.cc b/chrome/common/extensions/extension_messages.cc index 838943d..db167d1 100644 --- a/chrome/common/extensions/extension_messages.cc +++ b/chrome/common/extensions/extension_messages.cc @@ -4,10 +4,13 @@ #include "chrome/common/extensions/extension_messages.h" +#include "chrome/common/extensions/extension.h" #include "chrome/common/extensions/extension_constants.h" #include "chrome/common/extensions/manifest.h" #include "content/public/common/common_param_traits.h" +using extensions::Extension; + ExtensionMsg_Loaded_Params::ExtensionMsg_Loaded_Params() : location(Extension::INVALID), creation_flags(Extension::NO_FLAGS){} diff --git a/chrome/common/extensions/extension_messages.h b/chrome/common/extensions/extension_messages.h index 4b634a6..0c40ec9 100644 --- a/chrome/common/extensions/extension_messages.h +++ b/chrome/common/extensions/extension_messages.h @@ -103,16 +103,16 @@ typedef std::map<std::string, std::string> SubstitutionMap; struct ExtensionMsg_Loaded_Params { ExtensionMsg_Loaded_Params(); ~ExtensionMsg_Loaded_Params(); - explicit ExtensionMsg_Loaded_Params(const Extension* extension); + explicit ExtensionMsg_Loaded_Params(const extensions::Extension* extension); // Creates a new extension from the data in this object. - scoped_refptr<Extension> ConvertToExtension() const; + scoped_refptr<extensions::Extension> ConvertToExtension() const; // The subset of the extension manifest data we send to renderers. linked_ptr<DictionaryValue> manifest; // The location the extension was installed from. - Extension::Location location; + extensions::Extension::Location location; // The path the extension was loaded from. This is used in the renderer only // to generate the extension ID for extensions that are loaded unpacked. @@ -214,7 +214,8 @@ IPC_MESSAGE_CONTROL1(ExtensionMsg_Unloaded, // Updates the scripting whitelist for extensions in the render process. This is // only used for testing. IPC_MESSAGE_CONTROL1(ExtensionMsg_SetScriptingWhitelist, - Extension::ScriptingWhitelist /* extenison ids */) + // extension ids + extensions::Extension::ScriptingWhitelist) // Notification that renderer should run some JavaScript code. IPC_MESSAGE_ROUTED1(ExtensionMsg_ExecuteCode, diff --git a/chrome/common/extensions/extension_permission_set.cc b/chrome/common/extensions/extension_permission_set.cc index d1d5b55..c456146 100644 --- a/chrome/common/extensions/extension_permission_set.cc +++ b/chrome/common/extensions/extension_permission_set.cc @@ -452,7 +452,7 @@ ExtensionAPIPermission* ExtensionPermissionsInfo::RegisterPermission( ExtensionPermissionSet::ExtensionPermissionSet() {} ExtensionPermissionSet::ExtensionPermissionSet( - const Extension* extension, + const extensions::Extension* extension, const ExtensionAPIPermissionSet& apis, const URLPatternSet& explicit_hosts, const ExtensionOAuth2Scopes& scopes) @@ -869,7 +869,7 @@ std::set<std::string> ExtensionPermissionSet::GetDistinctHosts( } void ExtensionPermissionSet::InitImplicitExtensionPermissions( - const Extension* extension) { + const extensions::Extension* extension) { // Add the implied permissions. if (!extension->plugins().empty()) apis_.insert(ExtensionAPIPermission::kPlugin); diff --git a/chrome/common/extensions/extension_permission_set.h b/chrome/common/extensions/extension_permission_set.h index a0165e4..02011a0 100644 --- a/chrome/common/extensions/extension_permission_set.h +++ b/chrome/common/extensions/extension_permission_set.h @@ -19,9 +19,12 @@ // TODO(jstritar): Move each class to its own file in extensions/permissions. -class Extension; class ExtensionPermissionsInfo; +namespace extensions { +class Extension; +} + // When prompting the user to install or approve permissions, we display // messages describing the effects of the permissions rather than listing the // permissions themselves. Each ExtensionPermissionMessage represents one of the @@ -290,7 +293,7 @@ class ExtensionPermissionSet // the api and host permissions (|apis| and |hosts|). The effective hosts // of the newly created permission set will be inferred from the |extension| // manifest, |apis| and |hosts|. - ExtensionPermissionSet(const Extension* extension, + ExtensionPermissionSet(const extensions::Extension* extension, const ExtensionAPIPermissionSet& apis, const URLPatternSet& explicit_hosts, const ExtensionOAuth2Scopes& scopes); @@ -411,7 +414,7 @@ class ExtensionPermissionSet bool exclude_file_scheme); // Initializes the set based on |extension|'s manifest data. - void InitImplicitExtensionPermissions(const Extension* extension); + void InitImplicitExtensionPermissions(const extensions::Extension* extension); // Initializes the effective host permission based on the data in this set. void InitEffectiveHosts(); diff --git a/chrome/common/extensions/extension_permission_set_unittest.cc b/chrome/common/extensions/extension_permission_set_unittest.cc index dfd8ca8..dd85c5c 100644 --- a/chrome/common/extensions/extension_permission_set_unittest.cc +++ b/chrome/common/extensions/extension_permission_set_unittest.cc @@ -17,6 +17,8 @@ #include "chrome/common/extensions/extension_permission_set.h" #include "testing/gtest/include/gtest/gtest.h" +using extensions::Extension; + namespace errors = extension_manifest_errors; namespace keys = extension_manifest_keys; namespace values = extension_manifest_values; diff --git a/chrome/common/extensions/extension_process_policy.cc b/chrome/common/extensions/extension_process_policy.cc index edadd0f..15a173a 100644 --- a/chrome/common/extensions/extension_process_policy.cc +++ b/chrome/common/extensions/extension_process_policy.cc @@ -8,10 +8,11 @@ namespace extensions { -const Extension* GetNonBookmarkAppExtension( +const extensions::Extension* GetNonBookmarkAppExtension( const ExtensionSet& extensions, const ExtensionURLInfo& url) { // Exclude bookmark apps, which do not use the app process model. - const Extension* extension = extensions.GetExtensionOrAppByURL(url); + const extensions::Extension* extension = + extensions.GetExtensionOrAppByURL(url); if (extension && extension->from_bookmark()) extension = NULL; return extension; @@ -21,10 +22,12 @@ bool CrossesExtensionProcessBoundary( const ExtensionSet& extensions, const ExtensionURLInfo& old_url, const ExtensionURLInfo& new_url) { - const Extension* old_url_extension = GetNonBookmarkAppExtension(extensions, - old_url); - const Extension* new_url_extension = GetNonBookmarkAppExtension(extensions, - new_url); + const extensions::Extension* old_url_extension = GetNonBookmarkAppExtension( + extensions, + old_url); + const extensions::Extension* new_url_extension = GetNonBookmarkAppExtension( + extensions, + new_url); // TODO(creis): Temporary workaround for crbug.com/59285: Do not swap process // to navigate from a hosted app to a normal page or another hosted app diff --git a/chrome/common/extensions/extension_process_policy.h b/chrome/common/extensions/extension_process_policy.h index a2fc6f2..85f9eef 100644 --- a/chrome/common/extensions/extension_process_policy.h +++ b/chrome/common/extensions/extension_process_policy.h @@ -6,12 +6,13 @@ #define CHROME_COMMON_EXTENSIONS_EXTENSION_PROCESS_POLICY_H_ #pragma once -class Extension; class ExtensionSet; class ExtensionURLInfo; namespace extensions { +class Extension; + // Returns the extension for the given URL. Excludes extension objects for // bookmark apps, which do not use the app process model. const Extension* GetNonBookmarkAppExtension(const ExtensionSet& extensions, diff --git a/chrome/common/extensions/extension_resource_unittest.cc b/chrome/common/extensions/extension_resource_unittest.cc index 9b3e2d0..67c9ebd 100644 --- a/chrome/common/extensions/extension_resource_unittest.cc +++ b/chrome/common/extensions/extension_resource_unittest.cc @@ -116,7 +116,7 @@ TEST(ExtensionResourceTest, CreateWithAllResourcesOnDisk) { ASSERT_TRUE(file_util::WriteFile(root_resource, data.c_str(), data.length())); // Create l10n resources (for current locale and its parents). - FilePath l10n_path = temp.path().Append(Extension::kLocaleFolder); + FilePath l10n_path = temp.path().Append(extensions::Extension::kLocaleFolder); ASSERT_TRUE(file_util::CreateDirectory(l10n_path)); std::vector<std::string> locales; diff --git a/chrome/common/extensions/extension_set.cc b/chrome/common/extensions/extension_set.cc index f5aee9f..1eb931c 100644 --- a/chrome/common/extensions/extension_set.cc +++ b/chrome/common/extensions/extension_set.cc @@ -5,9 +5,11 @@ #include "chrome/common/extensions/extension_set.h" #include "base/logging.h" +#include "chrome/common/extensions/extension.h" #include "chrome/common/url_constants.h" using WebKit::WebSecurityOrigin; +using extensions::Extension; ExtensionURLInfo::ExtensionURLInfo(WebSecurityOrigin origin, const GURL& url) : origin_(origin), diff --git a/chrome/common/extensions/extension_set.h b/chrome/common/extensions/extension_set.h index 9d46373..428df7f 100644 --- a/chrome/common/extensions/extension_set.h +++ b/chrome/common/extensions/extension_set.h @@ -41,15 +41,16 @@ class ExtensionURLInfo { // The one true extension container. Extensions are identified by their id. // Only one extension can be in the set with a given ID. class ExtensionSet { - public: +public: typedef std::pair<FilePath, std::string> ExtensionPathAndDefaultLocale; - typedef std::map<std::string, scoped_refptr<const Extension> > ExtensionMap; + typedef std::map<std::string, scoped_refptr<const extensions::Extension> > + ExtensionMap; // Iteration over the values of the map (given that it's an ExtensionSet, // it should iterate like a set iterator). class const_iterator : public std::iterator<std::input_iterator_tag, - scoped_refptr<const Extension> > { + scoped_refptr<const extensions::Extension> > { public: const_iterator() {} explicit const_iterator(ExtensionMap::const_iterator it) : @@ -58,7 +59,7 @@ class ExtensionSet { ++it_; return *this; } - const scoped_refptr<const Extension> operator*() { + const scoped_refptr<const extensions::Extension> operator*() { return it_->second; } bool operator!=(const const_iterator& other) { return it_ != other.it_; } @@ -83,7 +84,7 @@ class ExtensionSet { // Adds the specified extension to the set. The set becomes an owner. Any // previous extension with the same ID is removed. - void Insert(const scoped_refptr<const Extension>& extension); + void Insert(const scoped_refptr<const extensions::Extension>& extension); // Copies different items from |extensions| to the current set and returns // whether anything changed. @@ -104,14 +105,16 @@ class ExtensionSet { // NOTE: This can return NULL if called before UpdateExtensions receives // bulk extension data (e.g. if called from // EventBindings::HandleContextCreated) - const Extension* GetExtensionOrAppByURL(const ExtensionURLInfo& info) const; + const extensions::Extension* GetExtensionOrAppByURL( + const ExtensionURLInfo& info) const; // Returns the hosted app whose web extent contains the URL. - const Extension* GetHostedAppByURL(const ExtensionURLInfo& info) const; + const extensions::Extension* GetHostedAppByURL( + const ExtensionURLInfo& info) const; // Returns a hosted app that contains any URL that overlaps with the given // extent, if one exists. - const Extension* GetHostedAppByOverlappingWebExtent( + const extensions::Extension* GetHostedAppByOverlappingWebExtent( const URLPatternSet& extent) const; // Returns true if |new_url| is in the extent of the same extension as @@ -119,7 +122,7 @@ class ExtensionSet { bool InSameExtent(const GURL& old_url, const GURL& new_url) const; // Look up an Extension object by id. - const Extension* GetByID(const std::string& id) const; + const extensions::Extension* GetByID(const std::string& id) const; // Returns true if |info| should get extension api bindings and be permitted // to make api calls. Note that this is independent of what extension diff --git a/chrome/common/extensions/extension_set_unittest.cc b/chrome/common/extensions/extension_set_unittest.cc index 37e5559..5d73d305 100644 --- a/chrome/common/extensions/extension_set_unittest.cc +++ b/chrome/common/extensions/extension_set_unittest.cc @@ -11,6 +11,8 @@ #include "chrome/common/extensions/extension_set.h" #include "testing/gtest/include/gtest/gtest.h" +using extensions::Extension; + namespace { scoped_refptr<Extension> CreateTestExtension(const std::string& name, diff --git a/chrome/common/extensions/extension_test_util.cc b/chrome/common/extensions/extension_test_util.cc index 31f3af2..fc6562f 100644 --- a/chrome/common/extensions/extension_test_util.cc +++ b/chrome/common/extensions/extension_test_util.cc @@ -10,10 +10,10 @@ namespace extension_test_util { std::string MakeId(std::string seed) { std::string result; - bool success = Extension::GenerateId(seed, &result); + bool success = extensions::Extension::GenerateId(seed, &result); EXPECT_TRUE(success); EXPECT_FALSE(result.empty()); - EXPECT_TRUE(Extension::IdIsValid(result)); + EXPECT_TRUE(extensions::Extension::IdIsValid(result)); return result; } diff --git a/chrome/common/extensions/extension_unittest.cc b/chrome/common/extensions/extension_unittest.cc index b72176c..9094670 100644 --- a/chrome/common/extensions/extension_unittest.cc +++ b/chrome/common/extensions/extension_unittest.cc @@ -27,6 +27,8 @@ #include "third_party/skia/include/core/SkBitmap.h" #include "ui/gfx/codec/png_codec.h" +using extensions::Extension; + namespace keys = extension_manifest_keys; namespace values = extension_manifest_values; namespace errors = extension_manifest_errors; diff --git a/chrome/common/extensions/extension_unpacker.cc b/chrome/common/extensions/extension_unpacker.cc index 9e26808..5194b4b 100644 --- a/chrome/common/extensions/extension_unpacker.cc +++ b/chrome/common/extensions/extension_unpacker.cc @@ -86,7 +86,7 @@ bool PathContainsParentDirectory(const FilePath& path) { ExtensionUnpacker::ExtensionUnpacker(const FilePath& extension_path, const std::string& extension_id, - Extension::Location location, + extensions::Extension::Location location, int creation_flags) : extension_path_(extension_path), extension_id_(extension_id), @@ -99,7 +99,7 @@ ExtensionUnpacker::~ExtensionUnpacker() { DictionaryValue* ExtensionUnpacker::ReadManifest() { FilePath manifest_path = - temp_install_dir_.Append(Extension::kManifestFilename); + temp_install_dir_.Append(extensions::Extension::kManifestFilename); if (!file_util::PathExists(manifest_path)) { SetError(errors::kInvalidManifest); return NULL; @@ -124,7 +124,7 @@ DictionaryValue* ExtensionUnpacker::ReadManifest() { bool ExtensionUnpacker::ReadAllMessageCatalogs( const std::string& default_locale) { FilePath locales_path = - temp_install_dir_.Append(Extension::kLocaleFolder); + temp_install_dir_.Append(extensions::Extension::kLocaleFolder); // Not all folders under _locales have to be valid locales. file_util::FileEnumerator locales(locales_path, @@ -140,7 +140,7 @@ bool ExtensionUnpacker::ReadAllMessageCatalogs( continue; FilePath messages_path = - locale_path.Append(Extension::kMessagesFilename); + locale_path.Append(extensions::Extension::kMessagesFilename); if (!ReadMessageCatalog(messages_path)) return false; @@ -178,7 +178,7 @@ bool ExtensionUnpacker::Run() { return false; // Error was already reported. std::string error; - scoped_refptr<Extension> extension(Extension::Create( + scoped_refptr<extensions::Extension> extension(extensions::Extension::Create( temp_install_dir_, location_, *parsed_manifest_, diff --git a/chrome/common/extensions/extension_unpacker.h b/chrome/common/extensions/extension_unpacker.h index 5c6c14c..5fd7398 100644 --- a/chrome/common/extensions/extension_unpacker.h +++ b/chrome/common/extensions/extension_unpacker.h @@ -30,7 +30,7 @@ class ExtensionUnpacker { ExtensionUnpacker(const FilePath& extension_path, const std::string& extension_id, - Extension::Location location, + extensions::Extension::Location location, int creation_flags); ~ExtensionUnpacker(); @@ -93,7 +93,7 @@ class ExtensionUnpacker { std::string extension_id_; // The location to use for the created extension. - Extension::Location location_; + extensions::Extension::Location location_; // The creation flags to use with the created extension. int creation_flags_; diff --git a/chrome/common/extensions/extension_unpacker_unittest.cc b/chrome/common/extensions/extension_unpacker_unittest.cc index 4c43a7b..64d08f6 100644 --- a/chrome/common/extensions/extension_unpacker_unittest.cc +++ b/chrome/common/extensions/extension_unpacker_unittest.cc @@ -43,8 +43,10 @@ public: ", Crx path " << crx_path.value(); unpacker_.reset( - new ExtensionUnpacker( - crx_path, std::string(), Extension::INTERNAL, Extension::NO_FLAGS)); + new ExtensionUnpacker(crx_path, + std::string(), + extensions::Extension::INTERNAL, + extensions::Extension::NO_FLAGS)); } protected: diff --git a/chrome/common/extensions/feature.cc b/chrome/common/extensions/feature.cc index fabdc04..594a64e 100644 --- a/chrome/common/extensions/feature.cc +++ b/chrome/common/extensions/feature.cc @@ -12,6 +12,7 @@ #include "chrome/common/chrome_switches.h" using chrome::VersionInfo; +using extensions::Extension; namespace { diff --git a/chrome/common/extensions/feature_unittest.cc b/chrome/common/extensions/feature_unittest.cc index 1be05f3..a046124 100644 --- a/chrome/common/extensions/feature_unittest.cc +++ b/chrome/common/extensions/feature_unittest.cc @@ -7,6 +7,7 @@ #include "testing/gtest/include/gtest/gtest.h" using chrome::VersionInfo; +using extensions::Extension; using extensions::Feature; namespace { diff --git a/chrome/common/extensions/manifest_tests/extension_manifest_test.cc b/chrome/common/extensions/manifest_tests/extension_manifest_test.cc index 3237e2b..caef6c3 100644 --- a/chrome/common/extensions/manifest_tests/extension_manifest_test.cc +++ b/chrome/common/extensions/manifest_tests/extension_manifest_test.cc @@ -14,6 +14,8 @@ #include "chrome/common/extensions/extension_l10n_util.h" #include "ui/base/l10n/l10n_util.h" +using extensions::Extension; + ExtensionManifestTest::ExtensionManifestTest() : enable_apps_(true) {} // static diff --git a/chrome/common/extensions/manifest_tests/extension_manifest_test.h b/chrome/common/extensions/manifest_tests/extension_manifest_test.h index f2222ad..b125dfa 100644 --- a/chrome/common/extensions/manifest_tests/extension_manifest_test.h +++ b/chrome/common/extensions/manifest_tests/extension_manifest_test.h @@ -54,36 +54,41 @@ class ExtensionManifestTest : public testing::Test { mutable scoped_ptr<DictionaryValue> manifest_holder_; }; - scoped_refptr<Extension> LoadExtension( + scoped_refptr<extensions::Extension> LoadExtension( const Manifest& manifest, std::string* error, - Extension::Location location = Extension::INTERNAL, - int flags = Extension::NO_FLAGS); + extensions::Extension::Location location = + extensions::Extension::INTERNAL, + int flags = extensions::Extension::NO_FLAGS); - scoped_refptr<Extension> LoadAndExpectSuccess( + scoped_refptr<extensions::Extension> LoadAndExpectSuccess( const Manifest& manifest, - Extension::Location location = Extension::INTERNAL, - int flags = Extension::NO_FLAGS); + extensions::Extension::Location location = + extensions::Extension::INTERNAL, + int flags = extensions::Extension::NO_FLAGS); - scoped_refptr<Extension> LoadAndExpectSuccess( + scoped_refptr<extensions::Extension> LoadAndExpectSuccess( char const* manifest_name, - Extension::Location location = Extension::INTERNAL, - int flags = Extension::NO_FLAGS); + extensions::Extension::Location location = + extensions::Extension::INTERNAL, + int flags = extensions::Extension::NO_FLAGS); - void VerifyExpectedError(Extension* extension, + void VerifyExpectedError(extensions::Extension* extension, const std::string& name, const std::string& error, const std::string& expected_error); void LoadAndExpectError(char const* manifest_name, const std::string& expected_error, - Extension::Location location = Extension::INTERNAL, - int flags = Extension::NO_FLAGS); + extensions::Extension::Location location = + extensions::Extension::INTERNAL, + int flags = extensions::Extension::NO_FLAGS); void LoadAndExpectError(const Manifest& manifest, const std::string& expected_error, - Extension::Location location = Extension::INTERNAL, - int flags = Extension::NO_FLAGS); + extensions::Extension::Location location = + extensions::Extension::INTERNAL, + int flags = extensions::Extension::NO_FLAGS); void AddPattern(URLPatternSet* extent, const std::string& pattern); @@ -94,18 +99,19 @@ class ExtensionManifestTest : public testing::Test { struct Testcase { std::string manifest_filename_; std::string expected_error_; // only used for ExpectedError tests - Extension::Location location_; + extensions::Extension::Location location_; int flags_; Testcase(std::string manifest_filename, std::string expected_error, - Extension::Location location, int flags); + extensions::Extension::Location location, int flags); Testcase(std::string manifest_filename, std::string expected_error); explicit Testcase(std::string manifest_filename); - Testcase(std::string manifest_filename, Extension::Location location, - int flags); + Testcase(std::string manifest_filename, + extensions::Extension::Location location, + int flags); }; void RunTestcases(const Testcase* testcases, size_t num_testcases, diff --git a/chrome/common/extensions/manifest_tests/extension_manifests_chromepermission_unittest.cc b/chrome/common/extensions/manifest_tests/extension_manifests_chromepermission_unittest.cc index e9e329e..691c477 100644 --- a/chrome/common/extensions/manifest_tests/extension_manifests_chromepermission_unittest.cc +++ b/chrome/common/extensions/manifest_tests/extension_manifests_chromepermission_unittest.cc @@ -21,7 +21,7 @@ TEST_F(ExtensionManifestTest, ChromeResourcesPermissionValidOnlyForComponents) { std::string error; LoadExtension(Manifest("permission_chrome_resources_url.json"), &error, - Extension::COMPONENT, - Extension::STRICT_ERROR_CHECKS); + extensions::Extension::COMPONENT, + extensions::Extension::STRICT_ERROR_CHECKS); EXPECT_EQ("", error); } diff --git a/chrome/common/extensions/manifest_tests/extension_manifests_default_unittest.cc b/chrome/common/extensions/manifest_tests/extension_manifests_default_unittest.cc index 5152bbf..959a161 100644 --- a/chrome/common/extensions/manifest_tests/extension_manifests_default_unittest.cc +++ b/chrome/common/extensions/manifest_tests/extension_manifests_default_unittest.cc @@ -11,7 +11,7 @@ namespace errors = extension_manifest_errors; TEST_F(ExtensionManifestTest, DefaultPathForExtent) { - scoped_refptr<Extension> extension( + scoped_refptr<extensions::Extension> extension( LoadAndExpectSuccess("default_path_for_extent.json")); ASSERT_EQ(1u, extension->web_extent().patterns().size()); @@ -24,7 +24,7 @@ TEST_F(ExtensionManifestTest, DefaultLocale) { LoadAndExpectError("default_locale_invalid.json", errors::kInvalidDefaultLocale); - scoped_refptr<Extension> extension( + scoped_refptr<extensions::Extension> extension( LoadAndExpectSuccess("default_locale_valid.json")); EXPECT_EQ("de-AT", extension->default_locale()); } diff --git a/chrome/common/extensions/manifest_tests/extension_manifests_devtools_unittest.cc b/chrome/common/extensions/manifest_tests/extension_manifests_devtools_unittest.cc index 5e027b5..4ee81e7 100644 --- a/chrome/common/extensions/manifest_tests/extension_manifests_devtools_unittest.cc +++ b/chrome/common/extensions/manifest_tests/extension_manifests_devtools_unittest.cc @@ -14,7 +14,7 @@ TEST_F(ExtensionManifestTest, DevToolsExtensions) { LoadAndExpectError("devtools_extension_url_invalid_type.json", errors::kInvalidDevToolsPage); - scoped_refptr<Extension> extension; + scoped_refptr<extensions::Extension> extension; extension = LoadAndExpectSuccess("devtools_extension.json"); EXPECT_EQ(extension->url().spec() + "devtools.html", extension->devtools_url().spec()); diff --git a/chrome/common/extensions/manifest_tests/extension_manifests_experimental_unittest.cc b/chrome/common/extensions/manifest_tests/extension_manifests_experimental_unittest.cc index 57b7f7d..4fe31c4 100644 --- a/chrome/common/extensions/manifest_tests/extension_manifests_experimental_unittest.cc +++ b/chrome/common/extensions/manifest_tests/extension_manifests_experimental_unittest.cc @@ -14,9 +14,9 @@ namespace errors = extension_manifest_errors; TEST_F(ExtensionManifestTest, ExperimentalPermission) { LoadAndExpectError("experimental.json", errors::kExperimentalFlagRequired); - LoadAndExpectSuccess("experimental.json", Extension::COMPONENT); - LoadAndExpectSuccess("experimental.json", Extension::INTERNAL, - Extension::FROM_WEBSTORE); + LoadAndExpectSuccess("experimental.json", extensions::Extension::COMPONENT); + LoadAndExpectSuccess("experimental.json", extensions::Extension::INTERNAL, + extensions::Extension::FROM_WEBSTORE); CommandLine::ForCurrentProcess()->AppendSwitch( switches::kEnableExperimentalExtensionApis); LoadAndExpectSuccess("experimental.json"); diff --git a/chrome/common/extensions/manifest_tests/extension_manifests_filebrowser_unittest.cc b/chrome/common/extensions/manifest_tests/extension_manifests_filebrowser_unittest.cc index eaa227c..3668d35 100644 --- a/chrome/common/extensions/manifest_tests/extension_manifests_filebrowser_unittest.cc +++ b/chrome/common/extensions/manifest_tests/extension_manifests_filebrowser_unittest.cc @@ -11,6 +11,8 @@ #include "chrome/common/extensions/file_browser_handler.h" #include "testing/gtest/include/gtest/gtest.h" +using extensions::Extension; + namespace errors = extension_manifest_errors; TEST_F(ExtensionManifestTest, FileBrowserHandlers) { diff --git a/chrome/common/extensions/manifest_tests/extension_manifests_homepage_unittest.cc b/chrome/common/extensions/manifest_tests/extension_manifests_homepage_unittest.cc index 66c3c42..59836af 100644 --- a/chrome/common/extensions/manifest_tests/extension_manifests_homepage_unittest.cc +++ b/chrome/common/extensions/manifest_tests/extension_manifests_homepage_unittest.cc @@ -12,7 +12,7 @@ namespace errors = extension_manifest_errors; TEST_F(ExtensionManifestTest, ParseHomepageURLs) { - scoped_refptr<Extension> extension( + scoped_refptr<extensions::Extension> extension( LoadAndExpectSuccess("homepage_valid.json")); Testcase testcases[] = { @@ -28,7 +28,7 @@ TEST_F(ExtensionManifestTest, ParseHomepageURLs) { } TEST_F(ExtensionManifestTest, GetHomepageURL) { - scoped_refptr<Extension> extension( + scoped_refptr<extensions::Extension> extension( LoadAndExpectSuccess("homepage_valid.json")); EXPECT_EQ(GURL("http://foo.com#bar"), extension->GetHomepageURL()); diff --git a/chrome/common/extensions/manifest_tests/extension_manifests_icon_unittest.cc b/chrome/common/extensions/manifest_tests/extension_manifests_icon_unittest.cc index 4e9d570..23c05fd 100644 --- a/chrome/common/extensions/manifest_tests/extension_manifests_icon_unittest.cc +++ b/chrome/common/extensions/manifest_tests/extension_manifests_icon_unittest.cc @@ -8,7 +8,7 @@ #include "testing/gtest/include/gtest/gtest.h" TEST_F(ExtensionManifestTest, NormalizeIconPaths) { - scoped_refptr<Extension> extension( + scoped_refptr<extensions::Extension> extension( LoadAndExpectSuccess("normalize_icon_paths.json")); EXPECT_EQ("16.png", extension->icons().Get( ExtensionIconSet::EXTENSION_ICON_BITTY, ExtensionIconSet::MATCH_EXACTLY)); @@ -18,7 +18,7 @@ TEST_F(ExtensionManifestTest, NormalizeIconPaths) { } TEST_F(ExtensionManifestTest, InvalidIconSizes) { - scoped_refptr<Extension> extension( + scoped_refptr<extensions::Extension> extension( LoadAndExpectSuccess("init_ignored_icon_size.json")); EXPECT_EQ("", extension->icons().Get( static_cast<ExtensionIconSet::Icons>(300), @@ -26,7 +26,7 @@ TEST_F(ExtensionManifestTest, InvalidIconSizes) { } TEST_F(ExtensionManifestTest, ValidIconSizes) { - scoped_refptr<Extension> extension( + scoped_refptr<extensions::Extension> extension( LoadAndExpectSuccess("init_valid_icon_size.json")); EXPECT_EQ("16.png", extension->icons().Get( ExtensionIconSet::EXTENSION_ICON_BITTY, ExtensionIconSet::MATCH_EXACTLY)); diff --git a/chrome/common/extensions/manifest_tests/extension_manifests_initvalue_unittest.cc b/chrome/common/extensions/manifest_tests/extension_manifests_initvalue_unittest.cc index 0840c87..588017b 100644 --- a/chrome/common/extensions/manifest_tests/extension_manifests_initvalue_unittest.cc +++ b/chrome/common/extensions/manifest_tests/extension_manifests_initvalue_unittest.cc @@ -74,14 +74,14 @@ TEST_F(ExtensionManifestTest, InitFromValueInvalid) { } TEST_F(ExtensionManifestTest, InitFromValueValid) { - scoped_refptr<Extension> extension(LoadAndExpectSuccess( + scoped_refptr<extensions::Extension> extension(LoadAndExpectSuccess( "init_valid_minimal.json")); FilePath path; PathService::Get(chrome::DIR_TEST_DATA, &path); path = path.AppendASCII("extensions"); - EXPECT_TRUE(Extension::IdIsValid(extension->id())); + EXPECT_TRUE(extensions::Extension::IdIsValid(extension->id())); EXPECT_EQ("1.0.0.0", extension->VersionString()); EXPECT_EQ("my extension", extension->name()); EXPECT_EQ(extension->id(), extension->url().host()); @@ -134,7 +134,7 @@ TEST_F(ExtensionManifestTest, InitFromValueValidNameInRTL) { #endif // No strong RTL characters in name. - scoped_refptr<Extension> extension(LoadAndExpectSuccess( + scoped_refptr<extensions::Extension> extension(LoadAndExpectSuccess( "init_valid_name_no_rtl.json")); string16 localized_name(ASCIIToUTF16("Dictionary (by Google)")); diff --git a/chrome/common/extensions/manifest_tests/extension_manifests_isolatedapp_unittest.cc b/chrome/common/extensions/manifest_tests/extension_manifests_isolatedapp_unittest.cc index a93dbaf..6181ad0 100644 --- a/chrome/common/extensions/manifest_tests/extension_manifests_isolatedapp_unittest.cc +++ b/chrome/common/extensions/manifest_tests/extension_manifests_isolatedapp_unittest.cc @@ -19,7 +19,7 @@ TEST_F(ExtensionManifestTest, IsolatedApps) { CommandLine::ForCurrentProcess()->AppendSwitch( switches::kEnableExperimentalExtensionApis); - scoped_refptr<Extension> extension2( + scoped_refptr<extensions::Extension> extension2( LoadAndExpectSuccess("isolated_app_valid.json")); EXPECT_TRUE(extension2->is_storage_isolated()); } diff --git a/chrome/common/extensions/manifest_tests/extension_manifests_launch_unittest.cc b/chrome/common/extensions/manifest_tests/extension_manifests_launch_unittest.cc index 84cdf8d..35df234 100644 --- a/chrome/common/extensions/manifest_tests/extension_manifests_launch_unittest.cc +++ b/chrome/common/extensions/manifest_tests/extension_manifests_launch_unittest.cc @@ -14,7 +14,7 @@ namespace errors = extension_manifest_errors; TEST_F(ExtensionManifestTest, AppLaunchContainer) { - scoped_refptr<Extension> extension; + scoped_refptr<extensions::Extension> extension; extension = LoadAndExpectSuccess("launch_tab.json"); EXPECT_EQ(extension_misc::LAUNCH_TAB, extension->launch_container()); @@ -98,7 +98,7 @@ TEST_F(ExtensionManifestTest, AppLaunchURL) { RunTestcases(testcases, arraysize(testcases), EXPECT_TYPE_ERROR); - scoped_refptr<Extension> extension; + scoped_refptr<extensions::Extension> extension; extension = LoadAndExpectSuccess("launch_local_path.json"); EXPECT_EQ(extension->url().spec() + "launch.html", extension->GetFullLaunchURL().spec()); diff --git a/chrome/common/extensions/manifest_tests/extension_manifests_offline_unittest.cc b/chrome/common/extensions/manifest_tests/extension_manifests_offline_unittest.cc index 9f7f031..7ec1c37 100644 --- a/chrome/common/extensions/manifest_tests/extension_manifests_offline_unittest.cc +++ b/chrome/common/extensions/manifest_tests/extension_manifests_offline_unittest.cc @@ -8,6 +8,8 @@ #include "chrome/common/extensions/extension_manifest_constants.h" #include "testing/gtest/include/gtest/gtest.h" +using extensions::Extension; + namespace errors = extension_manifest_errors; TEST_F(ExtensionManifestTest, OfflineEnabled) { diff --git a/chrome/common/extensions/manifest_tests/extension_manifests_old_unittest.cc b/chrome/common/extensions/manifest_tests/extension_manifests_old_unittest.cc index 4664f89..bd590c5 100644 --- a/chrome/common/extensions/manifest_tests/extension_manifests_old_unittest.cc +++ b/chrome/common/extensions/manifest_tests/extension_manifests_old_unittest.cc @@ -10,10 +10,10 @@ // Tests that the old permission name "unlimited_storage" still works for // backwards compatibility (we renamed it to "unlimitedStorage"). TEST_F(ExtensionManifestTest, OldUnlimitedStoragePermission) { - scoped_refptr<Extension> extension = LoadAndExpectSuccess( + scoped_refptr<extensions::Extension> extension = LoadAndExpectSuccess( "old_unlimited_storage.json", - Extension::INTERNAL, - Extension::STRICT_ERROR_CHECKS); + extensions::Extension::INTERNAL, + extensions::Extension::STRICT_ERROR_CHECKS); EXPECT_TRUE(extension->HasAPIPermission( ExtensionAPIPermission::kUnlimitedStorage)); } diff --git a/chrome/common/extensions/manifest_tests/extension_manifests_options_unittest.cc b/chrome/common/extensions/manifest_tests/extension_manifests_options_unittest.cc index 5853fda..2eef91d 100644 --- a/chrome/common/extensions/manifest_tests/extension_manifests_options_unittest.cc +++ b/chrome/common/extensions/manifest_tests/extension_manifests_options_unittest.cc @@ -10,7 +10,7 @@ namespace errors = extension_manifest_errors; TEST_F(ExtensionManifestTest, OptionsPageInApps) { - scoped_refptr<Extension> extension; + scoped_refptr<extensions::Extension> extension; // Allow options page with absolute URL in hosted apps. extension = LoadAndExpectSuccess("hosted_app_absolute_options.json"); diff --git a/chrome/common/extensions/manifest_tests/extension_manifests_override_unittest.cc b/chrome/common/extensions/manifest_tests/extension_manifests_override_unittest.cc index 0fb2e52..b7d4c0e 100644 --- a/chrome/common/extensions/manifest_tests/extension_manifests_override_unittest.cc +++ b/chrome/common/extensions/manifest_tests/extension_manifests_override_unittest.cc @@ -17,7 +17,7 @@ TEST_F(ExtensionManifestTest, Override) { RunTestcases(testcases, arraysize(testcases), EXPECT_TYPE_ERROR); - scoped_refptr<Extension> extension; + scoped_refptr<extensions::Extension> extension; extension = LoadAndExpectSuccess("override_new_tab.json"); EXPECT_EQ(extension->url().spec() + "newtab.html", diff --git a/chrome/common/extensions/manifest_tests/extension_manifests_pageaction_unittest.cc b/chrome/common/extensions/manifest_tests/extension_manifests_pageaction_unittest.cc index 4ecd8f9..fccc493 100644 --- a/chrome/common/extensions/manifest_tests/extension_manifests_pageaction_unittest.cc +++ b/chrome/common/extensions/manifest_tests/extension_manifests_pageaction_unittest.cc @@ -11,7 +11,7 @@ namespace errors = extension_manifest_errors; TEST_F(ExtensionManifestTest, PageActionManifestVersion2) { - scoped_refptr<Extension> extension( + scoped_refptr<extensions::Extension> extension( LoadAndExpectSuccess("page_action_manifest_version_2.json")); ASSERT_TRUE(extension.get()); ASSERT_TRUE(extension->page_action()); diff --git a/chrome/common/extensions/manifest_tests/extension_manifests_platformapp_unittest.cc b/chrome/common/extensions/manifest_tests/extension_manifests_platformapp_unittest.cc index 8b39de3..ab7a852 100644 --- a/chrome/common/extensions/manifest_tests/extension_manifests_platformapp_unittest.cc +++ b/chrome/common/extensions/manifest_tests/extension_manifests_platformapp_unittest.cc @@ -20,7 +20,7 @@ TEST_F(ExtensionManifestTest, PlatformApps) { CommandLine::ForCurrentProcess()->AppendSwitch(switches::kEnablePlatformApps); - scoped_refptr<Extension> extension = + scoped_refptr<extensions::Extension> extension = LoadAndExpectSuccess("init_valid_platform_app.json"); EXPECT_TRUE(extension->is_storage_isolated()); diff --git a/chrome/common/extensions/manifest_tests/extension_manifests_storage_unittest.cc b/chrome/common/extensions/manifest_tests/extension_manifests_storage_unittest.cc index 8acb36c..e020bf0 100644 --- a/chrome/common/extensions/manifest_tests/extension_manifests_storage_unittest.cc +++ b/chrome/common/extensions/manifest_tests/extension_manifests_storage_unittest.cc @@ -25,7 +25,8 @@ TEST_F(ExtensionManifestTest, StorageAPIManifestVersionAvailability) { // Extension with no manifest version cannot use storage API. { Manifest manifest(&base_manifest, "test"); - scoped_refptr<Extension> extension = LoadAndExpectSuccess(manifest); + scoped_refptr<extensions::Extension> extension = + LoadAndExpectSuccess(manifest); if (extension.get()) { std::vector<std::string> warnings; warnings.push_back(kManifestVersionError); @@ -40,7 +41,8 @@ TEST_F(ExtensionManifestTest, StorageAPIManifestVersionAvailability) { manifest_with_version.MergeDictionary(&base_manifest); Manifest manifest(&manifest_with_version, "test"); - scoped_refptr<Extension> extension = LoadAndExpectSuccess(manifest); + scoped_refptr<extensions::Extension> extension = + LoadAndExpectSuccess(manifest); if (extension.get()) { std::vector<std::string> warnings; warnings.push_back(kManifestVersionError); @@ -55,7 +57,8 @@ TEST_F(ExtensionManifestTest, StorageAPIManifestVersionAvailability) { manifest_with_version.MergeDictionary(&base_manifest); Manifest manifest(&manifest_with_version, "test"); - scoped_refptr<Extension> extension = LoadAndExpectSuccess(manifest); + scoped_refptr<extensions::Extension> extension = + LoadAndExpectSuccess(manifest); if (extension.get()) { std::vector<std::string> empty; EXPECT_EQ(empty, extension->install_warnings()); diff --git a/chrome/common/extensions/manifest_tests/extension_manifests_tts_unittest.cc b/chrome/common/extensions/manifest_tests/extension_manifests_tts_unittest.cc index fd71dd1..954a172 100644 --- a/chrome/common/extensions/manifest_tests/extension_manifests_tts_unittest.cc +++ b/chrome/common/extensions/manifest_tests/extension_manifests_tts_unittest.cc @@ -33,7 +33,7 @@ TEST_F(ExtensionManifestTest, TtsEngine) { RunTestcases(testcases, arraysize(testcases), EXPECT_TYPE_ERROR); - scoped_refptr<Extension> extension( + scoped_refptr<extensions::Extension> extension( LoadAndExpectSuccess("tts_engine_valid.json")); ASSERT_EQ(1u, extension->tts_voices().size()); diff --git a/chrome/common/extensions/manifest_tests/extension_manifests_update_unittest.cc b/chrome/common/extensions/manifest_tests/extension_manifests_update_unittest.cc index 5f3f9d0..6d44698 100644 --- a/chrome/common/extensions/manifest_tests/extension_manifests_update_unittest.cc +++ b/chrome/common/extensions/manifest_tests/extension_manifests_update_unittest.cc @@ -7,6 +7,8 @@ #include "chrome/common/extensions/extension_manifest_constants.h" #include "testing/gtest/include/gtest/gtest.h" +using extensions::Extension; + namespace errors = extension_manifest_errors; TEST_F(ExtensionManifestTest, UpdateUrls) { diff --git a/chrome/common/extensions/manifest_tests/extension_manifests_validapp_unittest.cc b/chrome/common/extensions/manifest_tests/extension_manifests_validapp_unittest.cc index 9eb971e..f8bd6d5 100644 --- a/chrome/common/extensions/manifest_tests/extension_manifests_validapp_unittest.cc +++ b/chrome/common/extensions/manifest_tests/extension_manifests_validapp_unittest.cc @@ -9,7 +9,8 @@ #include "testing/gtest/include/gtest/gtest.h" TEST_F(ExtensionManifestTest, ValidApp) { - scoped_refptr<Extension> extension(LoadAndExpectSuccess("valid_app.json")); + scoped_refptr<extensions::Extension> extension( + LoadAndExpectSuccess("valid_app.json")); URLPatternSet expected_patterns; AddPattern(&expected_patterns, "http://www.google.com/mail/*"); AddPattern(&expected_patterns, "http://www.google.com/foobar/*"); diff --git a/chrome/common/extensions/manifest_tests/extension_manifests_web_unittest.cc b/chrome/common/extensions/manifest_tests/extension_manifests_web_unittest.cc index 59ca69c..879c537 100644 --- a/chrome/common/extensions/manifest_tests/extension_manifests_web_unittest.cc +++ b/chrome/common/extensions/manifest_tests/extension_manifests_web_unittest.cc @@ -11,6 +11,8 @@ #include "testing/gtest/include/gtest/gtest.h" #include "webkit/glue/web_intent_service_data.h" +using extensions::Extension; + namespace errors = extension_manifest_errors; TEST_F(ExtensionManifestTest, WebAccessibleResources) { diff --git a/chrome/common/extensions/simple_feature_provider_unittest.cc b/chrome/common/extensions/simple_feature_provider_unittest.cc index 3d9dd72..fd0fd34 100644 --- a/chrome/common/extensions/simple_feature_provider_unittest.cc +++ b/chrome/common/extensions/simple_feature_provider_unittest.cc @@ -6,6 +6,7 @@ #include "testing/gtest/include/gtest/gtest.h" +using extensions::Extension; using extensions::Feature; using extensions::SimpleFeatureProvider; diff --git a/chrome/renderer/chrome_content_renderer_client.cc b/chrome/renderer/chrome_content_renderer_client.cc index ddd22ac..aef61cd 100644 --- a/chrome/renderer/chrome_content_renderer_client.cc +++ b/chrome/renderer/chrome_content_renderer_client.cc @@ -88,12 +88,19 @@ #include "webkit/plugins/ppapi/plugin_module.h" #include "webkit/plugins/ppapi/ppapi_interface_factory.h" +using autofill::AutofillAgent; +using autofill::PasswordAutofillManager; +using autofill::PasswordGenerationManager; +using content::RenderThread; +using extensions::Extension; using WebKit::WebCache; using WebKit::WebConsoleMessage; using WebKit::WebDataSource; using WebKit::WebDocument; using WebKit::WebFrame; using WebKit::WebPlugin; +using webkit::WebPluginInfo; +using webkit::WebPluginMimeType; using WebKit::WebPluginParams; using WebKit::WebSecurityOrigin; using WebKit::WebSecurityPolicy; @@ -103,12 +110,6 @@ using WebKit::WebURLError; using WebKit::WebURLRequest; using WebKit::WebURLResponse; using WebKit::WebVector; -using autofill::AutofillAgent; -using autofill::PasswordAutofillManager; -using autofill::PasswordGenerationManager; -using content::RenderThread; -using webkit::WebPluginInfo; -using webkit::WebPluginMimeType; namespace { diff --git a/chrome/renderer/chrome_content_renderer_client.h b/chrome/renderer/chrome_content_renderer_client.h index c587e70..17fea34 100644 --- a/chrome/renderer/chrome_content_renderer_client.h +++ b/chrome/renderer/chrome_content_renderer_client.h @@ -15,7 +15,6 @@ #include "content/public/renderer/content_renderer_client.h" class ChromeRenderProcessObserver; -class Extension; class ExtensionDispatcher; class ExtensionSet; class RendererHistogramSnapshots; diff --git a/chrome/renderer/extensions/app_bindings.cc b/chrome/renderer/extensions/app_bindings.cc index f69d2ef..550421e 100644 --- a/chrome/renderer/extensions/app_bindings.cc +++ b/chrome/renderer/extensions/app_bindings.cc @@ -25,6 +25,7 @@ using WebKit::WebFrame; using content::V8ValueConverter; +using extensions::Extension; namespace { @@ -77,7 +78,7 @@ AppBindings::AppBindings(ExtensionDispatcher* dispatcher, v8::Handle<v8::Value> AppBindings::GetIsInstalled( const v8::Arguments& args) { - const Extension* extension = context_->extension(); + const extensions::Extension* extension = context_->extension(); // TODO(aa): Why only hosted app? bool result = extension && extension->is_hosted_app() && @@ -134,7 +135,7 @@ v8::Handle<v8::Value> AppBindings::GetDetailsForFrame( v8::Handle<v8::Value> AppBindings::GetDetailsForFrameImpl( WebFrame* frame) { - const ::Extension* extension = + const extensions::Extension* extension = extension_dispatcher_->extensions()->GetExtensionOrAppByURL( ExtensionURLInfo(frame->document().securityOrigin(), frame->document().url())); diff --git a/chrome/renderer/extensions/chrome_v8_context.cc b/chrome/renderer/extensions/chrome_v8_context.cc index 599b235..6d037fa 100644 --- a/chrome/renderer/extensions/chrome_v8_context.cc +++ b/chrome/renderer/extensions/chrome_v8_context.cc @@ -9,6 +9,7 @@ #include "base/string_split.h" #include "base/values.h" #include "chrome/common/extensions/api/extension_api.h" +#include "chrome/common/extensions/extension.h" #include "chrome/common/extensions/extension_set.h" #include "chrome/renderer/extensions/chrome_v8_extension.h" #include "chrome/renderer/extensions/user_script_slave.h" @@ -44,7 +45,7 @@ std::string GetContextTypeDescription(Feature::Context context_type) { ChromeV8Context::ChromeV8Context(v8::Handle<v8::Context> v8_context, WebKit::WebFrame* web_frame, - const Extension* extension, + const extensions::Extension* extension, Feature::Context context_type) : v8_context_(v8::Persistent<v8::Context>::New(v8_context)), web_frame_(web_frame), diff --git a/chrome/renderer/extensions/chrome_v8_context.h b/chrome/renderer/extensions/chrome_v8_context.h index 4795688..8aec582 100644 --- a/chrome/renderer/extensions/chrome_v8_context.h +++ b/chrome/renderer/extensions/chrome_v8_context.h @@ -21,6 +21,10 @@ namespace content { class RenderView; } +namespace extensions { +class Extension; +} + // Chrome's wrapper for a v8 context. // // TODO(aa): Consider converting this back to a set of bindings_utils. It would @@ -30,7 +34,7 @@ class ChromeV8Context { public: ChromeV8Context(v8::Handle<v8::Context> context, WebKit::WebFrame* frame, - const Extension* extension, + const extensions::Extension* extension, extensions::Feature::Context context_type); ~ChromeV8Context(); @@ -38,7 +42,7 @@ class ChromeV8Context { return v8_context_; } - const Extension* extension() const { + const extensions::Extension* extension() const { return extension_.get(); } @@ -114,7 +118,7 @@ class ChromeV8Context { // The extension associated with this context, or NULL if there is none. This // might be a hosted app in the case that this context is hosting a web URL. - scoped_refptr<const Extension> extension_; + scoped_refptr<const extensions::Extension> extension_; // The type of context. extensions::Feature::Context context_type_; diff --git a/chrome/renderer/extensions/chrome_v8_context_set.cc b/chrome/renderer/extensions/chrome_v8_context_set.cc index bbb8a41..dfe3d85 100644 --- a/chrome/renderer/extensions/chrome_v8_context_set.cc +++ b/chrome/renderer/extensions/chrome_v8_context_set.cc @@ -8,6 +8,7 @@ #include "base/message_loop.h" #include "base/tracked_objects.h" #include "base/values.h" +#include "chrome/common/extensions/extension.h" #include "chrome/common/url_constants.h" #include "chrome/renderer/extensions/chrome_v8_context.h" #include "content/public/renderer/render_thread.h" @@ -118,7 +119,7 @@ void ChromeV8ContextSet::DispatchChromeHiddenMethod( continue; if (!extension_id.empty()) { - const Extension* extension = (*it)->extension(); + const extensions::Extension* extension = (*it)->extension(); if (!extension || (extension_id != extension->id())) continue; } diff --git a/chrome/renderer/extensions/chrome_v8_context_set_unittest.cc b/chrome/renderer/extensions/chrome_v8_context_set_unittest.cc index 92443aa..1a53a27 100644 --- a/chrome/renderer/extensions/chrome_v8_context_set_unittest.cc +++ b/chrome/renderer/extensions/chrome_v8_context_set_unittest.cc @@ -22,7 +22,7 @@ TEST(ChromeV8ContextSet, Lifecycle) { // Dirty hack, but we don't actually need the frame, and this is easier than // creating a whole webview. WebKit::WebFrame* frame = reinterpret_cast<WebKit::WebFrame*>(1); - const Extension* extension = NULL; + const extensions::Extension* extension = NULL; ChromeV8Context* context = new ChromeV8Context( v8_context, frame, diff --git a/chrome/renderer/extensions/chrome_v8_extension.cc b/chrome/renderer/extensions/chrome_v8_extension.cc index 486d68b..d4bcbf0 100644 --- a/chrome/renderer/extensions/chrome_v8_extension.cc +++ b/chrome/renderer/extensions/chrome_v8_extension.cc @@ -62,7 +62,8 @@ const ChromeV8Extension::InstanceSet& ChromeV8Extension::GetAll() { return g_instances.Get(); } -const Extension* ChromeV8Extension::GetExtensionForCurrentRenderView() const { +const extensions::Extension* + ChromeV8Extension::GetExtensionForCurrentRenderView() const { content::RenderView* renderview = GetCurrentRenderView(); if (!renderview) return NULL; // this can happen as a tab is closing. diff --git a/chrome/renderer/extensions/chrome_v8_extension.h b/chrome/renderer/extensions/chrome_v8_extension.h index 84fda03..4be6587 100644 --- a/chrome/renderer/extensions/chrome_v8_extension.h +++ b/chrome/renderer/extensions/chrome_v8_extension.h @@ -18,13 +18,16 @@ #include <string> class ChromeV8Context; -class Extension; class ExtensionDispatcher; namespace content { class RenderView; } +namespace extensions { +class Extension; +} + // This is a base class for chrome extension bindings. Common features that // are shared by different modules go here. // TODO(koz): Rename this to ExtensionNativeModule. @@ -52,7 +55,7 @@ class ChromeV8Extension : public NativeHandler { // Note: do not call this function before or during the chromeHidden.onLoad // event dispatch. The URL might not have been committed yet and might not // be an extension URL. - const ::Extension* GetExtensionForCurrentRenderView() const; + const extensions::Extension* GetExtensionForCurrentRenderView() const; // Returns the chromeHidden object for the current context. static v8::Handle<v8::Value> GetChromeHidden(const v8::Arguments& args); diff --git a/chrome/renderer/extensions/event_bindings.cc b/chrome/renderer/extensions/event_bindings.cc index 478c7f2..ac5b0aa 100644 --- a/chrome/renderer/extensions/event_bindings.cc +++ b/chrome/renderer/extensions/event_bindings.cc @@ -35,6 +35,7 @@ using WebKit::WebFrame; using WebKit::WebSecurityOrigin; using WebKit::WebURL; using content::RenderThread; +using extensions::Extension; namespace { diff --git a/chrome/renderer/extensions/extension_custom_bindings.cc b/chrome/renderer/extensions/extension_custom_bindings.cc index f60a497..a301342 100644 --- a/chrome/renderer/extensions/extension_custom_bindings.cc +++ b/chrome/renderer/extensions/extension_custom_bindings.cc @@ -8,6 +8,7 @@ #include "base/string_util.h" #include "chrome/common/chrome_view_type.h" +#include "chrome/common/extensions/extension.h" #include "chrome/common/extensions/extension_action.h" #include "chrome/common/extensions/extension_messages.h" #include "chrome/common/url_constants.h" @@ -73,7 +74,7 @@ v8::Handle<v8::Value> ExtensionCustomBindings::GetExtensionViews( ExtensionCustomBindings* v8_extension = GetFromArguments<ExtensionCustomBindings>(args); - const ::Extension* extension = + const Extension* extension = v8_extension->GetExtensionForCurrentRenderView(); if (!extension) return v8::Undefined(); diff --git a/chrome/renderer/extensions/extension_dispatcher.cc b/chrome/renderer/extensions/extension_dispatcher.cc index 9706f67..a070496 100644 --- a/chrome/renderer/extensions/extension_dispatcher.cc +++ b/chrome/renderer/extensions/extension_dispatcher.cc @@ -71,6 +71,7 @@ using WebKit::WebView; using content::RenderThread; using extensions::ApiDefinitionsNatives; using extensions::ContextMenusCustomBindings; +using extensions::Extension; using extensions::ExperimentalUsbCustomBindings; using extensions::ExtensionAPI; using extensions::ExtensionCustomBindings; @@ -86,6 +87,7 @@ using extensions::SendRequestNatives; using extensions::SetIconNatives; using extensions::TTSCustomBindings; using extensions::TabsCustomBindings; +using extensions::UpdatedExtensionPermissionsInfo; using extensions::WebRequestCustomBindings; namespace { diff --git a/chrome/renderer/extensions/extension_dispatcher.h b/chrome/renderer/extensions/extension_dispatcher.h index 086656f..0bc9647 100644 --- a/chrome/renderer/extensions/extension_dispatcher.h +++ b/chrome/renderer/extensions/extension_dispatcher.h @@ -40,6 +40,10 @@ namespace content { class RenderThread; } +namespace extension { +class Extension; +} + // Dispatches extension control messages sent to the renderer and stores // renderer extension related state. class ExtensionDispatcher : public content::RenderProcessObserver { @@ -140,7 +144,7 @@ class ExtensionDispatcher : public content::RenderProcessObserver { const std::vector<ExtensionMsg_Loaded_Params>& loaded_extensions); void OnUnloaded(const std::string& id); void OnSetScriptingWhitelist( - const Extension::ScriptingWhitelist& extension_ids); + const extensions::Extension::ScriptingWhitelist& extension_ids); void OnPageActionsUpdated(const std::string& extension_id, const std::vector<std::string>& page_actions); void OnActivateExtension(const std::string& extension_id); @@ -165,10 +169,11 @@ class ExtensionDispatcher : public content::RenderProcessObserver { void RegisterExtension(v8::Extension* extension, bool restrict_to_extensions); // Sets up the host permissions for |extension|. - void InitOriginPermissions(const Extension* extension); - void UpdateOriginPermissions(UpdatedExtensionPermissionsInfo::Reason reason, - const Extension* extension, - const URLPatternSet& origins); + void InitOriginPermissions(const extensions::Extension* extension); + void UpdateOriginPermissions( + extensions::UpdatedExtensionPermissionsInfo::Reason reason, + const extensions::Extension* extension, + const URLPatternSet& origins); void RegisterNativeHandlers(ModuleSystem* module_system, ChromeV8Context* context); diff --git a/chrome/renderer/extensions/extension_resource_request_policy.cc b/chrome/renderer/extensions/extension_resource_request_policy.cc index 6e62a85..9f1e842 100644 --- a/chrome/renderer/extensions/extension_resource_request_policy.cc +++ b/chrome/renderer/extensions/extension_resource_request_policy.cc @@ -17,6 +17,8 @@ #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" +using extensions::Extension; + // static bool ExtensionResourceRequestPolicy::CanRequestResource( const GURL& resource_url, diff --git a/chrome/renderer/extensions/page_actions_custom_bindings.cc b/chrome/renderer/extensions/page_actions_custom_bindings.cc index b6e86ee..276a62a 100644 --- a/chrome/renderer/extensions/page_actions_custom_bindings.cc +++ b/chrome/renderer/extensions/page_actions_custom_bindings.cc @@ -26,7 +26,7 @@ v8::Handle<v8::Value> PageActionsCustomBindings::GetCurrentPageActions( GetFromArguments<PageActionsCustomBindings>(args); std::string extension_id = *v8::String::Utf8Value(args[0]->ToString()); CHECK(!extension_id.empty()); - const ::Extension* extension = + const Extension* extension = self->extension_dispatcher_->extensions()->GetByID(extension_id); CHECK(extension); diff --git a/chrome/renderer/extensions/user_script_scheduler.cc b/chrome/renderer/extensions/user_script_scheduler.cc index 58f3104..916b429 100644 --- a/chrome/renderer/extensions/user_script_scheduler.cc +++ b/chrome/renderer/extensions/user_script_scheduler.cc @@ -29,6 +29,7 @@ using WebKit::WebDocument; using WebKit::WebFrame; using WebKit::WebString; using WebKit::WebView; +using extensions::Extension; UserScriptScheduler::UserScriptScheduler( WebFrame* frame, ExtensionDispatcher* extension_dispatcher) diff --git a/chrome/renderer/extensions/user_script_slave.cc b/chrome/renderer/extensions/user_script_slave.cc index 9008381..8c346d5 100644 --- a/chrome/renderer/extensions/user_script_slave.cc +++ b/chrome/renderer/extensions/user_script_slave.cc @@ -39,6 +39,7 @@ using WebKit::WebString; using WebKit::WebVector; using WebKit::WebView; using content::RenderThread; +using extensions::Extension; // These two strings are injected before and after the Greasemonkey API and // user script to wrap it in an anonymous scope. diff --git a/chrome/renderer/extensions/user_script_slave.h b/chrome/renderer/extensions/user_script_slave.h index d2f5fec..fad2f42 100644 --- a/chrome/renderer/extensions/user_script_slave.h +++ b/chrome/renderer/extensions/user_script_slave.h @@ -18,10 +18,13 @@ #include "chrome/common/extensions/user_script.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebScriptSource.h" -class Extension; class ExtensionSet; class GURL; +namespace extensions { +class Extension; +} + namespace WebKit { class WebFrame; } @@ -52,7 +55,7 @@ class UserScriptSlave { // Gets the isolated world ID to use for the given |extension| in the given // |frame|. If no isolated world has been created for that extension, // one will be created and initialized. - int GetIsolatedWorldIdForExtension(const Extension* extension, + int GetIsolatedWorldIdForExtension(const extensions::Extension* extension, WebKit::WebFrame* frame); // Gets the id of the extension running in a given isolated world. If no such @@ -64,7 +67,7 @@ class UserScriptSlave { private: static void InitializeIsolatedWorld(int isolated_world_id, - const Extension* extension); + const extensions::Extension* extension); // Shared memory containing raw script data. scoped_ptr<base::SharedMemory> shared_memory_; diff --git a/chrome/renderer/extensions/webstore_bindings.cc b/chrome/renderer/extensions/webstore_bindings.cc index 7214db9..c234e63 100644 --- a/chrome/renderer/extensions/webstore_bindings.cc +++ b/chrome/renderer/extensions/webstore_bindings.cc @@ -173,7 +173,7 @@ bool WebstoreBindings::GetWebstoreItemIdFromFrame( std::string candidate_webstore_item_id = webstore_url.path().substr( webstore_base_url.path().length()); - if (!::Extension::IdIsValid(candidate_webstore_item_id)) { + if (!extensions::Extension::IdIsValid(candidate_webstore_item_id)) { *error = kInvalidWebstoreItemUrlError; return false; } diff --git a/chrome/renderer/localized_error.cc b/chrome/renderer/localized_error.cc index 548b77c..430c4af 100644 --- a/chrome/renderer/localized_error.cc +++ b/chrome/renderer/localized_error.cc @@ -707,7 +707,7 @@ void LocalizedError::GetFormRepostStrings(const GURL& display_url, void LocalizedError::GetAppErrorStrings( const WebURLError& error, const GURL& display_url, - const Extension* app, + const extensions::Extension* app, DictionaryValue* error_strings) { DCHECK(app); diff --git a/chrome/renderer/localized_error.h b/chrome/renderer/localized_error.h index 1006ae6..0ccf86d 100644 --- a/chrome/renderer/localized_error.h +++ b/chrome/renderer/localized_error.h @@ -11,13 +11,16 @@ #include "base/basictypes.h" #include "base/string16.h" -class Extension; class GURL; namespace base { class DictionaryValue; } +namespace extensions { +class Extension; +} + namespace WebKit { struct WebURLError; } @@ -48,7 +51,7 @@ class LocalizedError { // part of the app. static void GetAppErrorStrings(const WebKit::WebURLError& error, const GURL& display_url, - const Extension* app, + const extensions::Extension* app, base::DictionaryValue* error_strings); static const char kHttpErrorDomain[]; diff --git a/chrome/test/base/test_browser_window.h b/chrome/test/base/test_browser_window.h index 3c75b0a..56c7e5d 100644 --- a/chrome/test/base/test_browser_window.h +++ b/chrome/test/base/test_browser_window.h @@ -12,6 +12,10 @@ #include "chrome/browser/ui/browser_window.h" #include "chrome/test/base/test_location_bar.h" +namespace extensions { +class Extension; +} + // An implementation of BrowserWindow used for testing. TestBrowserWindow only // contains a valid LocationBar, all other getters return NULL. // See BrowserWithTestWindowTest for an example of using this class. @@ -75,7 +79,7 @@ class TestBrowserWindow : public BrowserWindow { TabContentsWrapper* tab_contents) OVERRIDE {} virtual void ShowCreateChromeAppShortcutsDialog( Profile* profile, - const Extension* app) OVERRIDE {} + const extensions::Extension* app) OVERRIDE {} virtual bool IsBookmarkBarVisible() const OVERRIDE; virtual bool IsBookmarkBarAnimating() const OVERRIDE; diff --git a/chrome/test/base/testing_profile.cc b/chrome/test/base/testing_profile.cc index 3aa61dc..334728e 100644 --- a/chrome/test/base/testing_profile.cc +++ b/chrome/test/base/testing_profile.cc @@ -536,7 +536,7 @@ net::URLRequestContextGetter* TestingProfile::GetRequestContextForRenderProcess( ExtensionService* extension_service = ExtensionSystem::Get(this)->extension_service(); if (extension_service) { - const Extension* installed_app = extension_service-> + const extensions::Extension* installed_app = extension_service-> GetInstalledAppForRenderer(renderer_child_id); if (installed_app != NULL && installed_app->is_storage_isolated()) return GetRequestContextForIsolatedApp(installed_app->id()); diff --git a/chrome/utility/chrome_content_utility_client.cc b/chrome/utility/chrome_content_utility_client.cc index ade6bd7..7bccbfc 100644 --- a/chrome/utility/chrome_content_utility_client.cc +++ b/chrome/utility/chrome_content_utility_client.cc @@ -102,12 +102,12 @@ void ChromeContentUtilityClient::OnUnpackExtension( const std::string& extension_id, int location, int creation_flags) { - CHECK(location > Extension::INVALID); - CHECK(location < Extension::NUM_LOCATIONS); + CHECK(location > extensions::Extension::INVALID); + CHECK(location < extensions::Extension::NUM_LOCATIONS); ExtensionUnpacker unpacker( extension_path, extension_id, - static_cast<Extension::Location>(location), + static_cast<extensions::Extension::Location>(location), creation_flags); if (unpacker.Run() && unpacker.DumpImagesToFile() && unpacker.DumpMessageCatalogsToFile()) { |