diff options
author | yoz@chromium.org <yoz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-01-31 08:41:40 +0000 |
---|---|---|
committer | yoz@chromium.org <yoz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-01-31 08:41:40 +0000 |
commit | 1d5e58b96403aab76b4ae9f957eac7fac9c54182 (patch) | |
tree | 531272d9e76d671eee55318d5cd75da120e8a277 /chrome/browser | |
parent | 13fb3ec6e5f257683426c353f70523b1ad2e24f7 (diff) | |
download | chromium_src-1d5e58b96403aab76b4ae9f957eac7fac9c54182.zip chromium_src-1d5e58b96403aab76b4ae9f957eac7fac9c54182.tar.gz chromium_src-1d5e58b96403aab76b4ae9f957eac7fac9c54182.tar.bz2 |
Move Extension Location and Type enums to Manifest, and move InstallWarning to its own file.
Reverses the dependency between Extension and Manifest.
Part 1 of moving Manifest to top-level extensions.
BUG=162530
TBR=ben@chromium.org
Review URL: https://chromiumcodereview.appspot.com/12093036
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@179828 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
119 files changed, 674 insertions, 609 deletions
diff --git a/chrome/browser/automation/automation_provider_observers.cc b/chrome/browser/automation/automation_provider_observers.cc index 004398b..2548595 100644 --- a/chrome/browser/automation/automation_provider_observers.cc +++ b/chrome/browser/automation/automation_provider_observers.cc @@ -68,6 +68,7 @@ #include "chrome/common/chrome_notification_types.h" #include "chrome/common/content_settings_types.h" #include "chrome/common/extensions/extension.h" +#include "chrome/common/extensions/manifest.h" #include "chrome/common/view_type.h" #include "content/public/browser/dom_operation_notification_details.h" #include "content/public/browser/navigation_controller.h" @@ -630,9 +631,9 @@ void ExtensionReadyNotificationObserver::Observe( const extensions::Extension* loaded_extension = content::Details<const extensions::Extension>(details).ptr(); // Only track an internal or unpacked extension load. - extensions::Extension::Location location = loaded_extension->location(); - if (location != extensions::Extension::INTERNAL && - location != extensions::Extension::LOAD) + extensions::Manifest::Location location = loaded_extension->location(); + if (location != extensions::Manifest::INTERNAL && + location != extensions::Manifest::LOAD) return; extension_ = loaded_extension; if (!DidExtensionViewsStopLoading(manager_)) @@ -1875,7 +1876,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() == extensions::Extension::COMPONENT); + (*ext)->location() == extensions::Manifest::COMPONENT); // Convert the launch_type integer into a more descriptive string. int launch_type; diff --git a/chrome/browser/automation/testing_automation_provider.cc b/chrome/browser/automation/testing_automation_provider.cc index 2918992..ab7a535 100644 --- a/chrome/browser/automation/testing_automation_provider.cc +++ b/chrome/browser/automation/testing_automation_provider.cc @@ -187,6 +187,7 @@ using content::WebContents; using extensions::Extension; using extensions::ExtensionActionManager; using extensions::ExtensionList; +using extensions::Manifest; namespace { @@ -3704,14 +3705,14 @@ void TestingAutomationProvider::GetExtensionsInfo(DictionaryValue* args, extension_value->Set("effective_host_permissions", GetHostPermissions(extension, true)); extension_value->Set("api_permissions", GetAPIPermissions(extension)); - Extension::Location location = extension->location(); + Manifest::Location location = extension->location(); extension_value->SetBoolean("is_component", - location == Extension::COMPONENT); + location == Manifest::COMPONENT); extension_value->SetBoolean("is_internal", - location == Extension::INTERNAL); + location == Manifest::INTERNAL); extension_value->SetBoolean("is_user_installed", - location == Extension::INTERNAL || - location == Extension::LOAD); + location == Manifest::INTERNAL || + location == Manifest::LOAD); extension_value->SetBoolean("is_enabled", service->IsExtensionEnabled(id)); extension_value->SetBoolean("allowed_in_incognito", service->IsIncognitoEnabled(id)); diff --git a/chrome/browser/background/background_application_list_model_unittest.cc b/chrome/browser/background/background_application_list_model_unittest.cc index ef775b8..9f8645d 100644 --- a/chrome/browser/background/background_application_list_model_unittest.cc +++ b/chrome/browser/background/background_application_list_model_unittest.cc @@ -73,7 +73,7 @@ static scoped_refptr<Extension> CreateExtension(const std::string& name, std::string error; scoped_refptr<Extension> extension = Extension::Create( bogus_file_path().AppendASCII(name), - Extension::INVALID, + extensions::Manifest::INVALID_LOCATION, manifest, Extension::NO_FLAGS, &error); diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc index ef20201..dbb93e23 100644 --- a/chrome/browser/chrome_content_browser_client.cc +++ b/chrome/browser/chrome_content_browser_client.cc @@ -165,6 +165,7 @@ using content::SiteInstance; using content::WebContents; using extensions::APIPermission; using extensions::Extension; +using extensions::Manifest; using webkit_glue::WebPreferences; namespace { @@ -795,7 +796,7 @@ bool ChromeContentBrowserClient::ShouldUseProcessPerSite( // permission, or that does not allow JavaScript access to the background // page, we want to give each instance its own process to improve // responsiveness. - if (extension->GetType() == Extension::TYPE_HOSTED_APP) { + if (extension->GetType() == Manifest::TYPE_HOSTED_APP) { if (!extension->HasAPIPermission(APIPermission::kBackground) || !extension->allow_background_js_access()) { return false; @@ -1919,8 +1920,8 @@ bool ChromeContentBrowserClient::AllowPepperSocketAPI( if (allowed_list == "*") { // The wildcard allows socket API only for packaged and platform apps. return extension && - (extension->GetType() == Extension::TYPE_LEGACY_PACKAGED_APP || - extension->GetType() == Extension::TYPE_PLATFORM_APP); + (extension->GetType() == Manifest::TYPE_LEGACY_PACKAGED_APP || + extension->GetType() == Manifest::TYPE_PLATFORM_APP); } else if (!allowed_list.empty()) { StringTokenizer t(allowed_list, ","); while (t.GetNext()) { diff --git a/chrome/browser/chromeos/enterprise_extension_observer.cc b/chrome/browser/chromeos/enterprise_extension_observer.cc index 740fc38..63ac62e 100644 --- a/chrome/browser/chromeos/enterprise_extension_observer.cc +++ b/chrome/browser/chromeos/enterprise_extension_observer.cc @@ -37,7 +37,7 @@ void EnterpriseExtensionObserver::Observe( extensions::Extension* extension = content::Details<extensions::Extension>(details).ptr(); if (extension->location() != - extensions::Extension::EXTERNAL_POLICY_DOWNLOAD) { + extensions::Manifest::EXTERNAL_POLICY_DOWNLOAD) { return; } BrowserThread::PostTask( diff --git a/chrome/browser/chromeos/extensions/file_browser_manifest_unittest.cc b/chrome/browser/chromeos/extensions/file_browser_manifest_unittest.cc index c846dca..fe40295 100644 --- a/chrome/browser/chromeos/extensions/file_browser_manifest_unittest.cc +++ b/chrome/browser/chromeos/extensions/file_browser_manifest_unittest.cc @@ -205,7 +205,7 @@ TEST_F(FileBrowserHandlerManifestTest, FileManagerURLOverride) { // A component extention can override chrome://files/ URL. std::string error; LoadExtension(Manifest(manifest_value.get(), "override_files"), - &error, Extension::COMPONENT, Extension::NO_FLAGS); + &error, extensions::Manifest::COMPONENT, Extension::NO_FLAGS); #if defined(FILE_MANAGER_EXTENSION) EXPECT_EQ("", error); #else diff --git a/chrome/browser/chromeos/extensions/file_browser_private_api.cc b/chrome/browser/chromeos/extensions/file_browser_private_api.cc index f2aadac..6a0227f 100644 --- a/chrome/browser/chromeos/extensions/file_browser_private_api.cc +++ b/chrome/browser/chromeos/extensions/file_browser_private_api.cc @@ -536,7 +536,7 @@ class RequestLocalFileSystemFunction::LocalFileSystemCallbackDispatcher { // Make sure that only component extension can access the entire // local file system. - if (extension_->location() != Extension::COMPONENT) { + if (extension_->location() != extensions::Manifest::COMPONENT) { NOTREACHED() << "Private method access by non-component extension " << extension_->id(); return false; diff --git a/chrome/browser/chromeos/kiosk_mode/kiosk_mode_screensaver.cc b/chrome/browser/chromeos/kiosk_mode/kiosk_mode_screensaver.cc index 2d6fe81..e54d254 100644 --- a/chrome/browser/chromeos/kiosk_mode/kiosk_mode_screensaver.cc +++ b/chrome/browser/chromeos/kiosk_mode/kiosk_mode_screensaver.cc @@ -96,7 +96,7 @@ void ScreensaverUnpackerClient::LoadScreensaverExtension( std::string error; scoped_refptr<Extension> screensaver_extension = extension_file_util::LoadExtension(screensaver_extension_path, - Extension::COMPONENT, + extensions::Manifest::COMPONENT, Extension::NO_FLAGS, &error); if (!screensaver_extension) { @@ -186,7 +186,7 @@ void KioskModeScreensaver::ScreensaverPathCallback( new SandboxedUnpacker( screensaver_crx, true, - Extension::COMPONENT, + extensions::Manifest::COMPONENT, Extension::NO_FLAGS, extensions_dir, content::BrowserThread::GetMessageLoopProxyForThread( diff --git a/chrome/browser/extensions/admin_policy.cc b/chrome/browser/extensions/admin_policy.cc index 064f0fc..2cdbcd5 100644 --- a/chrome/browser/extensions/admin_policy.cc +++ b/chrome/browser/extensions/admin_policy.cc @@ -6,6 +6,7 @@ #include "base/utf_string_conversions.h" #include "chrome/common/extensions/extension.h" +#include "chrome/common/extensions/manifest.h" #include "grit/generated_resources.h" #include "ui/base/l10n/l10n_util.h" @@ -15,8 +16,8 @@ bool ManagementPolicyImpl(const extensions::Extension* extension, string16* error, bool modifiable_value) { bool modifiable = - extension->location() != extensions::Extension::COMPONENT && - extension->location() != extensions::Extension::EXTERNAL_POLICY_DOWNLOAD; + extension->location() != extensions::Manifest::COMPONENT && + extension->location() != extensions::Manifest::EXTERNAL_POLICY_DOWNLOAD; // Some callers equate "no restriction" to true, others to false. if (modifiable) return modifiable_value; @@ -56,7 +57,7 @@ bool UserMayLoad(const base::ListValue* blacklist, const Extension* extension, string16* error) { // Component extensions are always allowed. - if (extension->location() == Extension::COMPONENT) + if (extension->location() == Manifest::COMPONENT) return true; // Early exit for the common case of no policy restrictions. @@ -71,14 +72,14 @@ bool UserMayLoad(const base::ListValue* blacklist, // branch to the second block and add a line to the definition of // kExtensionAllowedTypesMap in configuration_policy_handler_list.cc. switch (extension->GetType()) { - case Extension::TYPE_UNKNOWN: + case Manifest::TYPE_UNKNOWN: break; - case Extension::TYPE_EXTENSION: - case Extension::TYPE_THEME: - case Extension::TYPE_USER_SCRIPT: - case Extension::TYPE_HOSTED_APP: - case Extension::TYPE_LEGACY_PACKAGED_APP: - case Extension::TYPE_PLATFORM_APP: + case Manifest::TYPE_EXTENSION: + case Manifest::TYPE_THEME: + case Manifest::TYPE_USER_SCRIPT: + case Manifest::TYPE_HOSTED_APP: + case Manifest::TYPE_LEGACY_PACKAGED_APP: + case Manifest::TYPE_PLATFORM_APP: base::FundamentalValue type_value(extension->GetType()); if (allowed_types && allowed_types->Find(type_value) == allowed_types->end()) diff --git a/chrome/browser/extensions/admin_policy_unittest.cc b/chrome/browser/extensions/admin_policy_unittest.cc index b86e8f8..d74e361 100644 --- a/chrome/browser/extensions/admin_policy_unittest.cc +++ b/chrome/browser/extensions/admin_policy_unittest.cc @@ -7,21 +7,23 @@ #include "base/values.h" #include "chrome/common/extensions/extension.h" #include "chrome/common/extensions/extension_manifest_constants.h" +#include "chrome/common/extensions/manifest.h" #include "testing/gtest/include/gtest/gtest.h" using base::Value; using extensions::Extension; +using extensions::Manifest; namespace ap = extensions::admin_policy; class ExtensionAdminPolicyTest : public testing::Test { public: - void CreateExtension(Extension::Location location) { + void CreateExtension(Manifest::Location location) { base::DictionaryValue values; CreateExtensionFromValues(location, &values); } - void CreateHostedApp(Extension::Location location) { + void CreateHostedApp(Manifest::Location location) { base::DictionaryValue values; values.Set(extension_manifest_keys::kWebURLs, new base::ListValue()); values.SetString(extension_manifest_keys::kLaunchWebURL, @@ -29,7 +31,7 @@ class ExtensionAdminPolicyTest : public testing::Test { CreateExtensionFromValues(location, &values); } - void CreateExtensionFromValues(Extension::Location location, + void CreateExtensionFromValues(Manifest::Location location, base::DictionaryValue* values) { values->SetString(extension_manifest_keys::kName, "test"); values->SetString(extension_manifest_keys::kVersion, "0.1"); @@ -60,7 +62,7 @@ TEST_F(ExtensionAdminPolicyTest, BlacklistedByDefault) { // Tests UserMayLoad for required extensions. TEST_F(ExtensionAdminPolicyTest, UserMayLoadRequired) { - CreateExtension(Extension::COMPONENT); + CreateExtension(Manifest::COMPONENT); EXPECT_TRUE(ap::UserMayLoad(NULL, NULL, NULL, NULL, extension_.get(), NULL)); string16 error; EXPECT_TRUE(ap::UserMayLoad(NULL, NULL, NULL, NULL, extension_.get(), @@ -80,7 +82,7 @@ TEST_F(ExtensionAdminPolicyTest, UserMayLoadRequired) { // Tests UserMayLoad when no blacklist exists, or it's empty. TEST_F(ExtensionAdminPolicyTest, UserMayLoadNoBlacklist) { - CreateExtension(Extension::INTERNAL); + CreateExtension(Manifest::INTERNAL); EXPECT_TRUE(ap::UserMayLoad(NULL, NULL, NULL, NULL, extension_.get(), NULL)); base::ListValue blacklist; EXPECT_TRUE(ap::UserMayLoad(&blacklist, NULL, NULL, NULL, extension_.get(), @@ -93,7 +95,7 @@ TEST_F(ExtensionAdminPolicyTest, UserMayLoadNoBlacklist) { // Tests UserMayLoad for an extension on the whitelist. TEST_F(ExtensionAdminPolicyTest, UserMayLoadWhitelisted) { - CreateExtension(Extension::INTERNAL); + CreateExtension(Manifest::INTERNAL); base::ListValue whitelist; whitelist.Append(Value::CreateStringValue(extension_->id())); @@ -112,7 +114,7 @@ TEST_F(ExtensionAdminPolicyTest, UserMayLoadWhitelisted) { // Tests UserMayLoad for an extension on the blacklist. TEST_F(ExtensionAdminPolicyTest, UserMayLoadBlacklisted) { - CreateExtension(Extension::INTERNAL); + CreateExtension(Manifest::INTERNAL); // Blacklisted by default. base::ListValue blacklist; @@ -145,34 +147,34 @@ TEST_F(ExtensionAdminPolicyTest, UserMayLoadBlacklisted) { } TEST_F(ExtensionAdminPolicyTest, UserMayLoadAllowedTypes) { - CreateExtension(Extension::INTERNAL); + CreateExtension(Manifest::INTERNAL); EXPECT_TRUE(ap::UserMayLoad(NULL, NULL, NULL, NULL, extension_.get(), NULL)); base::ListValue allowed_types; EXPECT_FALSE(ap::UserMayLoad(NULL, NULL, NULL, &allowed_types, extension_.get(), NULL)); - allowed_types.AppendInteger(Extension::TYPE_EXTENSION); + allowed_types.AppendInteger(Manifest::TYPE_EXTENSION); EXPECT_TRUE(ap::UserMayLoad(NULL, NULL, NULL, &allowed_types, extension_.get(), NULL)); - CreateHostedApp(Extension::INTERNAL); + CreateHostedApp(Manifest::INTERNAL); EXPECT_FALSE(ap::UserMayLoad(NULL, NULL, NULL, &allowed_types, extension_.get(), NULL)); - CreateHostedApp(Extension::EXTERNAL_POLICY_DOWNLOAD); + CreateHostedApp(Manifest::EXTERNAL_POLICY_DOWNLOAD); EXPECT_FALSE(ap::UserMayLoad(NULL, NULL, NULL, &allowed_types, extension_.get(), NULL)); } TEST_F(ExtensionAdminPolicyTest, UserMayModifySettings) { - CreateExtension(Extension::INTERNAL); + CreateExtension(Manifest::INTERNAL); EXPECT_TRUE(ap::UserMayModifySettings(extension_.get(), NULL)); string16 error; EXPECT_TRUE(ap::UserMayModifySettings(extension_.get(), &error)); EXPECT_TRUE(error.empty()); - CreateExtension(Extension::EXTERNAL_POLICY_DOWNLOAD); + CreateExtension(Manifest::EXTERNAL_POLICY_DOWNLOAD); error.clear(); EXPECT_FALSE(ap::UserMayModifySettings(extension_.get(), NULL)); EXPECT_FALSE(ap::UserMayModifySettings(extension_.get(), &error)); @@ -180,13 +182,13 @@ TEST_F(ExtensionAdminPolicyTest, UserMayModifySettings) { } TEST_F(ExtensionAdminPolicyTest, MustRemainEnabled) { - CreateExtension(Extension::EXTERNAL_POLICY_DOWNLOAD); + CreateExtension(Manifest::EXTERNAL_POLICY_DOWNLOAD); EXPECT_TRUE(ap::MustRemainEnabled(extension_.get(), NULL)); string16 error; EXPECT_TRUE(ap::MustRemainEnabled(extension_.get(), &error)); EXPECT_FALSE(error.empty()); - CreateExtension(Extension::INTERNAL); + CreateExtension(Manifest::INTERNAL); error.clear(); EXPECT_FALSE(ap::MustRemainEnabled(extension_.get(), NULL)); EXPECT_FALSE(ap::MustRemainEnabled(extension_.get(), &error)); diff --git a/chrome/browser/extensions/api/alarms/alarms_api.cc b/chrome/browser/extensions/api/alarms/alarms_api.cc index fcd75dc..a87072f 100644 --- a/chrome/browser/extensions/api/alarms/alarms_api.cc +++ b/chrome/browser/extensions/api/alarms/alarms_api.cc @@ -52,7 +52,7 @@ bool ValidateAlarmCreateInfo(const std::string& alarm_name, if (create_info.delay_in_minutes.get()) { if (*create_info.delay_in_minutes < kReleaseDelayMinimum) { COMPILE_ASSERT(kReleaseDelayMinimum == 1, update_warning_message_below); - if (extension->location() == Extension::LOAD) + if (extension->location() == Manifest::LOAD) warnings->push_back(ErrorUtils::FormatErrorMessage( "Alarm delay is less than minimum of 1 minutes." " In released .crx, alarm \"*\" will fire in approximately" @@ -68,7 +68,7 @@ bool ValidateAlarmCreateInfo(const std::string& alarm_name, if (create_info.period_in_minutes.get()) { if (*create_info.period_in_minutes < kReleaseDelayMinimum) { COMPILE_ASSERT(kReleaseDelayMinimum == 1, update_warning_message_below); - if (extension->location() == Extension::LOAD) + if (extension->location() == Manifest::LOAD) warnings->push_back(ErrorUtils::FormatErrorMessage( "Alarm period is less than minimum of 1 minutes." " In released .crx, alarm \"*\" will fire approximately" @@ -108,7 +108,7 @@ bool AlarmsCreateFunction::RunImpl() { Alarm alarm(alarm_name, params->alarm_info, base::TimeDelta::FromMinutes( - GetExtension()->location() == Extension::LOAD ? + GetExtension()->location() == Manifest::LOAD ? kDevDelayMinimum : kReleaseDelayMinimum), now_); ExtensionSystem::Get(profile())->alarm_manager()->AddAlarm( diff --git a/chrome/browser/extensions/api/alarms/alarms_api_unittest.cc b/chrome/browser/extensions/api/alarms/alarms_api_unittest.cc index 84036e2..f96a6d8 100644 --- a/chrome/browser/extensions/api/alarms/alarms_api_unittest.cc +++ b/chrome/browser/extensions/api/alarms/alarms_api_unittest.cc @@ -58,7 +58,7 @@ class ExtensionAlarmsTest : public BrowserWithTestWindowTest { alarm_manager_->set_delegate(alarm_delegate_); extension_ = utils::CreateEmptyExtensionWithLocation( - extensions::Extension::LOAD); + extensions::Manifest::LOAD); // Make sure there's a RenderViewHost for alarms to warn into. AddTab(browser(), extension_->GetBackgroundURL()); @@ -491,7 +491,7 @@ TEST_F(ExtensionAlarmsSchedulingTest, PollScheduling) { TEST_F(ExtensionAlarmsSchedulingTest, ReleasedExtensionPollsInfrequently) { extension_ = utils::CreateEmptyExtensionWithLocation( - extensions::Extension::INTERNAL); + extensions::Manifest::INTERNAL); current_time_ = base::Time::FromJsTime(300000); CreateAlarm("[\"a\", {\"when\": 300010}]"); CreateAlarm("[\"b\", {\"when\": 340000}]"); diff --git a/chrome/browser/extensions/api/app_window/app_window_api.cc b/chrome/browser/extensions/api/app_window/app_window_api.cc index d41f9f9..b9c62c0 100644 --- a/chrome/browser/extensions/api/app_window/app_window_api.cc +++ b/chrome/browser/extensions/api/app_window/app_window_api.cc @@ -88,7 +88,7 @@ bool AppWindowCreateFunction::RunImpl() { GURL url = GetExtension()->GetResourceURL(params->url); // Allow absolute URLs for component apps, otherwise prepend the extension // path. - if (GetExtension()->location() == extensions::Extension::COMPONENT) { + if (GetExtension()->location() == extensions::Manifest::COMPONENT) { GURL absolute = GURL(params->url); if (absolute.has_scheme()) url = absolute; diff --git a/chrome/browser/extensions/api/developer_private/developer_private_api.cc b/chrome/browser/extensions/api/developer_private/developer_private_api.cc index 826a4ba..9eefa68 100644 --- a/chrome/browser/extensions/api/developer_private/developer_private_api.cc +++ b/chrome/browser/extensions/api/developer_private/developer_private_api.cc @@ -142,7 +142,7 @@ scoped_ptr<developer::ItemInfo> NOTREACHED(); } - if (item.location() == Extension::LOAD) { + if (item.location() == Manifest::LOAD) { info->path.reset( new std::string(UTF16ToUTF8(item.path().LossyDisplayName()))); } @@ -150,8 +150,8 @@ scoped_ptr<developer::ItemInfo> info->incognito_enabled = service->IsIncognitoEnabled(item.id()); info->wants_file_access = item.wants_file_access(); info->allow_file_access = service->AllowFileAccess(&item); - info->allow_reload = (item.location() == Extension::LOAD); - info->is_unpacked = (item.location() == Extension::LOAD); + info->allow_reload = (item.location() == Manifest::LOAD); + info->is_unpacked = (item.location() == Manifest::LOAD); info->terminated = service->terminated_extensions()->Contains(item.id()); info->allow_incognito = item.can_be_incognito_enabled(); @@ -195,7 +195,7 @@ void DeveloperPrivateGetItemsInfoFunction::AddItemsInfo( for (ExtensionSet::const_iterator iter = items.begin(); iter != items.end(); ++iter) { const Extension& item = **iter; - if (item.location() == Extension::COMPONENT) + if (item.location() == Manifest::COMPONENT) continue; // Skip built-in extensions / apps; item_list->push_back(make_linked_ptr<developer::ItemInfo>( CreateItemInfo(item, system, false).release())); diff --git a/chrome/browser/extensions/api/developer_private/developer_private_apitest.cc b/chrome/browser/extensions/api/developer_private/developer_private_apitest.cc index 3864e7c..52ec426 100644 --- a/chrome/browser/extensions/api/developer_private/developer_private_apitest.cc +++ b/chrome/browser/extensions/api/developer_private/developer_private_apitest.cc @@ -32,7 +32,7 @@ class DeveloperPrivateApiTest : public ExtensionApiTest { void InstallNamedExtension(const FilePath& path, const std::string& name, - Extension::Location install_source) { + Manifest::Location install_source) { const Extension* extension = InstallExtension(path.AppendASCII(name), 1, install_source); ASSERT_TRUE(extension); @@ -46,9 +46,9 @@ IN_PROC_BROWSER_TEST_F(DeveloperPrivateApiTest, Basics) { LoadExtensions(); FilePath basedir = test_data_dir_.AppendASCII("developer"); - InstallNamedExtension(basedir, "packaged_app", Extension::INTERNAL); + InstallNamedExtension(basedir, "packaged_app", Manifest::INTERNAL); - InstallNamedExtension(basedir, "simple_extension", Extension::INTERNAL); + InstallNamedExtension(basedir, "simple_extension", Manifest::INTERNAL); ASSERT_TRUE(RunExtensionSubtest( "developer/test", "basics.html", kFlagLoadAsComponent)); diff --git a/chrome/browser/extensions/api/discovery/discovery_api_unittest.cc b/chrome/browser/extensions/api/discovery/discovery_api_unittest.cc index 4e8d73b..5550383 100644 --- a/chrome/browser/extensions/api/discovery/discovery_api_unittest.cc +++ b/chrome/browser/extensions/api/discovery/discovery_api_unittest.cc @@ -71,7 +71,7 @@ class ExtensionDiscoveryTest : public BrowserWithTestWindowTest { public: virtual void SetUp() { BrowserWithTestWindowTest::SetUp(); - extension_ = utils::CreateEmptyExtensionWithLocation(Extension::LOAD); + extension_ = utils::CreateEmptyExtensionWithLocation(Manifest::LOAD); } // Runs a function and returns a pointer to a value, transferring ownership. diff --git a/chrome/browser/extensions/api/idle/idle_api_unittest.cc b/chrome/browser/extensions/api/idle/idle_api_unittest.cc index 156dae4..4fc7b1bd 100644 --- a/chrome/browser/extensions/api/idle/idle_api_unittest.cc +++ b/chrome/browser/extensions/api/idle/idle_api_unittest.cc @@ -144,7 +144,7 @@ void IdleTest::SetUp() { idle_manager_ = IdleManagerFactory::GetForProfile(browser()->profile()); extension_ = utils::CreateEmptyExtensionWithLocation( - extensions::Extension::LOAD); + extensions::Manifest::LOAD); idle_provider_ = new TestIdleProvider(); idle_manager_->SetIdleTimeProviderForTest( diff --git a/chrome/browser/extensions/api/management/management_api.cc b/chrome/browser/extensions/api/management/management_api.cc index 409b44d..b11f7a9 100644 --- a/chrome/browser/extensions/api/management/management_api.cc +++ b/chrome/browser/extensions/api/management/management_api.cc @@ -174,18 +174,18 @@ scoped_ptr<management::ExtensionInfo> CreateExtensionInfo( } switch (extension.location()) { - case Extension::INTERNAL: + case Manifest::INTERNAL: info->install_type = management::ExtensionInfo::INSTALL_TYPE_NORMAL; break; - case Extension::LOAD: + case Manifest::LOAD: info->install_type = management::ExtensionInfo::INSTALL_TYPE_DEVELOPMENT; break; - case Extension::EXTERNAL_PREF: - case Extension::EXTERNAL_REGISTRY: - case Extension::EXTERNAL_PREF_DOWNLOAD: + case Manifest::EXTERNAL_PREF: + case Manifest::EXTERNAL_REGISTRY: + case Manifest::EXTERNAL_PREF_DOWNLOAD: info->install_type = management::ExtensionInfo::INSTALL_TYPE_SIDELOAD; break; - case Extension::EXTERNAL_POLICY_DOWNLOAD: + case Manifest::EXTERNAL_POLICY_DOWNLOAD: info->install_type = management::ExtensionInfo::INSTALL_TYPE_ADMIN; break; default: @@ -203,7 +203,7 @@ void AddExtensionInfo(const ExtensionSet& extensions, iter != extensions.end(); ++iter) { const Extension& extension = **iter; - if (extension.location() == Extension::COMPONENT) + if (extension.location() == Manifest::COMPONENT) continue; // Skip built-in extensions. extension_list->push_back(make_linked_ptr<management::ExtensionInfo>( @@ -382,8 +382,8 @@ void ManagementGetPermissionWarningsByManifestFunction::OnParseSuccess( CHECK(parsed_manifest); scoped_refptr<Extension> extension = Extension::Create( - FilePath(), Extension::INVALID, *parsed_manifest, Extension::NO_FLAGS, - &error_); + FilePath(), Manifest::INVALID_LOCATION, *parsed_manifest, + Extension::NO_FLAGS, &error_); if (!extension.get()) { OnParseFailure(keys::kExtensionCreateError); return; diff --git a/chrome/browser/extensions/api/management/management_apitest.cc b/chrome/browser/extensions/api/management/management_apitest.cc index b1161d5..cdaf59b 100644 --- a/chrome/browser/extensions/api/management/management_apitest.cc +++ b/chrome/browser/extensions/api/management/management_apitest.cc @@ -86,7 +86,7 @@ class ExtensionManagementApiTest : public ExtensionApiTest { void InstallNamedExtension(const FilePath& path, const std::string& name, - Extension::Location install_source) { + Manifest::Location install_source) { const Extension* extension = InstallExtension(path.AppendASCII(name), 1, install_source); ASSERT_TRUE(extension); @@ -101,11 +101,11 @@ IN_PROC_BROWSER_TEST_F(ExtensionManagementApiTest, Basics) { LoadExtensions(); FilePath basedir = test_data_dir_.AppendASCII("management"); - InstallNamedExtension(basedir, "internal_extension", Extension::INTERNAL); + InstallNamedExtension(basedir, "internal_extension", Manifest::INTERNAL); InstallNamedExtension(basedir, "external_extension", - Extension::EXTERNAL_PREF); + Manifest::EXTERNAL_PREF); InstallNamedExtension(basedir, "admin_extension", - Extension::EXTERNAL_POLICY_DOWNLOAD); + Manifest::EXTERNAL_POLICY_DOWNLOAD); ASSERT_TRUE(RunExtensionSubtest("management/test", "basics.html")); } diff --git a/chrome/browser/extensions/api/management/management_browsertest.cc b/chrome/browser/extensions/api/management/management_browsertest.cc index 2464153..e0a870b 100644 --- a/chrome/browser/extensions/api/management/management_browsertest.cc +++ b/chrome/browser/extensions/api/management/management_browsertest.cc @@ -29,6 +29,7 @@ #include "net/url_request/url_fetcher.h" using extensions::Extension; +using extensions::Manifest; class ExtensionManagementTest : public ExtensionBrowserTest { protected: @@ -433,7 +434,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionManagementTest, MAYBE_ExternalUrlUpdate) { EXPECT_TRUE(pending_extension_manager->AddFromExternalUpdateUrl( kExtensionId, GURL("http://localhost/autoupdate/manifest"), - Extension::EXTERNAL_PREF_DOWNLOAD)); + Manifest::EXTERNAL_PREF_DOWNLOAD)); // Run autoupdate and make sure version 2 of the extension was installed. service->updater()->CheckNow(params); @@ -456,7 +457,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionManagementTest, MAYBE_ExternalUrlUpdate) { // because of the killbit. EXPECT_FALSE(pending_extension_manager->AddFromExternalUpdateUrl( kExtensionId, GURL("http://localhost/autoupdate/manifest"), - Extension::EXTERNAL_PREF_DOWNLOAD)); + Manifest::EXTERNAL_PREF_DOWNLOAD)); EXPECT_FALSE(pending_extension_manager->IsIdPending(kExtensionId)) << "External reinstall of a killed extension shouldn't work."; EXPECT_TRUE(extension_prefs->IsExternalExtensionUninstalled(kExtensionId)) @@ -528,7 +529,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionManagementTest, ExternalPolicyRefresh) { const Extension* extension = service->GetExtensionById(kExtensionId, false); ASSERT_TRUE(extension); ASSERT_EQ("2.0", extension->VersionString()); - EXPECT_EQ(Extension::EXTERNAL_POLICY_DOWNLOAD, extension->location()); + EXPECT_EQ(Manifest::EXTERNAL_POLICY_DOWNLOAD, extension->location()); // Try to disable and uninstall the extension which should fail. DisableExtension(kExtensionId); @@ -592,7 +593,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionManagementTest, ASSERT_EQ(size_before + 1, service->extensions()->size()); const Extension* extension = service->GetExtensionById(kExtensionId, false); ASSERT_TRUE(extension); - EXPECT_EQ(Extension::INTERNAL, extension->location()); + EXPECT_EQ(Manifest::INTERNAL, extension->location()); EXPECT_TRUE(service->IsExtensionEnabled(kExtensionId)); // Setup the force install policy. It should override the location. @@ -606,7 +607,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionManagementTest, ASSERT_EQ(size_before + 1, service->extensions()->size()); extension = service->GetExtensionById(kExtensionId, false); ASSERT_TRUE(extension); - EXPECT_EQ(Extension::EXTERNAL_POLICY_DOWNLOAD, extension->location()); + EXPECT_EQ(Manifest::EXTERNAL_POLICY_DOWNLOAD, extension->location()); EXPECT_TRUE(service->IsExtensionEnabled(kExtensionId)); // Remove the policy, and verify that the extension was uninstalled. @@ -623,7 +624,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionManagementTest, ASSERT_EQ(size_before + 1, service->extensions()->size()); extension = service->GetExtensionById(kExtensionId, false); ASSERT_TRUE(extension); - EXPECT_EQ(Extension::INTERNAL, extension->location()); + EXPECT_EQ(Manifest::INTERNAL, extension->location()); EXPECT_TRUE(service->IsExtensionEnabled(kExtensionId)); EXPECT_TRUE(service->disabled_extensions()->is_empty()); @@ -645,7 +646,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionManagementTest, ASSERT_EQ(size_before + 1, service->extensions()->size()); extension = service->GetExtensionById(kExtensionId, false); ASSERT_TRUE(extension); - EXPECT_EQ(Extension::EXTERNAL_POLICY_DOWNLOAD, extension->location()); + EXPECT_EQ(Manifest::EXTERNAL_POLICY_DOWNLOAD, extension->location()); EXPECT_TRUE(service->IsExtensionEnabled(kExtensionId)); EXPECT_TRUE(service->disabled_extensions()->is_empty()); } diff --git a/chrome/browser/extensions/api/messaging/native_message_process_host_unittest_posix.cc b/chrome/browser/extensions/api/messaging/native_message_process_host_unittest_posix.cc index 04789a8..886a643 100644 --- a/chrome/browser/extensions/api/messaging/native_message_process_host_unittest_posix.cc +++ b/chrome/browser/extensions/api/messaging/native_message_process_host_unittest_posix.cc @@ -19,6 +19,7 @@ #include "chrome/common/chrome_paths.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/chrome_version_info.h" +#include "chrome/common/extensions/extension.h" #include "chrome/common/extensions/features/feature.h" #include "content/public/browser/browser_thread.h" #include "content/public/test/test_browser_thread.h" diff --git a/chrome/browser/extensions/api/socket/socket_api_unittest.cc b/chrome/browser/extensions/api/socket/socket_api_unittest.cc index 87028c2..d3c7eab 100644 --- a/chrome/browser/extensions/api/socket/socket_api_unittest.cc +++ b/chrome/browser/extensions/api/socket/socket_api_unittest.cc @@ -27,7 +27,7 @@ class SocketUnitTest : public BrowserWithTestWindowTest { system->CreateSocketManager(); extension_ = utils::CreateEmptyExtensionWithLocation( - extensions::Extension::LOAD); + extensions::Manifest::LOAD); } base::Value* RunFunctionWithExtension( diff --git a/chrome/browser/extensions/api/storage/settings_frontend_unittest.cc b/chrome/browser/extensions/api/storage/settings_frontend_unittest.cc index 07a473d..0bd7f45 100644 --- a/chrome/browser/extensions/api/storage/settings_frontend_unittest.cc +++ b/chrome/browser/extensions/api/storage/settings_frontend_unittest.cc @@ -96,7 +96,7 @@ TEST_F(ExtensionSettingsFrontendTest, SettingsPreservedAcrossReconstruction) { ExtensionServiceInterface* esi = extensions::ExtensionSystem::Get(profile_.get())->extension_service(); static_cast<extensions::settings_test_util::MockExtensionService*>(esi)-> - AddExtensionWithId(id, Extension::TYPE_EXTENSION); + AddExtensionWithId(id, Manifest::TYPE_EXTENSION); ValueStore* storage = util::GetStorage(id, frontend_.get()); @@ -129,7 +129,7 @@ TEST_F(ExtensionSettingsFrontendTest, SettingsClearedOnUninstall) { ExtensionServiceInterface* esi = extensions::ExtensionSystem::Get(profile_.get())->extension_service(); static_cast<extensions::settings_test_util::MockExtensionService*>(esi)-> - AddExtensionWithId(id, Extension::TYPE_LEGACY_PACKAGED_APP); + AddExtensionWithId(id, Manifest::TYPE_LEGACY_PACKAGED_APP); ValueStore* storage = util::GetStorage(id, frontend_.get()); @@ -157,7 +157,7 @@ TEST_F(ExtensionSettingsFrontendTest, LeveldbDatabaseDeletedFromDiskOnClear) { ExtensionServiceInterface* esi = extensions::ExtensionSystem::Get(profile_.get())->extension_service(); static_cast<extensions::settings_test_util::MockExtensionService*>(esi)-> - AddExtensionWithId(id, Extension::TYPE_EXTENSION); + AddExtensionWithId(id, Manifest::TYPE_EXTENSION); ValueStore* storage = util::GetStorage(id, frontend_.get()); @@ -195,7 +195,7 @@ TEST_F(ExtensionSettingsFrontendTest, ExtensionServiceInterface* esi = extensions::ExtensionSystem::Get(profile_.get())->extension_service(); static_cast<extensions::settings_test_util::MockExtensionService*>(esi)-> - AddExtensionWithId(id, Extension::TYPE_EXTENSION); + AddExtensionWithId(id, Manifest::TYPE_EXTENSION); ValueStore* sync_storage = util::GetStorage(id, settings::SYNC, frontend_.get()); @@ -274,7 +274,7 @@ TEST_F(ExtensionSettingsFrontendTest, ExtensionServiceInterface* esi = extensions::ExtensionSystem::Get(profile_.get())->extension_service(); static_cast<extensions::settings_test_util::MockExtensionService*>(esi)-> - AddExtensionWithIdAndPermissions(id, Extension::TYPE_EXTENSION, + AddExtensionWithIdAndPermissions(id, Manifest::TYPE_EXTENSION, permissions); frontend_->RunWithStorage( diff --git a/chrome/browser/extensions/api/storage/settings_sync_unittest.cc b/chrome/browser/extensions/api/storage/settings_sync_unittest.cc index f8d65f0..2306afb 100644 --- a/chrome/browser/extensions/api/storage/settings_sync_unittest.cc +++ b/chrome/browser/extensions/api/storage/settings_sync_unittest.cc @@ -17,6 +17,7 @@ #include "chrome/browser/extensions/extension_system.h" #include "chrome/browser/extensions/test_extension_service.h" #include "chrome/browser/value_store/testing_value_store.h" +#include "chrome/common/extensions/manifest.h" #include "content/public/test/test_browser_thread.h" #include "sync/api/sync_change_processor.h" #include "sync/api/sync_error_factory.h" @@ -225,7 +226,7 @@ class ExtensionSettingsSyncTest : public testing::Test { // Adds a record of an extension or app to the extension service, then returns // its storage area. ValueStore* AddExtensionAndGetStorage( - const std::string& id, Extension::Type type) { + const std::string& id, Manifest::Type type) { ExtensionServiceInterface* esi = extensions::ExtensionSystem::Get(profile_.get())->extension_service(); static_cast<extensions::settings_test_util::MockExtensionService*>(esi)-> @@ -272,7 +273,7 @@ class ExtensionSettingsSyncTest : public testing::Test { TEST_F(ExtensionSettingsSyncTest, NoDataDoesNotInvokeSync) { syncer::ModelType model_type = syncer::EXTENSION_SETTINGS; - Extension::Type type = Extension::TYPE_EXTENSION; + Manifest::Type type = Manifest::TYPE_EXTENSION; EXPECT_EQ(0u, GetAllSyncData(model_type).size()); @@ -297,7 +298,7 @@ TEST_F(ExtensionSettingsSyncTest, NoDataDoesNotInvokeSync) { TEST_F(ExtensionSettingsSyncTest, InSyncDataDoesNotInvokeSync) { syncer::ModelType model_type = syncer::APP_SETTINGS; - Extension::Type type = Extension::TYPE_LEGACY_PACKAGED_APP; + Manifest::Type type = Manifest::TYPE_LEGACY_PACKAGED_APP; StringValue value1("fooValue"); ListValue value2; @@ -347,7 +348,7 @@ TEST_F(ExtensionSettingsSyncTest, InSyncDataDoesNotInvokeSync) { TEST_F(ExtensionSettingsSyncTest, LocalDataWithNoSyncDataIsPushedToSync) { syncer::ModelType model_type = syncer::EXTENSION_SETTINGS; - Extension::Type type = Extension::TYPE_EXTENSION; + Manifest::Type type = Manifest::TYPE_EXTENSION; StringValue value1("fooValue"); ListValue value2; @@ -379,7 +380,7 @@ TEST_F(ExtensionSettingsSyncTest, LocalDataWithNoSyncDataIsPushedToSync) { TEST_F(ExtensionSettingsSyncTest, AnySyncDataOverwritesLocalData) { syncer::ModelType model_type = syncer::APP_SETTINGS; - Extension::Type type = Extension::TYPE_LEGACY_PACKAGED_APP; + Manifest::Type type = Manifest::TYPE_LEGACY_PACKAGED_APP; StringValue value1("fooValue"); ListValue value2; @@ -419,7 +420,7 @@ TEST_F(ExtensionSettingsSyncTest, AnySyncDataOverwritesLocalData) { TEST_F(ExtensionSettingsSyncTest, ProcessSyncChanges) { syncer::ModelType model_type = syncer::EXTENSION_SETTINGS; - Extension::Type type = Extension::TYPE_EXTENSION; + Manifest::Type type = Manifest::TYPE_EXTENSION; StringValue value1("fooValue"); ListValue value2; @@ -492,7 +493,7 @@ TEST_F(ExtensionSettingsSyncTest, ProcessSyncChanges) { TEST_F(ExtensionSettingsSyncTest, PushToSync) { syncer::ModelType model_type = syncer::APP_SETTINGS; - Extension::Type type = Extension::TYPE_LEGACY_PACKAGED_APP; + Manifest::Type type = Manifest::TYPE_LEGACY_PACKAGED_APP; StringValue value1("fooValue"); ListValue value2; @@ -639,9 +640,9 @@ TEST_F(ExtensionSettingsSyncTest, ExtensionAndAppSettingsSyncSeparately) { // storage1 is an extension, storage2 is an app. ValueStore* storage1 = AddExtensionAndGetStorage( - "s1", Extension::TYPE_EXTENSION); + "s1", Manifest::TYPE_EXTENSION); ValueStore* storage2 = AddExtensionAndGetStorage( - "s2", Extension::TYPE_LEGACY_PACKAGED_APP); + "s2", Manifest::TYPE_LEGACY_PACKAGED_APP); storage1->Set(DEFAULTS, "foo", value1); storage2->Set(DEFAULTS, "bar", value2); @@ -690,7 +691,7 @@ TEST_F(ExtensionSettingsSyncTest, ExtensionAndAppSettingsSyncSeparately) { TEST_F(ExtensionSettingsSyncTest, FailingStartSyncingDisablesSync) { syncer::ModelType model_type = syncer::EXTENSION_SETTINGS; - Extension::Type type = Extension::TYPE_EXTENSION; + Manifest::Type type = Manifest::TYPE_EXTENSION; StringValue fooValue("fooValue"); StringValue barValue("barValue"); @@ -890,7 +891,7 @@ TEST_F(ExtensionSettingsSyncTest, FailingProcessChangesDisablesSync) { // The test above tests a failing ProcessSyncChanges too, but here test with // an initially passing MergeDataAndStartSyncing. syncer::ModelType model_type = syncer::APP_SETTINGS; - Extension::Type type = Extension::TYPE_LEGACY_PACKAGED_APP; + Manifest::Type type = Manifest::TYPE_LEGACY_PACKAGED_APP; StringValue fooValue("fooValue"); StringValue barValue("barValue"); @@ -988,7 +989,7 @@ TEST_F(ExtensionSettingsSyncTest, FailingProcessChangesDisablesSync) { TEST_F(ExtensionSettingsSyncTest, FailingGetAllSyncDataDoesntStopSync) { syncer::ModelType model_type = syncer::EXTENSION_SETTINGS; - Extension::Type type = Extension::TYPE_EXTENSION; + Manifest::Type type = Manifest::TYPE_EXTENSION; StringValue fooValue("fooValue"); StringValue barValue("barValue"); @@ -1043,7 +1044,7 @@ TEST_F(ExtensionSettingsSyncTest, FailingGetAllSyncDataDoesntStopSync) { TEST_F(ExtensionSettingsSyncTest, FailureToReadChangesToPushDisablesSync) { syncer::ModelType model_type = syncer::APP_SETTINGS; - Extension::Type type = Extension::TYPE_LEGACY_PACKAGED_APP; + Manifest::Type type = Manifest::TYPE_LEGACY_PACKAGED_APP; StringValue fooValue("fooValue"); StringValue barValue("barValue"); @@ -1147,7 +1148,7 @@ TEST_F(ExtensionSettingsSyncTest, FailureToReadChangesToPushDisablesSync) { TEST_F(ExtensionSettingsSyncTest, FailureToPushLocalStateDisablesSync) { syncer::ModelType model_type = syncer::EXTENSION_SETTINGS; - Extension::Type type = Extension::TYPE_EXTENSION; + Manifest::Type type = Manifest::TYPE_EXTENSION; StringValue fooValue("fooValue"); StringValue barValue("barValue"); @@ -1238,7 +1239,7 @@ TEST_F(ExtensionSettingsSyncTest, FailureToPushLocalStateDisablesSync) { TEST_F(ExtensionSettingsSyncTest, FailureToPushLocalChangeDisablesSync) { syncer::ModelType model_type = syncer::EXTENSION_SETTINGS; - Extension::Type type = Extension::TYPE_EXTENSION; + Manifest::Type type = Manifest::TYPE_EXTENSION; StringValue fooValue("fooValue"); StringValue barValue("barValue"); @@ -1336,7 +1337,7 @@ TEST_F(ExtensionSettingsSyncTest, FailureToPushLocalChangeDisablesSync) { TEST_F(ExtensionSettingsSyncTest, LargeOutgoingChangeRejectedButIncomingAccepted) { syncer::ModelType model_type = syncer::APP_SETTINGS; - Extension::Type type = Extension::TYPE_LEGACY_PACKAGED_APP; + Manifest::Type type = Manifest::TYPE_LEGACY_PACKAGED_APP; // This value should be larger than the limit in settings_backend.cc. std::string string_5k; @@ -1378,7 +1379,7 @@ TEST_F(ExtensionSettingsSyncTest, TEST_F(ExtensionSettingsSyncTest, Dots) { syncer::ModelType model_type = syncer::EXTENSION_SETTINGS; - Extension::Type type = Extension::TYPE_EXTENSION; + Manifest::Type type = Manifest::TYPE_EXTENSION; ValueStore* storage = AddExtensionAndGetStorage("ext", type); diff --git a/chrome/browser/extensions/api/storage/settings_test_util.cc b/chrome/browser/extensions/api/storage/settings_test_util.cc index bd90ae9..6c156f1 100644 --- a/chrome/browser/extensions/api/storage/settings_test_util.cc +++ b/chrome/browser/extensions/api/storage/settings_test_util.cc @@ -51,14 +51,14 @@ const Extension* MockExtensionService::GetExtensionById( } void MockExtensionService::AddExtensionWithId( - const std::string& id, Extension::Type type) { + const std::string& id, Manifest::Type type) { std::set<std::string> empty_permissions; AddExtensionWithIdAndPermissions(id, type, empty_permissions); } void MockExtensionService::AddExtensionWithIdAndPermissions( const std::string& id, - Extension::Type type, + Manifest::Type type, const std::set<std::string>& permissions_set) { DictionaryValue manifest; manifest.SetString("name", std::string("Test extension ") + id); @@ -72,10 +72,10 @@ void MockExtensionService::AddExtensionWithIdAndPermissions( manifest.Set("permissions", permissions.release()); switch (type) { - case Extension::TYPE_EXTENSION: + case Manifest::TYPE_EXTENSION: break; - case Extension::TYPE_LEGACY_PACKAGED_APP: { + case Manifest::TYPE_LEGACY_PACKAGED_APP: { DictionaryValue* app = new DictionaryValue(); DictionaryValue* app_launch = new DictionaryValue(); app_launch->SetString("local_path", "fake.html"); @@ -91,7 +91,7 @@ void MockExtensionService::AddExtensionWithIdAndPermissions( std::string error; scoped_refptr<Extension> extension(Extension::Create( FilePath(), - Extension::INTERNAL, + Manifest::INTERNAL, manifest, Extension::NO_FLAGS, id, diff --git a/chrome/browser/extensions/api/storage/settings_test_util.h b/chrome/browser/extensions/api/storage/settings_test_util.h index ee85b4e..43922b3 100644 --- a/chrome/browser/extensions/api/storage/settings_test_util.h +++ b/chrome/browser/extensions/api/storage/settings_test_util.h @@ -48,13 +48,13 @@ class MockExtensionService : public TestExtensionService { virtual ~MockExtensionService(); // Adds an extension with id |id| to be returned by GetExtensionById. - void AddExtensionWithId(const std::string& id, Extension::Type type); + void AddExtensionWithId(const std::string& id, Manifest::Type type); // Adds an extension with id |id| to be returned by GetExtensionById, with // a set of permissions. void AddExtensionWithIdAndPermissions( const std::string& id, - Extension::Type type, + Manifest::Type type, const std::set<std::string>& permissions); virtual const Extension* GetExtensionById( diff --git a/chrome/browser/extensions/app_process_apitest.cc b/chrome/browser/extensions/app_process_apitest.cc index b059301..3152b4e 100644 --- a/chrome/browser/extensions/app_process_apitest.cc +++ b/chrome/browser/extensions/app_process_apitest.cc @@ -287,7 +287,7 @@ IN_PROC_BROWSER_TEST_F(AppApiTest, BookmarkAppGetsNormalProcess) { std::string error; scoped_refptr<const Extension> extension(extension_file_util::LoadExtension( test_data_dir_.AppendASCII("app_process"), - Extension::LOAD, + extensions::Manifest::LOAD, Extension::FROM_BOOKMARK, &error)); service->OnExtensionInstalled(extension, diff --git a/chrome/browser/extensions/app_shortcut_manager.cc b/chrome/browser/extensions/app_shortcut_manager.cc index 195aaa3..ea467f0 100644 --- a/chrome/browser/extensions/app_shortcut_manager.cc +++ b/chrome/browser/extensions/app_shortcut_manager.cc @@ -69,7 +69,7 @@ void AppShortcutManager::Observe(int type, const Extension* extension = content::Details<const Extension>( details).ptr(); if (extension->is_platform_app() && - extension->location() != Extension::COMPONENT) { + extension->location() != Manifest::COMPONENT) { #if defined(OS_WIN) if (BrowserDistribution::GetDistribution()->AppHostIsSupported() && extensions::AppHostInstaller::GetInstallWithLauncher()) { diff --git a/chrome/browser/extensions/bundle_installer.cc b/chrome/browser/extensions/bundle_installer.cc index c216cc9..1c43557 100644 --- a/chrome/browser/extensions/bundle_installer.cc +++ b/chrome/browser/extensions/bundle_installer.cc @@ -51,7 +51,7 @@ scoped_refptr<Extension> CreateDummyExtension(const BundleInstaller::Item& item, std::string error; return Extension::Create(FilePath(), - Extension::INTERNAL, + Manifest::INTERNAL, *manifest, Extension::NO_FLAGS, item.id, diff --git a/chrome/browser/extensions/component_loader.cc b/chrome/browser/extensions/component_loader.cc index 0de58ca..53e7e73 100644 --- a/chrome/browser/extensions/component_loader.cc +++ b/chrome/browser/extensions/component_loader.cc @@ -182,7 +182,7 @@ void ComponentLoader::Load(const ComponentExtensionInfo& info) { scoped_refptr<const Extension> extension(Extension::Create( info.root_directory, - Extension::COMPONENT, + Manifest::COMPONENT, *info.manifest, flags, &error)); diff --git a/chrome/browser/extensions/component_loader.h b/chrome/browser/extensions/component_loader.h index 54ac3d8..37df8f0 100644 --- a/chrome/browser/extensions/component_loader.h +++ b/chrome/browser/extensions/component_loader.h @@ -135,7 +135,7 @@ class ComponentLoader { ExtensionServiceInterface* extension_service_; - // List of registered component extensions (see Extension::Location). + // List of registered component extensions (see Manifest::Location). typedef std::vector<ComponentExtensionInfo> RegisteredComponentExtensions; RegisteredComponentExtensions component_extensions_; diff --git a/chrome/browser/extensions/convert_user_script.cc b/chrome/browser/extensions/convert_user_script.cc index 5f85f5c..4115b0d 100644 --- a/chrome/browser/extensions/convert_user_script.cc +++ b/chrome/browser/extensions/convert_user_script.cc @@ -175,7 +175,7 @@ scoped_refptr<Extension> ConvertUserScriptToExtension( std::string utf8_error; scoped_refptr<Extension> extension = Extension::Create( temp_dir.path(), - Extension::INTERNAL, + Manifest::INTERNAL, *root, Extension::NO_FLAGS, &utf8_error); diff --git a/chrome/browser/extensions/convert_web_app.cc b/chrome/browser/extensions/convert_web_app.cc index 497297d..f1d8960 100644 --- a/chrome/browser/extensions/convert_web_app.cc +++ b/chrome/browser/extensions/convert_web_app.cc @@ -186,7 +186,7 @@ scoped_refptr<Extension> ConvertWebAppToExtension( extension_flags |= Extension::FROM_BOOKMARK; scoped_refptr<Extension> extension = Extension::Create( temp_dir.path(), - Extension::INTERNAL, + Manifest::INTERNAL, *root, extension_flags, &error); diff --git a/chrome/browser/extensions/crx_installer.cc b/chrome/browser/extensions/crx_installer.cc index 121e291..dd54f06 100644 --- a/chrome/browser/extensions/crx_installer.cc +++ b/chrome/browser/extensions/crx_installer.cc @@ -89,7 +89,7 @@ CrxInstaller::CrxInstaller( ExtensionInstallPrompt* client, const WebstoreInstaller::Approval* approval) : install_directory_(frontend_weak->install_directory()), - install_source_(Extension::INTERNAL), + install_source_(Manifest::INTERNAL), approved_(false), extensions_enabled_(frontend_weak->extensions_enabled()), delete_source_(false), @@ -243,7 +243,7 @@ CrxInstallerError CrxInstaller::AllowInstall(const Extension* extension) { // TODO(pamg): After ManagementPolicy refactoring is complete, remove this // and other uses of install_source_ that are no longer needed now that the // SandboxedUnpacker sets extension->location. - if (extension->is_theme() || Extension::IsExternalLocation(install_source_)) + if (extension->is_theme() || Manifest::IsExternalLocation(install_source_)) return CrxInstallerError(); if (!extensions_enabled_) { @@ -342,7 +342,7 @@ void CrxInstaller::OnUnpackFailure(const string16& error_message) { DCHECK(installer_task_runner_->RunsTasksOnCurrentThread()); UMA_HISTOGRAM_ENUMERATION("Extensions.UnpackFailureInstallSource", - install_source(), Extension::NUM_LOCATIONS); + install_source(), Manifest::NUM_LOCATIONS); UMA_HISTOGRAM_ENUMERATION("Extensions.UnpackFailureInstallCause", install_cause(), @@ -358,7 +358,7 @@ void CrxInstaller::OnUnpackSuccess(const FilePath& temp_dir, DCHECK(installer_task_runner_->RunsTasksOnCurrentThread()); UMA_HISTOGRAM_ENUMERATION("Extensions.UnpackSuccessInstallSource", - install_source(), Extension::NUM_LOCATIONS); + install_source(), Manifest::NUM_LOCATIONS); UMA_HISTOGRAM_ENUMERATION("Extensions.UnpackSuccessInstallCause", diff --git a/chrome/browser/extensions/crx_installer.h b/chrome/browser/extensions/crx_installer.h index 981b65e..b0e368a 100644 --- a/chrome/browser/extensions/crx_installer.h +++ b/chrome/browser/extensions/crx_installer.h @@ -17,6 +17,7 @@ #include "chrome/browser/extensions/sandboxed_unpacker.h" #include "chrome/browser/extensions/webstore_installer.h" #include "chrome/common/extensions/extension.h" +#include "chrome/common/extensions/manifest.h" #include "chrome/common/web_apps.h" #include "sync/api/string_ordinal.h" @@ -109,10 +110,10 @@ class CrxInstaller const FilePath& source_file() const { return source_file_; } - Extension::Location install_source() const { + Manifest::Location install_source() const { return install_source_; } - void set_install_source(Extension::Location source) { + void set_install_source(Manifest::Location source) { install_source_ = source; } @@ -259,7 +260,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_; + Manifest::Location install_source_; // Indicates whether the user has already approved the extension to be // installed. If true, |expected_manifest_| and |expected_id_| must match diff --git a/chrome/browser/extensions/default_apps.cc b/chrome/browser/extensions/default_apps.cc index 604f0cd..6c98681 100644 --- a/chrome/browser/extensions/default_apps.cc +++ b/chrome/browser/extensions/default_apps.cc @@ -132,8 +132,8 @@ bool Provider::ShouldInstallInProfile() { Provider::Provider(Profile* profile, VisitorInterface* service, extensions::ExternalLoader* loader, - extensions::Extension::Location crx_location, - extensions::Extension::Location download_location, + extensions::Manifest::Location crx_location, + extensions::Manifest::Location download_location, int creation_flags) : extensions::ExternalProviderImpl(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 cc5ede1..d5b16cb 100644 --- a/chrome/browser/extensions/default_apps.h +++ b/chrome/browser/extensions/default_apps.h @@ -7,14 +7,11 @@ #include "base/basictypes.h" #include "chrome/browser/extensions/external_provider_impl.h" +#include "chrome/common/extensions/manifest.h" class PrefServiceSyncable; class Profile; -namespace extensions { -class Extension; -} - namespace base { class DictionaryValue; } @@ -44,8 +41,8 @@ class Provider : public extensions::ExternalProviderImpl { Provider(Profile* profile, VisitorInterface* service, extensions::ExternalLoader* loader, - extensions::Extension::Location crx_location, - extensions::Extension::Location download_location, + extensions::Manifest::Location crx_location, + extensions::Manifest::Location download_location, int creation_flags); bool ShouldInstallInProfile(); diff --git a/chrome/browser/extensions/default_apps_unittest.cc b/chrome/browser/extensions/default_apps_unittest.cc index 51f367e..a909d6c 100644 --- a/chrome/browser/extensions/default_apps_unittest.cc +++ b/chrome/browser/extensions/default_apps_unittest.cc @@ -44,8 +44,8 @@ TEST_F(DefaultAppsTest, Install) { extensions::ExternalLoader* loader = new MockExternalLoader(); - Provider provider(profile.get(), NULL, loader, Extension::INTERNAL, - Extension::INTERNAL, Extension::NO_FLAGS); + Provider provider(profile.get(), NULL, loader, Manifest::INTERNAL, + Manifest::INTERNAL, Extension::NO_FLAGS); // The default apps should be installed if kDefaultAppsInstallState // is unknown. @@ -80,8 +80,8 @@ TEST_F(DefaultAppsTest, Install) { } }; profile.reset(new DefaultTestingProfile); - Provider provider2(profile.get(), NULL, loader, Extension::INTERNAL, - Extension::INTERNAL, Extension::NO_FLAGS); + Provider provider2(profile.get(), NULL, loader, Manifest::INTERNAL, + Manifest::INTERNAL, Extension::NO_FLAGS); // The old default apps with kProvideLegacyDefaultApps should be migrated // even if the profile version is older than Chrome version. profile->GetPrefs()->SetInteger(prefs::kDefaultAppsInstallState, diff --git a/chrome/browser/extensions/extension_action_icon_factory_unittest.cc b/chrome/browser/extensions/extension_action_icon_factory_unittest.cc index 6b35882..9728e2b 100644 --- a/chrome/browser/extensions/extension_action_icon_factory_unittest.cc +++ b/chrome/browser/extensions/extension_action_icon_factory_unittest.cc @@ -95,7 +95,7 @@ class ExtensionActionIconFactoryTest } scoped_refptr<Extension> CreateExtension(const char* name, - Extension::Location location) { + Manifest::Location location) { // Create and load an extension. FilePath test_file; if (!PathService::Get(chrome::DIR_TEST_DATA, &test_file)) { @@ -177,7 +177,7 @@ TEST_F(ExtensionActionIconFactoryTest, NoIcons) { // Load an extension that has browser action without default icon set in the // manifest and does not call |SetIcon| by default. scoped_refptr<Extension> extension(CreateExtension( - "browser_action/no_icon", Extension::INVALID)); + "browser_action/no_icon", Manifest::INVALID_LOCATION)); ASSERT_TRUE(extension.get() != NULL); ExtensionAction* browser_action = GetBrowserAction(*extension); ASSERT_TRUE(browser_action); @@ -202,7 +202,7 @@ TEST_F(ExtensionActionIconFactoryTest, AfterSetIcon) { // manifest and does not call |SetIcon| by default (but has an browser action // icon resource). scoped_refptr<Extension> extension(CreateExtension( - "browser_action/no_icon", Extension::INVALID)); + "browser_action/no_icon", Manifest::INVALID_LOCATION)); ASSERT_TRUE(extension.get() != NULL); ExtensionAction* browser_action = GetBrowserAction(*extension); ASSERT_TRUE(browser_action); @@ -239,7 +239,7 @@ TEST_F(ExtensionActionIconFactoryTest, DefaultIcon) { // manifest and does not call |SetIcon| by default (but has an browser action // icon resource). scoped_refptr<Extension> extension(CreateExtension( - "browser_action/no_icon", Extension::INVALID)); + "browser_action/no_icon", Manifest::INVALID_LOCATION)); ASSERT_TRUE(extension.get() != NULL); ExtensionAction* browser_action = GetBrowserAction(*extension); ASSERT_TRUE(browser_action); diff --git a/chrome/browser/extensions/extension_apitest.cc b/chrome/browser/extensions/extension_apitest.cc index 3423286..6c279cf 100644 --- a/chrome/browser/extensions/extension_apitest.cc +++ b/chrome/browser/extensions/extension_apitest.cc @@ -260,7 +260,7 @@ const extensions::Extension* ExtensionApiTest::GetSingleLoadedExtension() { 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() == extensions::Extension::COMPONENT) + if ((*it)->location() == extensions::Manifest::COMPONENT) continue; if (extension != NULL) { diff --git a/chrome/browser/extensions/extension_browsertest.cc b/chrome/browser/extensions/extension_browsertest.cc index f7aba19..160071e 100644 --- a/chrome/browser/extensions/extension_browsertest.cc +++ b/chrome/browser/extensions/extension_browsertest.cc @@ -47,6 +47,7 @@ using extensions::Extension; using extensions::ExtensionCreator; using extensions::FeatureSwitch; +using extensions::Manifest; ExtensionBrowserTest::ExtensionBrowserTest() : loaded_(false), @@ -112,14 +113,14 @@ const Extension* ExtensionBrowserTest::LoadExtensionWithFlags( return NULL; if (!(flags & kFlagIgnoreManifestWarnings)) { - const Extension::InstallWarningVector& install_warnings = + const std::vector<extensions::InstallWarning>& install_warnings = extension->install_warnings(); if (!install_warnings.empty()) { std::string install_warnings_message = StringPrintf( "Unexpected warnings when loading test extension %s:\n", path.AsUTF8Unsafe().c_str()); - for (Extension::InstallWarningVector::const_iterator it = + for (std::vector<extensions::InstallWarning>::const_iterator it = install_warnings.begin(); it != install_warnings.end(); ++it) { install_warnings_message += " " + it->message + "\n"; } @@ -296,7 +297,7 @@ const Extension* ExtensionBrowserTest::InstallExtensionFromWebstore( const FilePath& path, int expected_change) { return InstallOrUpdateExtension("", path, INSTALL_UI_TYPE_NONE, - expected_change, Extension::INTERNAL, + expected_change, Manifest::INTERNAL, browser(), true); } @@ -306,7 +307,7 @@ const Extension* ExtensionBrowserTest::InstallOrUpdateExtension( InstallUIType ui_type, int expected_change) { return InstallOrUpdateExtension(id, path, ui_type, expected_change, - Extension::INTERNAL, browser(), false); + Manifest::INTERNAL, browser(), false); } const Extension* ExtensionBrowserTest::InstallOrUpdateExtension( @@ -317,7 +318,7 @@ const Extension* ExtensionBrowserTest::InstallOrUpdateExtension( Browser* browser, bool from_webstore) { return InstallOrUpdateExtension(id, path, ui_type, expected_change, - Extension::INTERNAL, browser, from_webstore); + Manifest::INTERNAL, browser, from_webstore); } const Extension* ExtensionBrowserTest::InstallOrUpdateExtension( @@ -325,7 +326,7 @@ const Extension* ExtensionBrowserTest::InstallOrUpdateExtension( const FilePath& path, InstallUIType ui_type, int expected_change, - Extension::Location install_source) { + Manifest::Location install_source) { return InstallOrUpdateExtension(id, path, ui_type, expected_change, install_source, browser(), false); } @@ -335,7 +336,7 @@ const Extension* ExtensionBrowserTest::InstallOrUpdateExtension( const FilePath& path, InstallUIType ui_type, int expected_change, - Extension::Location install_source, + Manifest::Location install_source, Browser* browser, bool from_webstore) { ExtensionService* service = browser->profile()->GetExtensionService(); diff --git a/chrome/browser/extensions/extension_browsertest.h b/chrome/browser/extensions/extension_browsertest.h index 03743b2..3dec2ad 100644 --- a/chrome/browser/extensions/extension_browsertest.h +++ b/chrome/browser/extensions/extension_browsertest.h @@ -17,6 +17,7 @@ #include "chrome/common/extensions/extension.h" #include "chrome/common/extensions/feature_switch.h" #include "chrome/common/extensions/features/feature.h" +#include "chrome/common/extensions/manifest.h" #include "chrome/test/base/in_process_browser_test.h" #include "content/public/browser/notification_details.h" #include "content/public/browser/notification_observer.h" @@ -97,12 +98,12 @@ class ExtensionBrowserTest : virtual public InProcessBrowserTest, expected_change); } - // Same as above, but an install source other than Extension::INTERNAL can be + // Same as above, but an install source other than Manifest::INTERNAL can be // specified. const extensions::Extension* InstallExtension( const FilePath& path, int expected_change, - extensions::Extension::Location install_source) { + extensions::Manifest::Location install_source) { return InstallOrUpdateExtension("", path, INSTALL_UI_TYPE_NONE, expected_change, install_source); } @@ -240,13 +241,13 @@ class ExtensionBrowserTest : virtual public InProcessBrowserTest, const FilePath& path, InstallUIType ui_type, int expected_change, - extensions::Extension::Location install_source); + extensions::Manifest::Location install_source); const extensions::Extension* InstallOrUpdateExtension( const std::string& id, const FilePath& path, InstallUIType ui_type, int expected_change, - extensions::Extension::Location install_source, + extensions::Manifest::Location install_source, Browser* browser, bool from_webstore); diff --git a/chrome/browser/extensions/extension_creator.cc b/chrome/browser/extensions/extension_creator.cc index c04c486..f76790f 100644 --- a/chrome/browser/extensions/extension_creator.cc +++ b/chrome/browser/extensions/extension_creator.cc @@ -112,7 +112,7 @@ bool ExtensionCreator::ValidateManifest(const FilePath& extension_dir, extension_file_util::LoadExtension( extension_dir, extension_id, - Extension::INTERNAL, + Manifest::INTERNAL, create_flags, &error_message_)); return !!extension.get(); diff --git a/chrome/browser/extensions/extension_function_test_utils.cc b/chrome/browser/extensions/extension_function_test_utils.cc index d352966..157600b 100644 --- a/chrome/browser/extensions/extension_function_test_utils.cc +++ b/chrome/browser/extensions/extension_function_test_utils.cc @@ -19,6 +19,7 @@ using content::WebContents; using extensions::Extension; +using extensions::Manifest; namespace keys = extensions::tabs_constants; namespace { @@ -102,11 +103,11 @@ base::ListValue* ToList(base::Value* val) { } scoped_refptr<Extension> CreateEmptyExtension() { - return CreateEmptyExtensionWithLocation(Extension::INTERNAL); + return CreateEmptyExtensionWithLocation(Manifest::INTERNAL); } scoped_refptr<Extension> CreateEmptyExtensionWithLocation( - Extension::Location location) { + Manifest::Location location) { scoped_ptr<base::DictionaryValue> test_extension_value( ParseDictionary("{\"name\": \"Test\", \"version\": \"1.0\"}")); return CreateExtension(location, test_extension_value.get(), std::string()); @@ -116,18 +117,18 @@ scoped_refptr<Extension> CreateEmptyExtension( const std::string& id_input) { scoped_ptr<base::DictionaryValue> test_extension_value( ParseDictionary("{\"name\": \"Test\", \"version\": \"1.0\"}")); - return CreateExtension(Extension::INTERNAL, test_extension_value.get(), + return CreateExtension(Manifest::INTERNAL, test_extension_value.get(), id_input); } scoped_refptr<Extension> CreateExtension( base::DictionaryValue* test_extension_value) { - return CreateExtension(Extension::INTERNAL, test_extension_value, + return CreateExtension(Manifest::INTERNAL, test_extension_value, std::string()); } scoped_refptr<Extension> CreateExtension( - Extension::Location location, + Manifest::Location location, base::DictionaryValue* test_extension_value, const std::string& id_input) { std::string error; diff --git a/chrome/browser/extensions/extension_function_test_utils.h b/chrome/browser/extensions/extension_function_test_utils.h index e42c1d5..a8342ed 100644 --- a/chrome/browser/extensions/extension_function_test_utils.h +++ b/chrome/browser/extensions/extension_function_test_utils.h @@ -8,7 +8,7 @@ #include <string> #include "base/memory/ref_counted.h" -#include "chrome/common/extensions/extension.h" +#include "chrome/common/extensions/manifest.h" class AsyncExtensionFunction; class Browser; @@ -52,7 +52,7 @@ scoped_refptr<extensions::Extension> CreateEmptyExtension(); // Creates an extension instance with a specified location that can be attached // to an ExtensionFunction before running. scoped_refptr<extensions::Extension> CreateEmptyExtensionWithLocation( - extensions::Extension::Location location); + extensions::Manifest::Location location); // Creates an empty extension with a variable ID, for tests that require // multiple extensions side-by-side having distinct IDs. If not empty, then @@ -64,7 +64,7 @@ scoped_refptr<extensions::Extension> CreateEmptyExtension( const std::string& id_input); scoped_refptr<extensions::Extension> CreateExtension( - extensions::Extension::Location location, + extensions::Manifest::Location location, base::DictionaryValue* test_extension_value, const std::string& id_input); @@ -74,7 +74,7 @@ scoped_refptr<extensions::Extension> CreateExtension( base::DictionaryValue* test_extension_value); scoped_refptr<extensions::Extension> CreateExtension( - extensions::Extension::Location location, + extensions::Manifest::Location location, base::DictionaryValue* test_extension_value); // Returns true if |val| contains privacy information, e.g. url, diff --git a/chrome/browser/extensions/extension_icon_image_unittest.cc b/chrome/browser/extensions/extension_icon_image_unittest.cc index 29a09e0..0d728c8 100644 --- a/chrome/browser/extensions/extension_icon_image_unittest.cc +++ b/chrome/browser/extensions/extension_icon_image_unittest.cc @@ -11,6 +11,7 @@ #include "chrome/common/chrome_paths.h" #include "chrome/common/extensions/extension.h" #include "chrome/common/extensions/extension_constants.h" +#include "chrome/common/extensions/manifest.h" #include "content/public/test/test_browser_thread.h" #include "grit/theme_resources.h" #include "skia/ext/image_operations.h" @@ -22,6 +23,7 @@ using content::BrowserThread; using extensions::Extension; using extensions::IconImage; +using extensions::Manifest; namespace { @@ -139,7 +141,7 @@ class ExtensionIconImageTest : public testing::Test, } scoped_refptr<Extension> CreateExtension(const char* name, - Extension::Location location) { + Manifest::Location location) { // Create and load an extension. FilePath test_file; if (!PathService::Get(chrome::DIR_TEST_DATA, &test_file)) { @@ -207,7 +209,7 @@ class ExtensionIconImageTest : public testing::Test, TEST_F(ExtensionIconImageTest, Basic) { scoped_refptr<Extension> extension(CreateExtension( - "extension_icon_image", Extension::INVALID)); + "extension_icon_image", Manifest::INVALID_LOCATION)); ASSERT_TRUE(extension.get() != NULL); gfx::ImageSkia default_icon = GetDefaultIcon(); @@ -273,7 +275,7 @@ TEST_F(ExtensionIconImageTest, Basic) { // resource. TEST_F(ExtensionIconImageTest, FallbackToSmallerWhenNoBigger) { scoped_refptr<Extension> extension(CreateExtension( - "extension_icon_image", Extension::INVALID)); + "extension_icon_image", Manifest::INVALID_LOCATION)); ASSERT_TRUE(extension.get() != NULL); gfx::ImageSkia default_icon = GetDefaultIcon(); @@ -308,7 +310,7 @@ TEST_F(ExtensionIconImageTest, FallbackToSmallerWhenNoBigger) { // be loaded. TEST_F(ExtensionIconImageTest, FallbackToSmaller) { scoped_refptr<Extension> extension(CreateExtension( - "extension_icon_image", Extension::INVALID)); + "extension_icon_image", Manifest::INVALID_LOCATION)); ASSERT_TRUE(extension.get() != NULL); gfx::ImageSkia default_icon = GetDefaultIcon(); @@ -341,7 +343,7 @@ TEST_F(ExtensionIconImageTest, FallbackToSmaller) { // default icon, without notifying observer of image change. TEST_F(ExtensionIconImageTest, NoResources) { scoped_refptr<Extension> extension(CreateExtension( - "extension_icon_image", Extension::INVALID)); + "extension_icon_image", Manifest::INVALID_LOCATION)); ASSERT_TRUE(extension.get() != NULL); ExtensionIconSet empty_icon_set; @@ -376,7 +378,7 @@ TEST_F(ExtensionIconImageTest, NoResources) { // return the default icon representation once image load is done. TEST_F(ExtensionIconImageTest, InvalidResource) { scoped_refptr<Extension> extension(CreateExtension( - "extension_icon_image", Extension::INVALID)); + "extension_icon_image", Manifest::INVALID_LOCATION)); ASSERT_TRUE(extension.get() != NULL); const int kInvalidIconSize = 24; @@ -411,7 +413,7 @@ TEST_F(ExtensionIconImageTest, InvalidResource) { // icon when IconImage returns synchronously. TEST_F(ExtensionIconImageTest, LazyDefaultIcon) { scoped_refptr<Extension> extension(CreateExtension( - "extension_icon_image", Extension::INVALID)); + "extension_icon_image", Manifest::INVALID_LOCATION)); ASSERT_TRUE(extension.get() != NULL); gfx::ImageSkia default_icon = GetDefaultIcon(); @@ -445,7 +447,7 @@ TEST_F(ExtensionIconImageTest, LazyDefaultIcon) { // icon when IconImage returns asynchronously. TEST_F(ExtensionIconImageTest, LazyDefaultIcon_AsyncIconImage) { scoped_refptr<Extension> extension(CreateExtension( - "extension_icon_image", Extension::INVALID)); + "extension_icon_image", Manifest::INVALID_LOCATION)); ASSERT_TRUE(extension.get() != NULL); gfx::ImageSkia default_icon = GetDefaultIcon(); @@ -481,7 +483,7 @@ TEST_F(ExtensionIconImageTest, LazyDefaultIcon_AsyncIconImage) { TEST_F(ExtensionIconImageTest, LoadPrecachedImage) { scoped_refptr<Extension> extension(CreateExtension( - "extension_icon_image", Extension::INVALID)); + "extension_icon_image", Manifest::INVALID_LOCATION)); ASSERT_TRUE(extension.get() != NULL); gfx::ImageSkia default_icon = GetDefaultIcon(); @@ -516,7 +518,7 @@ TEST_F(ExtensionIconImageTest, LoadPrecachedImage) { // representations should be returned. TEST_F(ExtensionIconImageTest, IconImageDestruction) { scoped_refptr<Extension> extension(CreateExtension( - "extension_icon_image", Extension::INVALID)); + "extension_icon_image", Manifest::INVALID_LOCATION)); ASSERT_TRUE(extension.get() != NULL); gfx::ImageSkia default_icon = GetDefaultIcon(); diff --git a/chrome/browser/extensions/extension_icon_manager_unittest.cc b/chrome/browser/extensions/extension_icon_manager_unittest.cc index fcefadd..d715a0b 100644 --- a/chrome/browser/extensions/extension_icon_manager_unittest.cc +++ b/chrome/browser/extensions/extension_icon_manager_unittest.cc @@ -17,6 +17,7 @@ using content::BrowserThread; using extensions::Extension; +using extensions::Manifest; // Our test class that takes care of managing the necessary threads for loading // extension icons, and waiting for those loads to happen. @@ -116,7 +117,7 @@ TEST_F(ExtensionIconManagerTest, LoadRemoveLoad) { std::string error; scoped_refptr<Extension> extension(Extension::Create( - manifest_path.DirName(), Extension::INVALID, *manifest.get(), + manifest_path.DirName(), Manifest::INVALID_LOCATION, *manifest.get(), Extension::NO_FLAGS, &error)); ASSERT_TRUE(extension.get()); TestIconManager icon_manager(this); @@ -157,7 +158,7 @@ TEST_F(ExtensionIconManagerTest, LoadComponentExtensionResource) { std::string error; scoped_refptr<Extension> extension(Extension::Create( - manifest_path.DirName(), Extension::COMPONENT, *manifest.get(), + manifest_path.DirName(), Manifest::COMPONENT, *manifest.get(), Extension::NO_FLAGS, &error)); ASSERT_TRUE(extension.get()); diff --git a/chrome/browser/extensions/extension_info_map_unittest.cc b/chrome/browser/extensions/extension_info_map_unittest.cc index 439e42a..05ba73f 100644 --- a/chrome/browser/extensions/extension_info_map_unittest.cc +++ b/chrome/browser/extensions/extension_info_map_unittest.cc @@ -17,6 +17,7 @@ using content::BrowserThread; using extensions::APIPermission; using extensions::Extension; +using extensions::Manifest; using WebKit::WebSecurityOrigin; using WebKit::WebString; @@ -51,7 +52,7 @@ static scoped_refptr<Extension> CreateExtension(const std::string& name) { std::string error; scoped_refptr<Extension> extension = Extension::Create( - path.AppendASCII(name), Extension::INVALID, manifest, + path.AppendASCII(name), Manifest::INVALID_LOCATION, manifest, Extension::NO_FLAGS, &error); EXPECT_TRUE(extension) << error; @@ -73,7 +74,8 @@ static scoped_refptr<Extension> LoadManifest(const std::string& dir, std::string error; scoped_refptr<Extension> extension = Extension::Create( - path, Extension::INVALID, *static_cast<DictionaryValue*>(result.get()), + path, Manifest::INVALID_LOCATION, + *static_cast<DictionaryValue*>(result.get()), Extension::NO_FLAGS, &error); EXPECT_TRUE(extension) << error; diff --git a/chrome/browser/extensions/extension_install_prompt.cc b/chrome/browser/extensions/extension_install_prompt.cc index a83f770..28ffef6 100644 --- a/chrome/browser/extensions/extension_install_prompt.cc +++ b/chrome/browser/extensions/extension_install_prompt.cc @@ -29,6 +29,7 @@ #include "chrome/common/extensions/extension_manifest_constants.h" #include "chrome/common/extensions/extension_resource.h" #include "chrome/common/extensions/feature_switch.h" +#include "chrome/common/extensions/manifest.h" #include "chrome/common/extensions/permissions/permission_set.h" #include "chrome/common/pref_names.h" #include "content/public/browser/web_contents.h" @@ -43,6 +44,7 @@ using extensions::BundleInstaller; using extensions::Extension; +using extensions::Manifest; using extensions::PermissionSet; namespace { @@ -375,7 +377,7 @@ scoped_refptr<Extension> return Extension::Create( FilePath(), - Extension::INTERNAL, + Manifest::INTERNAL, localized_manifest.get() ? *localized_manifest.get() : *manifest, flags, id, @@ -630,8 +632,8 @@ void ExtensionInstallPrompt::OnMintTokenFailure( void ExtensionInstallPrompt::ShowConfirmation() { if (permissions_ && (!extension_ || !extension_->ShouldSkipPermissionWarnings())) { - Extension::Type extension_type = extension_ ? extension_->GetType() : - Extension::TYPE_UNKNOWN; + Manifest::Type extension_type = extension_ ? + extension_->GetType() : Manifest::TYPE_UNKNOWN; prompt_.SetPermissions(permissions_->GetWarningMessages(extension_type)); } diff --git a/chrome/browser/extensions/extension_nacl_browsertest.cc b/chrome/browser/extensions/extension_nacl_browsertest.cc index e6ea410..c0d4142 100644 --- a/chrome/browser/extensions/extension_nacl_browsertest.cc +++ b/chrome/browser/extensions/extension_nacl_browsertest.cc @@ -26,6 +26,7 @@ using content::PluginService; using content::WebContents; using extensions::Extension; +using extensions::Manifest; namespace { @@ -141,7 +142,7 @@ IN_PROC_BROWSER_TEST_F(NaClExtensionTest, ComponentExtension) { const Extension* extension = InstallExtension(INSTALL_TYPE_COMPONENT); ASSERT_TRUE(extension); - ASSERT_EQ(extension->location(), Extension::COMPONENT); + ASSERT_EQ(extension->location(), Manifest::COMPONENT); CheckPluginsCreated(extension, true); } @@ -151,7 +152,7 @@ IN_PROC_BROWSER_TEST_F(NaClExtensionTest, UnpackedExtension) { const Extension* extension = InstallExtension(INSTALL_TYPE_UNPACKED); ASSERT_TRUE(extension); - ASSERT_EQ(extension->location(), Extension::LOAD); + ASSERT_EQ(extension->location(), Manifest::LOAD); CheckPluginsCreated(extension, true); } diff --git a/chrome/browser/extensions/extension_prefs.cc b/chrome/browser/extensions/extension_prefs.cc index 900acb2c..38260d1 100644 --- a/chrome/browser/extensions/extension_prefs.cc +++ b/chrome/browser/extensions/extension_prefs.cc @@ -43,7 +43,7 @@ namespace { // Whether this extension was running when chrome last shutdown. const char kPrefRunning[] = "running"; -// Where an extension was installed from. (see Extension::Location) +// Where an extension was installed from. (see Manifest::Location) const char kPrefLocation[] = "location"; // Enabled, disabled, killed, etc. (see Extension::State) @@ -430,7 +430,7 @@ void ExtensionPrefs::MakePathsRelative() { continue; int location_value; if (extension_dict->GetInteger(kPrefLocation, &location_value) && - location_value == Extension::LOAD) { + location_value == Manifest::LOAD) { // Unpacked extensions can have absolute paths. continue; } @@ -1445,7 +1445,7 @@ void ExtensionPrefs::OnExtensionInstalled( } void ExtensionPrefs::OnExtensionUninstalled(const std::string& extension_id, - const Extension::Location& location, + const Manifest::Location& location, bool external_uninstall) { extension_sorting_->ClearOrdinals(extension_id); @@ -1453,7 +1453,7 @@ void ExtensionPrefs::OnExtensionUninstalled(const std::string& extension_id, // and install the extension anymore (except when |external_uninstall| is // true, which signifies that the registry key was deleted or the pref file // no longer lists the extension). - if (!external_uninstall && Extension::IsExternalLocation(location)) { + if (!external_uninstall && Manifest::IsExternalLocation(location)) { UpdateExtensionPref(extension_id, kPrefState, Value::CreateIntegerValue( Extension::EXTERNAL_EXTENSION_UNINSTALLED)); @@ -1524,7 +1524,7 @@ std::string ExtensionPrefs::GetVersionString(const std::string& extension_id) { } void ExtensionPrefs::UpdateManifest(const Extension* extension) { - if (extension->location() != Extension::LOAD) { + if (extension->location() != Manifest::LOAD) { const DictionaryValue* extension_dict = GetExtensionPref(extension->id()); if (!extension_dict) return; @@ -1612,25 +1612,25 @@ scoped_ptr<ExtensionInfo> ExtensionPrefs::GetInstalledExtensionInfo( // Make path absolute. Unpacked extensions will already have absolute paths, // otherwise make it so. - if (location_value != Extension::LOAD) { - DCHECK(location_value == Extension::COMPONENT || + if (location_value != Manifest::LOAD) { + DCHECK(location_value == Manifest::COMPONENT || !FilePath(path).IsAbsolute()); path = install_directory_.Append(path).value(); } // Only the following extension types can be installed permanently in the // preferences. - Extension::Location location = - static_cast<Extension::Location>(location_value); - if (location != Extension::INTERNAL && - location != Extension::LOAD && - !Extension::IsExternalLocation(location)) { + Manifest::Location location = + static_cast<Manifest::Location>(location_value); + if (location != Manifest::INTERNAL && + location != Manifest::LOAD && + !Manifest::IsExternalLocation(location)) { NOTREACHED(); return scoped_ptr<ExtensionInfo>(); } const DictionaryValue* manifest = NULL; - if (location != Extension::LOAD && + if (location != Manifest::LOAD && !ext->GetDictionary(kPrefManifest, &manifest)) { LOG(WARNING) << "Missing manifest for extension " << extension_id; // Just a warning for now. @@ -1744,25 +1744,25 @@ scoped_ptr<ExtensionInfo> ExtensionPrefs::GetDelayedInstallInfo( // Make path absolute. Unpacked extensions will already have absolute paths, // otherwise make it so. - if (location_value != Extension::LOAD) { - DCHECK(location_value == Extension::COMPONENT || + if (location_value != Manifest::LOAD) { + DCHECK(location_value == Manifest::COMPONENT || !FilePath(path).IsAbsolute()); path = install_directory_.Append(path).value(); } // Only the following extension types can be installed permanently in the // preferences. - Extension::Location location = - static_cast<Extension::Location>(location_value); - if (location != Extension::INTERNAL && - location != Extension::LOAD && - !Extension::IsExternalLocation(location)) { + Manifest::Location location = + static_cast<Manifest::Location>(location_value); + if (location != Manifest::INTERNAL && + location != Manifest::LOAD && + !Manifest::IsExternalLocation(location)) { NOTREACHED(); return scoped_ptr<ExtensionInfo>(); } const DictionaryValue* manifest = NULL; - if (location != Extension::LOAD && + if (location != Manifest::LOAD && !ext->GetDictionary(kPrefManifest, &manifest)) { LOG(WARNING) << "Missing manifest for extension " << extension_id; // Just a warning for now. @@ -2317,7 +2317,7 @@ void ExtensionPrefs::PopulateExtensionInfoPrefs( extension_dict->Set(kPrefPath, Value::CreateStringValue(path)); // We store prefs about LOAD extensions, but don't cache their manifest // since it may change on disk. - if (extension->location() != Extension::LOAD) { + if (extension->location() != Manifest::LOAD) { extension_dict->Set(kPrefManifest, extension->manifest()->value()->DeepCopy()); } diff --git a/chrome/browser/extensions/extension_prefs.h b/chrome/browser/extensions/extension_prefs.h index e6652c36..c11e7e5 100644 --- a/chrome/browser/extensions/extension_prefs.h +++ b/chrome/browser/extensions/extension_prefs.h @@ -145,7 +145,7 @@ class ExtensionPrefs : public ContentSettingsStore::Observer, // Called when an extension is uninstalled, so that prefs get cleaned up. void OnExtensionUninstalled(const std::string& extension_id, - const Extension::Location& location, + const Manifest::Location& location, bool external_uninstall); // Called to change the extension's state when it is enabled/disabled. diff --git a/chrome/browser/extensions/extension_prefs_unittest.cc b/chrome/browser/extensions/extension_prefs_unittest.cc index 8a45d69..c2bfc86 100644 --- a/chrome/browser/extensions/extension_prefs_unittest.cc +++ b/chrome/browser/extensions/extension_prefs_unittest.cc @@ -468,7 +468,7 @@ class ExtensionPrefsVersionString : public ExtensionPrefsTest { extension = prefs_.AddExtension("test"); EXPECT_EQ("0.1", prefs()->GetVersionString(extension->id())); prefs()->OnExtensionUninstalled(extension->id(), - Extension::INTERNAL, false); + Manifest::INTERNAL, false); } virtual void Verify() { @@ -591,7 +591,7 @@ class ExtensionPrefsDelayedInstallInfo : public ExtensionPrefsTest { FilePath path = prefs_.extensions_dir().AppendASCII(base::IntToString(num)); std::string errors; scoped_refptr<Extension> extension = Extension::Create( - path, Extension::INTERNAL, manifest, Extension::NO_FLAGS, id, &errors); + path, Manifest::INTERNAL, manifest, Extension::NO_FLAGS, id, &errors); ASSERT_TRUE(extension) << errors; ASSERT_EQ(id, extension->id()); prefs()->SetDelayedInstallInfo(extension.get(), Extension::ENABLED, @@ -740,7 +740,7 @@ class ExtensionPrefsFlags : public ExtensionPrefsTest { dictionary.SetString(extension_manifest_keys::kName, "from_webstore"); dictionary.SetString(extension_manifest_keys::kVersion, "0.1"); webstore_extension_ = prefs_.AddExtensionWithManifestAndFlags( - dictionary, Extension::INTERNAL, Extension::FROM_WEBSTORE); + dictionary, Manifest::INTERNAL, Extension::FROM_WEBSTORE); } { @@ -748,7 +748,7 @@ class ExtensionPrefsFlags : public ExtensionPrefsTest { dictionary.SetString(extension_manifest_keys::kName, "from_bookmark"); dictionary.SetString(extension_manifest_keys::kVersion, "0.1"); bookmark_extension_ = prefs_.AddExtensionWithManifestAndFlags( - dictionary, Extension::INTERNAL, Extension::FROM_BOOKMARK); + dictionary, Manifest::INTERNAL, Extension::FROM_BOOKMARK); } { @@ -758,7 +758,7 @@ class ExtensionPrefsFlags : public ExtensionPrefsTest { dictionary.SetString(extension_manifest_keys::kVersion, "0.1"); default_extension_ = prefs_.AddExtensionWithManifestAndFlags( dictionary, - Extension::INTERNAL, + Manifest::INTERNAL, Extension::WAS_INSTALLED_BY_DEFAULT); } } @@ -796,16 +796,16 @@ ExtensionPrefsPrepopulatedTest::ExtensionPrefsPrepopulatedTest() simple_dict.SetString(keys::kName, "unused"); ext1_scoped_ = Extension::Create( - prefs_.temp_dir().AppendASCII("ext1_"), Extension::EXTERNAL_PREF, + prefs_.temp_dir().AppendASCII("ext1_"), Manifest::EXTERNAL_PREF, simple_dict, Extension::NO_FLAGS, &error); ext2_scoped_ = Extension::Create( - prefs_.temp_dir().AppendASCII("ext2_"), Extension::EXTERNAL_PREF, + prefs_.temp_dir().AppendASCII("ext2_"), Manifest::EXTERNAL_PREF, simple_dict, Extension::NO_FLAGS, &error); ext3_scoped_ = Extension::Create( - prefs_.temp_dir().AppendASCII("ext3_"), Extension::EXTERNAL_PREF, + prefs_.temp_dir().AppendASCII("ext3_"), Manifest::EXTERNAL_PREF, simple_dict, Extension::NO_FLAGS, &error); ext4_scoped_ = Extension::Create( - prefs_.temp_dir().AppendASCII("ext4_"), Extension::EXTERNAL_PREF, + prefs_.temp_dir().AppendASCII("ext4_"), Manifest::EXTERNAL_PREF, simple_dict, Extension::NO_FLAGS, &error); ext1_ = ext1_scoped_.get(); @@ -888,7 +888,7 @@ void ExtensionPrefsPrepopulatedTest::EnsureExtensionUninstalled( break; } } - prefs()->OnExtensionUninstalled(extension_id, Extension::INTERNAL, false); + prefs()->OnExtensionUninstalled(extension_id, Manifest::INTERNAL, false); } class ExtensionPrefsInstallOneExtension diff --git a/chrome/browser/extensions/extension_protocols_unittest.cc b/chrome/browser/extensions/extension_protocols_unittest.cc index 1fdb3c5..b9297e0 100644 --- a/chrome/browser/extensions/extension_protocols_unittest.cc +++ b/chrome/browser/extensions/extension_protocols_unittest.cc @@ -22,6 +22,7 @@ using content::BrowserThread; using extensions::Extension; +using extensions::Manifest; namespace { @@ -37,7 +38,7 @@ scoped_refptr<Extension> CreateTestExtension(const std::string& name, std::string error; scoped_refptr<Extension> extension( - Extension::Create(path, Extension::INTERNAL, manifest, + Extension::Create(path, Manifest::INTERNAL, manifest, Extension::NO_FLAGS, &error)); EXPECT_TRUE(extension.get()) << error; return extension; @@ -55,7 +56,7 @@ scoped_refptr<Extension> CreateWebStoreExtension() { std::string error; scoped_refptr<Extension> extension( - Extension::Create(path, Extension::COMPONENT, manifest, + Extension::Create(path, Manifest::COMPONENT, manifest, Extension::NO_FLAGS, &error)); EXPECT_TRUE(extension.get()) << error; return extension; diff --git a/chrome/browser/extensions/extension_service.cc b/chrome/browser/extensions/extension_service.cc index 8d72c59..3ea33e9 100644 --- a/chrome/browser/extensions/extension_service.cc +++ b/chrome/browser/extensions/extension_service.cc @@ -86,7 +86,6 @@ #include "chrome/common/extensions/extension_resource.h" #include "chrome/common/extensions/feature_switch.h" #include "chrome/common/extensions/features/feature.h" -#include "chrome/common/extensions/manifest.h" #include "chrome/common/extensions/manifest_url_handler.h" #include "chrome/common/pref_names.h" #include "chrome/common/startup_metric_utils.h" @@ -126,6 +125,7 @@ using extensions::Extension; using extensions::ExtensionIdSet; using extensions::ExtensionInfo; using extensions::FeatureSwitch; +using extensions::Manifest; using extensions::PermissionMessage; using extensions::PermissionMessages; using extensions::PermissionSet; @@ -244,7 +244,7 @@ void ExtensionService::AddProviderForTesting( bool ExtensionService::OnExternalExtensionUpdateUrlFound( const std::string& id, const GURL& update_url, - Extension::Location location) { + Manifest::Location location) { CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); CHECK(Extension::IdIsValid(id)); @@ -252,8 +252,8 @@ bool ExtensionService::OnExternalExtensionUpdateUrlFound( if (extension) { // Already installed. Skip this install if the current location has // higher priority than |location|. - Extension::Location current = extension->location(); - if (current == Extension::GetHigherPriorityLocation(current, location)) + Manifest::Location current = extension->location(); + if (current == Manifest::GetHigherPriorityLocation(current, location)) return false; // Otherwise, overwrite the current installation. } @@ -820,7 +820,7 @@ bool ExtensionService::UninstallExtension( external_uninstall); // Tell the backend to start deleting installed extensions on the file thread. - if (Extension::LOAD != extension->location()) { + if (Manifest::LOAD != extension->location()) { if (!GetFileTaskRunner()->PostTask( FROM_HERE, base::Bind( @@ -1580,7 +1580,7 @@ bool ExtensionService::IsIncognitoEnabled( return false; // If this is an existing component extension we always allow it to // work in incognito mode. - if (extension && extension->location() == Extension::COMPONENT) + if (extension && extension->location() == Manifest::COMPONENT) return true; // Check the prefs. @@ -1592,7 +1592,7 @@ void ExtensionService::SetIsIncognitoEnabled( const Extension* extension = GetInstalledExtension(extension_id); if (extension && !extension->can_be_incognito_enabled()) return; - if (extension && extension->location() == Extension::COMPONENT) { + if (extension && extension->location() == Manifest::COMPONENT) { // This shouldn't be called for component extensions unless they are // syncable. DCHECK(extension->IsSyncable()); @@ -1781,7 +1781,7 @@ void ExtensionService::OnAllExternalProvidersReady() { extension_prefs_->GetInstalledExtensionsInfo()); for (size_t i = 0; i < extensions_info->size(); ++i) { ExtensionInfo* info = extensions_info->at(i).get(); - if (Extension::IsExternalLocation(info->extension_location)) + if (Manifest::IsExternalLocation(info->extension_location)) CheckExternalUninstall(info->extension_id); } IdentifyAlertableExtensions(); @@ -1868,7 +1868,7 @@ bool ExtensionService::IsUnacknowledgedExternalExtension( if (!FeatureSwitch::prompt_for_external_extensions()->IsEnabled()) return false; - return (Extension::IsExternalLocation(extension->location()) && + return (Manifest::IsExternalLocation(extension->location()) && !extension_prefs_->IsExternalExtensionAcknowledged(extension->id()) && !(extension_prefs_->GetDisableReasons(extension->id()) & Extension::DISABLE_SIDELOAD_WIPEOUT)); @@ -2051,8 +2051,8 @@ void ExtensionService::AddExtension(const Extension* extension) { // is set (http://crbug.com/29067). if (!extensions_enabled() && !extension->is_theme() && - extension->location() != Extension::COMPONENT && - !Extension::IsExternalLocation(extension->location())) { + extension->location() != Manifest::COMPONENT && + !Manifest::IsExternalLocation(extension->location())) { return; } @@ -2230,7 +2230,7 @@ void ExtensionService::InitializePermissions(const Extension* extension) { if (is_extension_upgrade) { // Other than for unpacked extensions, CrxInstaller should have guaranteed // that we aren't downgrading. - if (extension->location() != Extension::LOAD) + if (extension->location() != Manifest::LOAD) CHECK_GE(extension->version()->CompareTo(*(old->version())), 0); // Extensions get upgraded if the privileges are allowed to increase or @@ -2288,11 +2288,11 @@ void ExtensionService::MaybeWipeout( if (!wipeout_is_active_) return; - if (extension->GetType() != Extension::TYPE_EXTENSION) + if (extension->GetType() != Manifest::TYPE_EXTENSION) return; - Extension::Location location = extension->location(); - if (location != Extension::EXTERNAL_REGISTRY) + Manifest::Location location = extension->location(); + if (location != Manifest::EXTERNAL_REGISTRY) return; if (extension_prefs_->IsExternalExtensionExcludedFromWipeout(extension->id())) @@ -2315,7 +2315,7 @@ void ExtensionService::UpdateActiveExtensionsInCrashReporter() { for (ExtensionSet::const_iterator iter = extensions_.begin(); iter != extensions_.end(); ++iter) { const Extension* extension = *iter; - if (!extension->is_theme() && extension->location() != Extension::COMPONENT) + if (!extension->is_theme() && extension->location() != Manifest::COMPONENT) extension_ids.insert(extension->id()); } @@ -2386,19 +2386,19 @@ void ExtensionService::OnExtensionInstalled( UMA_HISTOGRAM_ENUMERATION("Extensions.InstallType", extension->GetType(), 100); UMA_HISTOGRAM_ENUMERATION("Extensions.InstallSource", - extension->location(), Extension::NUM_LOCATIONS); + extension->location(), Manifest::NUM_LOCATIONS); RecordPermissionMessagesHistogram( extension, "Extensions.Permissions_Install"); } else { UMA_HISTOGRAM_ENUMERATION("Extensions.UpdateType", extension->GetType(), 100); UMA_HISTOGRAM_ENUMERATION("Extensions.UpdateSource", - extension->location(), Extension::NUM_LOCATIONS); + extension->location(), Manifest::NUM_LOCATIONS); } // Certain extension locations are specific enough that we can // auto-acknowledge any extension that came from one of them. - if (extension->location() == Extension::EXTERNAL_POLICY_DOWNLOAD) + if (extension->location() == Manifest::EXTERNAL_POLICY_DOWNLOAD) AcknowledgeExternalExtension(extension->id()); const Extension::State initial_state = initial_enable ? Extension::ENABLED : Extension::DISABLED; @@ -2473,7 +2473,7 @@ void ExtensionService::FinishInstallation(const Extension* extension) { // Unpacked extensions default to allowing file access, but if that has been // overridden, don't reset the value. - if (Extension::ShouldAlwaysAllowFileAccess(extension->location()) && + if (Manifest::ShouldAlwaysAllowFileAccess(extension->location()) && !extension_prefs_->HasAllowFileAccessSetting(extension->id())) { extension_prefs_->SetAllowFileAccess(extension->id(), true); } @@ -2541,7 +2541,7 @@ bool ExtensionService::ExtensionBindingsAllowed(const GURL& url) { const Extension* extension = extensions_.GetExtensionOrAppByURL( ExtensionURLInfo(url)); return extension && (!extension->is_hosted_app() || - extension->location() == Extension::COMPONENT); + extension->location() == Manifest::COMPONENT); } bool ExtensionService::ShouldBlockUrlInBrowserTab(GURL* url) { @@ -2559,7 +2559,7 @@ bool ExtensionService::OnExternalExtensionFileFound( const std::string& id, const Version* version, const FilePath& path, - Extension::Location location, + Manifest::Location location, int creation_flags, bool mark_acknowledged) { CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); @@ -2578,8 +2578,8 @@ bool ExtensionService::OnExternalExtensionFileFound( // app is already installed as internal, then do the version check. // TODO(grv) : Remove after Q1-2013. bool is_default_apps_migration = - (location == Extension::INTERNAL && - Extension::IsExternalLocation(existing->location())); + (location == Manifest::INTERNAL && + Manifest::IsExternalLocation(existing->location())); if (!is_default_apps_migration) { DCHECK(version); @@ -2775,7 +2775,7 @@ ExtensionIdSet ExtensionService::GetAppIds() const { ExtensionIdSet result; for (ExtensionSet::const_iterator it = extensions_.begin(); it != extensions_.end(); ++it) { - if ((*it)->is_app() && (*it)->location() != Extension::COMPONENT) + if ((*it)->is_app() && (*it)->location() != Manifest::COMPONENT) result.insert((*it)->id()); } @@ -2989,8 +2989,8 @@ bool ExtensionService::ShouldEnableOnInstall(const Extension* extension) { // External extensions are initially disabled. We prompt the user before // enabling them. Hosted apps are excepted because they are not dangerous // (they need to be launched by the user anyway). - if (extension->GetType() != Extension::TYPE_HOSTED_APP && - Extension::IsExternalLocation(extension->location()) && + if (extension->GetType() != Manifest::TYPE_HOSTED_APP && + Manifest::IsExternalLocation(extension->location()) && !extension_prefs_->IsExternalExtensionAcknowledged(extension->id())) { return false; } diff --git a/chrome/browser/extensions/extension_service.h b/chrome/browser/extensions/extension_service.h index 58e7a21..f2dc4b8 100644 --- a/chrome/browser/extensions/extension_service.h +++ b/chrome/browser/extensions/extension_service.h @@ -35,6 +35,7 @@ #include "chrome/common/extensions/extension.h" #include "chrome/common/extensions/extension_constants.h" #include "chrome/common/extensions/extension_set.h" +#include "chrome/common/extensions/manifest.h" #include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_registrar.h" #include "sync/api/string_ordinal.h" @@ -594,14 +595,14 @@ class ExtensionService const std::string& id, const Version* version, const FilePath& path, - extensions::Extension::Location location, + extensions::Manifest::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; + extensions::Manifest::Location location) OVERRIDE; virtual void OnExternalProviderReady( const extensions::ExternalProviderInterface* provider) OVERRIDE; diff --git a/chrome/browser/extensions/extension_service_unittest.cc b/chrome/browser/extensions/extension_service_unittest.cc index 60a1ca3..d86cbcf 100644 --- a/chrome/browser/extensions/extension_service_unittest.cc +++ b/chrome/browser/extensions/extension_service_unittest.cc @@ -121,6 +121,7 @@ using extensions::ExtensionCreator; using extensions::ExtensionPrefs; using extensions::ExtensionSystem; using extensions::FeatureSwitch; +using extensions::Manifest; using extensions::PermissionSet; using extensions::URLPatternSet; @@ -185,7 +186,7 @@ class MockExtensionProvider : public extensions::ExternalProviderInterface { public: MockExtensionProvider( VisitorInterface* visitor, - Extension::Location location) + Manifest::Location location) : location_(location), visitor_(visitor), visit_count_(0) { } @@ -221,7 +222,7 @@ class MockExtensionProvider : public extensions::ExternalProviderInterface { virtual bool GetExtensionDetails( const std::string& id, - Extension::Location* location, + Manifest::Location* location, scoped_ptr<Version>* version) const OVERRIDE { DataMap::const_iterator it = extension_map_.find(id); if (it == extension_map_.end()) @@ -251,7 +252,7 @@ class MockExtensionProvider : public extensions::ExternalProviderInterface { private: typedef std::map< std::string, std::pair<std::string, FilePath> > DataMap; DataMap extension_map_; - Extension::Location location_; + Manifest::Location location_; VisitorInterface* visitor_; // visit_count_ tracks the number of calls to VisitRegisteredExtension(). @@ -286,8 +287,8 @@ class MockProviderVisitor provider_.reset(new extensions::ExternalProviderImpl( this, new extensions::ExternalTestingLoader(json_data, fake_base_path_), - Extension::EXTERNAL_PREF, - Extension::EXTERNAL_PREF_DOWNLOAD, + Manifest::EXTERNAL_PREF, + Manifest::EXTERNAL_PREF_DOWNLOAD, Extension::NO_FLAGS)); // We also parse the file into a dictionary to compare what we get back @@ -315,7 +316,7 @@ class MockProviderVisitor virtual bool OnExternalExtensionFileFound(const std::string& id, const Version* version, const FilePath& path, - Extension::Location unused, + Manifest::Location unused, int creation_flags, bool mark_acknowledged) { EXPECT_EQ(expected_creation_flags_, creation_flags); @@ -336,7 +337,7 @@ class MockProviderVisitor EXPECT_TRUE(provider_->HasExtension(id)); // Ask provider if the extension we got back is registered. - Extension::Location location = Extension::INVALID; + Manifest::Location location = Manifest::INVALID_LOCATION; scoped_ptr<Version> v1; FilePath crx_path; @@ -347,7 +348,7 @@ class MockProviderVisitor EXPECT_TRUE(provider_->GetExtensionDetails(id, &location, &v2)); EXPECT_STREQ(version->GetString().c_str(), v1->GetString().c_str()); EXPECT_STREQ(version->GetString().c_str(), v2->GetString().c_str()); - EXPECT_EQ(Extension::EXTERNAL_PREF, location); + EXPECT_EQ(Manifest::EXTERNAL_PREF, location); // Remove it so we won't count it ever again. prefs_->Remove(id, NULL); @@ -357,7 +358,7 @@ class MockProviderVisitor virtual bool OnExternalExtensionUpdateUrlFound( const std::string& id, const GURL& update_url, - Extension::Location location) { + Manifest::Location location) { ++ids_found_; DictionaryValue* pref; // This tests is to make sure that the provider only notifies us of the @@ -365,17 +366,17 @@ class MockProviderVisitor // dictionary then something is wrong. EXPECT_TRUE(prefs_->GetDictionary(id, &pref)) << L"Got back ID (" << id.c_str() << ") we weren't expecting"; - EXPECT_EQ(Extension::EXTERNAL_PREF_DOWNLOAD, location); + EXPECT_EQ(Manifest::EXTERNAL_PREF_DOWNLOAD, location); if (pref) { EXPECT_TRUE(provider_->HasExtension(id)); // External extensions with update URLs do not have versions. scoped_ptr<Version> v1; - Extension::Location location1 = Extension::INVALID; + Manifest::Location location1 = Manifest::INVALID_LOCATION; EXPECT_TRUE(provider_->GetExtensionDetails(id, &location1, &v1)); EXPECT_FALSE(v1.get()); - EXPECT_EQ(Extension::EXTERNAL_PREF_DOWNLOAD, location1); + EXPECT_EQ(Manifest::EXTERNAL_PREF_DOWNLOAD, location1); // Remove it so we won't count it again. prefs_->Remove(id, NULL); @@ -602,7 +603,7 @@ class ExtensionServiceTest protected: void TestExternalProvider(MockExtensionProvider* provider, - Extension::Location location); + Manifest::Location location); void PackCRX(const FilePath& dir_path, const FilePath& pem_path, @@ -700,7 +701,7 @@ class ExtensionServiceTest } const Extension* InstallCRXWithLocation(const FilePath& crx_path, - Extension::Location install_location, + Manifest::Location install_location, InstallState install_state) { EXPECT_TRUE(file_util::PathExists(crx_path)) << "Path does not exist: "<< crx_path.value().c_str(); @@ -1124,17 +1125,17 @@ TEST_F(ExtensionServiceTest, LoadAllExtensionsFromDirectorySuccess) { loaded_[0]->name()); EXPECT_EQ(std::string("The first extension that I made."), loaded_[0]->description()); - EXPECT_EQ(Extension::INTERNAL, loaded_[0]->location()); + EXPECT_EQ(Manifest::INTERNAL, loaded_[0]->location()); EXPECT_TRUE(service_->GetExtensionById(loaded_[0]->id(), false)); EXPECT_EQ(expected_num_extensions, service_->extensions()->size()); ValidatePrefKeyCount(3); ValidateIntegerPref(good0, "state", Extension::ENABLED); - ValidateIntegerPref(good0, "location", Extension::INTERNAL); + ValidateIntegerPref(good0, "location", Manifest::INTERNAL); ValidateIntegerPref(good1, "state", Extension::ENABLED); - ValidateIntegerPref(good1, "location", Extension::INTERNAL); + ValidateIntegerPref(good1, "location", Manifest::INTERNAL); ValidateIntegerPref(good2, "state", Extension::ENABLED); - ValidateIntegerPref(good2, "location", Extension::INTERNAL); + ValidateIntegerPref(good2, "location", Manifest::INTERNAL); URLPatternSet expected_patterns; AddPattern(&expected_patterns, "file:///*"); @@ -1194,14 +1195,14 @@ TEST_F(ExtensionServiceTest, LoadAllExtensionsFromDirectorySuccess) { EXPECT_FALSE(loaded_[1]->plugins()[1].is_public); #endif - EXPECT_EQ(Extension::INTERNAL, loaded_[1]->location()); + EXPECT_EQ(Manifest::INTERNAL, loaded_[1]->location()); int index = expected_num_extensions - 1; EXPECT_EQ(std::string(good2), loaded_[index]->id()); EXPECT_EQ(std::string("My extension 3"), loaded_[index]->name()); EXPECT_EQ(std::string(""), loaded_[index]->description()); EXPECT_EQ(0u, loaded_[index]->content_scripts().size()); - EXPECT_EQ(Extension::INTERNAL, loaded_[index]->location()); + EXPECT_EQ(Manifest::INTERNAL, loaded_[index]->location()); }; // Test loading bad extensions from the profile directory. @@ -1378,14 +1379,14 @@ TEST_F(ExtensionServiceTest, InstallExtension) { int pref_count = 0; ValidatePrefKeyCount(++pref_count); ValidateIntegerPref(good_crx, "state", Extension::ENABLED); - ValidateIntegerPref(good_crx, "location", Extension::INTERNAL); + ValidateIntegerPref(good_crx, "location", Manifest::INTERNAL); // An extension with page actions. path = data_dir_.AppendASCII("page_action.crx"); InstallCRX(path, INSTALL_NEW); ValidatePrefKeyCount(++pref_count); ValidateIntegerPref(page_action, "state", Extension::ENABLED); - ValidateIntegerPref(page_action, "location", Extension::INTERNAL); + ValidateIntegerPref(page_action, "location", Manifest::INTERNAL); // Bad signature. path = data_dir_.AppendASCII("bad_signature.crx"); @@ -1430,7 +1431,7 @@ TEST_F(ExtensionServiceTest, InstallingExternalExtensionWithFlags) { good_crx, &version, path, - Extension::EXTERNAL_PREF, + Manifest::EXTERNAL_PREF, Extension::FROM_BOOKMARK, false /* mark_acknowledged */); loop_.RunUntilIdle(); @@ -1459,7 +1460,7 @@ TEST_F(ExtensionServiceTest, UninstallingExternalExtensions) { Version version("1.0.0.0"); // Install an external extension. service_->OnExternalExtensionFileFound(good_crx, &version, - path, Extension::EXTERNAL_PREF, + path, Manifest::EXTERNAL_PREF, Extension::NO_FLAGS, false); loop_.RunUntilIdle(); ASSERT_TRUE(service_->GetExtensionById(good_crx, false)); @@ -1471,7 +1472,7 @@ TEST_F(ExtensionServiceTest, UninstallingExternalExtensions) { // Try to re-install it externally. This should fail because of the killbit. service_->OnExternalExtensionFileFound(good_crx, &version, - path, Extension::EXTERNAL_PREF, + path, Manifest::EXTERNAL_PREF, Extension::NO_FLAGS, false); loop_.RunUntilIdle(); ASSERT_TRUE(NULL == service_->GetExtensionById(good_crx, false)); @@ -1482,7 +1483,7 @@ TEST_F(ExtensionServiceTest, UninstallingExternalExtensions) { // Repeat the same thing with a newer version of the extension. path = data_dir_.AppendASCII("good2.crx"); service_->OnExternalExtensionFileFound(good_crx, &version, - path, Extension::EXTERNAL_PREF, + path, Manifest::EXTERNAL_PREF, Extension::NO_FLAGS, false); loop_.RunUntilIdle(); ASSERT_TRUE(NULL == service_->GetExtensionById(good_crx, false)); @@ -1493,7 +1494,7 @@ TEST_F(ExtensionServiceTest, UninstallingExternalExtensions) { ASSERT_FALSE(service_->pending_extension_manager()->AddFromExternalUpdateUrl( good_crx, GURL("http:://fake.update/url"), - Extension::EXTERNAL_PREF_DOWNLOAD)); + Manifest::EXTERNAL_PREF_DOWNLOAD)); ASSERT_FALSE(service_->pending_extension_manager()->IsIdPending(good_crx)); } @@ -1522,7 +1523,7 @@ TEST_F(ExtensionServiceTest, UninstallingNotLoadedExtension) { // If we don't check whether the extension is loaded before we uninstall it // in CheckExternalUninstall, a crash will happen here because we will get or // dereference a NULL pointer (extension) inside UninstallExtension. - MockExtensionProvider provider(NULL, Extension::EXTERNAL_REGISTRY); + MockExtensionProvider provider(NULL, Manifest::EXTERNAL_REGISTRY); service_->OnExternalProviderReady(&provider); } @@ -1541,7 +1542,7 @@ TEST_F(ExtensionServiceTest, FailOnWrongId) { // Install an external extension with an ID from the external // source that is not equal to the ID in the extension manifest. service_->OnExternalExtensionFileFound( - wrong_id, &version, path, Extension::EXTERNAL_PREF, + wrong_id, &version, path, Manifest::EXTERNAL_PREF, Extension::NO_FLAGS, false); loop_.RunUntilIdle(); @@ -1549,7 +1550,7 @@ TEST_F(ExtensionServiceTest, FailOnWrongId) { // Try again with the right ID. Expect success. service_->OnExternalExtensionFileFound( - correct_id, &version, path, Extension::EXTERNAL_PREF, + correct_id, &version, path, Manifest::EXTERNAL_PREF, Extension::NO_FLAGS, false); loop_.RunUntilIdle(); ASSERT_TRUE(service_->GetExtensionById(good_crx, false)); @@ -1565,7 +1566,7 @@ TEST_F(ExtensionServiceTest, FailOnWrongVersion) { // source that is not equal to the version in the extension manifest. Version wrong_version("1.2.3.4"); service_->OnExternalExtensionFileFound( - good_crx, &wrong_version, path, Extension::EXTERNAL_PREF, + good_crx, &wrong_version, path, Manifest::EXTERNAL_PREF, Extension::NO_FLAGS, false); loop_.RunUntilIdle(); @@ -1575,7 +1576,7 @@ TEST_F(ExtensionServiceTest, FailOnWrongVersion) { service_->pending_extension_manager()->Remove(good_crx); Version correct_version("1.0.0.0"); service_->OnExternalExtensionFileFound( - good_crx, &correct_version, path, Extension::EXTERNAL_PREF, + good_crx, &correct_version, path, Manifest::EXTERNAL_PREF, Extension::NO_FLAGS, false); loop_.RunUntilIdle(); ASSERT_TRUE(service_->GetExtensionById(good_crx, false)); @@ -2062,7 +2063,7 @@ TEST_F(ExtensionServiceTest, InstallTheme) { int pref_count = 0; ValidatePrefKeyCount(++pref_count); ValidateIntegerPref(theme_crx, "state", Extension::ENABLED); - ValidateIntegerPref(theme_crx, "location", Extension::INTERNAL); + ValidateIntegerPref(theme_crx, "location", Manifest::INTERNAL); // A theme when extensions are disabled. Themes can be installed, even when // extensions are disabled. @@ -2071,7 +2072,7 @@ TEST_F(ExtensionServiceTest, InstallTheme) { InstallCRX(path, INSTALL_NEW); ValidatePrefKeyCount(++pref_count); ValidateIntegerPref(theme2_crx, "state", Extension::ENABLED); - ValidateIntegerPref(theme2_crx, "location", Extension::INTERNAL); + ValidateIntegerPref(theme2_crx, "location", Manifest::INTERNAL); // A theme with extension elements. Themes cannot have extension elements, // so any such elements (like content scripts) should be ignored. @@ -2213,7 +2214,7 @@ TEST_F(ExtensionServiceTest, InstallApps) { ValidatePrefKeyCount(++pref_count); ASSERT_EQ(1u, service_->extensions()->size()); ValidateIntegerPref(app->id(), "state", Extension::ENABLED); - ValidateIntegerPref(app->id(), "location", Extension::INTERNAL); + ValidateIntegerPref(app->id(), "location", Manifest::INTERNAL); // Another app with non-overlapping extent. Should succeed. PackAndInstallCRX(data_dir_.AppendASCII("app2"), INSTALL_NEW); @@ -2409,14 +2410,14 @@ TEST_F(ExtensionServiceTest, Reinstall) { ValidatePrefKeyCount(1); ValidateIntegerPref(good_crx, "state", Extension::ENABLED); - ValidateIntegerPref(good_crx, "location", Extension::INTERNAL); + ValidateIntegerPref(good_crx, "location", Manifest::INTERNAL); // Reinstall the same version, it should overwrite the previous one. InstallCRX(path, INSTALL_UPDATED); ValidatePrefKeyCount(1); ValidateIntegerPref(good_crx, "state", Extension::ENABLED); - ValidateIntegerPref(good_crx, "location", Extension::INTERNAL); + ValidateIntegerPref(good_crx, "location", Manifest::INTERNAL); } // Test that we can determine if extensions came from the @@ -2598,7 +2599,7 @@ TEST_F(ExtensionServiceTest, UpdateExtensionPreservesLocation) { FilePath path = data_dir_.AppendASCII("good.crx"); const Extension* good = - InstallCRXWithLocation(path, Extension::EXTERNAL_PREF, INSTALL_NEW); + InstallCRXWithLocation(path, Manifest::EXTERNAL_PREF, INSTALL_NEW); ASSERT_EQ("1.0.0.0", good->VersionString()); ASSERT_EQ(good_crx, good->id()); @@ -2607,7 +2608,7 @@ TEST_F(ExtensionServiceTest, UpdateExtensionPreservesLocation) { UpdateExtension(good_crx, path, ENABLED); const Extension* good2 = service_->GetExtensionById(good_crx, false); ASSERT_EQ("1.0.0.1", good2->version()->GetString()); - EXPECT_EQ(good2->location(), Extension::EXTERNAL_PREF); + EXPECT_EQ(good2->location(), Manifest::EXTERNAL_PREF); } // Makes sure that LOAD extension types can downgrade. @@ -2637,7 +2638,7 @@ TEST_F(ExtensionServiceTest, LoadExtensionsCanDowngrade) { EXPECT_EQ(0u, GetErrors().size()); ASSERT_EQ(1u, loaded_.size()); - EXPECT_EQ(Extension::LOAD, loaded_[0]->location()); + EXPECT_EQ(Manifest::LOAD, loaded_[0]->location()); EXPECT_EQ(1u, service_->extensions()->size()); EXPECT_EQ("2.0", loaded_[0]->VersionString()); @@ -2651,7 +2652,7 @@ TEST_F(ExtensionServiceTest, LoadExtensionsCanDowngrade) { EXPECT_EQ(0u, GetErrors().size()); ASSERT_EQ(1u, loaded_.size()); - EXPECT_EQ(Extension::LOAD, loaded_[0]->location()); + EXPECT_EQ(Manifest::LOAD, loaded_[0]->location()); EXPECT_EQ(1u, service_->extensions()->size()); EXPECT_EQ("1.0", loaded_[0]->VersionString()); } @@ -2739,7 +2740,7 @@ TEST_F(ExtensionServiceTest, LoadExtensionsWithPlugins) { namespace { bool IsExtension(const Extension& extension) { - return extension.GetType() == Extension::TYPE_EXTENSION; + return extension.GetType() == Manifest::TYPE_EXTENSION; } } // namespace @@ -2829,7 +2830,7 @@ TEST_F(ExtensionServiceTest, DISABLED_UpdatePendingTheme) { TEST_F(ExtensionServiceTest, MAYBE_UpdatePendingExternalCrx) { InitializeEmptyExtensionService(); EXPECT_TRUE(service_->pending_extension_manager()->AddFromExternalUpdateUrl( - theme_crx, GURL(), Extension::EXTERNAL_PREF_DOWNLOAD)); + theme_crx, GURL(), Manifest::EXTERNAL_PREF_DOWNLOAD)); EXPECT_TRUE(service_->pending_extension_manager()->IsIdPending(theme_crx)); @@ -2866,13 +2867,13 @@ TEST_F(ExtensionServiceTest, UpdatePendingExternalCrxWinsOverSync) { // Add a crx to be updated, with the same ID, from a non-sync source. EXPECT_TRUE(service_->pending_extension_manager()->AddFromExternalUpdateUrl( - kGoodId, GURL(kGoodUpdateURL), Extension::EXTERNAL_PREF_DOWNLOAD)); + kGoodId, GURL(kGoodUpdateURL), Manifest::EXTERNAL_PREF_DOWNLOAD)); // Check that there is a pending crx, with is_from_sync set to false. ASSERT_TRUE((pending_extension_info = service_->pending_extension_manager()-> GetById(kGoodId))); EXPECT_FALSE(pending_extension_info->is_from_sync()); - EXPECT_EQ(Extension::EXTERNAL_PREF_DOWNLOAD, + EXPECT_EQ(Manifest::EXTERNAL_PREF_DOWNLOAD, pending_extension_info->install_source()); // Add a crx to be installed from the update mechanism. @@ -2884,7 +2885,7 @@ TEST_F(ExtensionServiceTest, UpdatePendingExternalCrxWinsOverSync) { ASSERT_TRUE((pending_extension_info = service_->pending_extension_manager()-> GetById(kGoodId))); EXPECT_FALSE(pending_extension_info->is_from_sync()); - EXPECT_EQ(Extension::EXTERNAL_PREF_DOWNLOAD, + EXPECT_EQ(Manifest::EXTERNAL_PREF_DOWNLOAD, pending_extension_info->install_source()); } @@ -2955,7 +2956,7 @@ TEST_F(ExtensionServiceTest, UpdatePendingExtensionAlreadyInstalled) { service_->pending_extension_manager()->AddExtensionImpl( good->id(), extensions::ManifestURL::GetUpdateURL(good), Version(), &IsExtension, kGoodIsFromSync, - kGoodInstallSilently, Extension::INTERNAL); + kGoodInstallSilently, Manifest::INTERNAL); UpdateExtension(good->id(), path, ENABLED); EXPECT_FALSE(service_->pending_extension_manager()->IsIdPending(kGoodId)); @@ -3234,7 +3235,7 @@ TEST_F(ExtensionServiceTest, PolicyInstalledExtensionsWhitelisted) { // Have policy force-install an extension. MockExtensionProvider* provider = new MockExtensionProvider(service_, - Extension::EXTERNAL_POLICY_DOWNLOAD); + Manifest::EXTERNAL_POLICY_DOWNLOAD); AddMockExternalProvider(provider); provider->UpdateOrAddExtension(good_crx, "1.0.0.0", data_dir_.AppendASCII("good.crx")); @@ -3289,7 +3290,7 @@ TEST_F(ExtensionServiceTest, ManagementPolicyProhibitsLoadFromPrefs) { // though we're testing loading from prefs, so that we don't need to provide // an extension key. extensions::ExtensionInfo extension_info(&manifest, "", path, - Extension::LOAD); + Manifest::LOAD); // Ensure we can load it with no management policy in place. management_policy_->UnregisterAllProviders(); @@ -3403,7 +3404,7 @@ TEST_F(ExtensionServiceTest, ExternalExtensionAutoAcknowledgement) { { // Register and install an external extension. MockExtensionProvider* provider = - new MockExtensionProvider(service_, Extension::EXTERNAL_PREF); + new MockExtensionProvider(service_, Manifest::EXTERNAL_PREF); AddMockExternalProvider(provider); provider->UpdateOrAddExtension(good_crx, "1.0.0.0", data_dir_.AppendASCII("good.crx")); @@ -3412,7 +3413,7 @@ TEST_F(ExtensionServiceTest, ExternalExtensionAutoAcknowledgement) { // Have policy force-install an extension. MockExtensionProvider* provider = new MockExtensionProvider(service_, - Extension::EXTERNAL_POLICY_DOWNLOAD); + Manifest::EXTERNAL_POLICY_DOWNLOAD); AddMockExternalProvider(provider); provider->UpdateOrAddExtension(page_action, "1.0.0.0", data_dir_.AppendASCII("page_action.crx")); @@ -3451,8 +3452,8 @@ TEST_F(ExtensionServiceTest, DefaultAppsInstall) { profile_.get(), service_, new extensions::ExternalTestingLoader(json_data, data_dir_), - Extension::INTERNAL, - Extension::INVALID, + Manifest::INTERNAL, + Manifest::INVALID_LOCATION, Extension::FROM_WEBSTORE | Extension::WAS_INSTALLED_BY_DEFAULT); AddMockExternalProvider(provider); @@ -3974,7 +3975,7 @@ TEST_F(ExtensionServiceTest, LoadExtension) { loop_.RunUntilIdle(); EXPECT_EQ(0u, GetErrors().size()); ASSERT_EQ(1u, loaded_.size()); - EXPECT_EQ(Extension::LOAD, loaded_[0]->location()); + EXPECT_EQ(Manifest::LOAD, loaded_[0]->location()); EXPECT_EQ(1u, service_->extensions()->size()); ValidatePrefKeyCount(1); @@ -4011,7 +4012,7 @@ TEST_F(ExtensionServiceTest, GenerateID) { EXPECT_EQ(0u, GetErrors().size()); ASSERT_EQ(1u, loaded_.size()); ASSERT_TRUE(Extension::IdIsValid(loaded_[0]->id())); - EXPECT_EQ(loaded_[0]->location(), Extension::LOAD); + EXPECT_EQ(loaded_[0]->location(), Manifest::LOAD); ValidatePrefKeyCount(1); @@ -4025,7 +4026,7 @@ TEST_F(ExtensionServiceTest, GenerateID) { } void ExtensionServiceTest::TestExternalProvider( - MockExtensionProvider* provider, Extension::Location location) { + MockExtensionProvider* provider, Manifest::Location location) { // Verify that starting with no providers loads no extensions. service_->Init(); ASSERT_EQ(0u, loaded_.size()); @@ -4165,9 +4166,9 @@ TEST_F(ExtensionServiceTest, ExternalInstallRegistry) { // Now add providers. Extension system takes ownership of the objects. MockExtensionProvider* reg_provider = - new MockExtensionProvider(service_, Extension::EXTERNAL_REGISTRY); + new MockExtensionProvider(service_, Manifest::EXTERNAL_REGISTRY); AddMockExternalProvider(reg_provider); - TestExternalProvider(reg_provider, Extension::EXTERNAL_REGISTRY); + TestExternalProvider(reg_provider, Manifest::EXTERNAL_REGISTRY); } #endif @@ -4176,10 +4177,10 @@ TEST_F(ExtensionServiceTest, ExternalInstallPref) { // Now add providers. Extension system takes ownership of the objects. MockExtensionProvider* pref_provider = - new MockExtensionProvider(service_, Extension::EXTERNAL_PREF); + new MockExtensionProvider(service_, Manifest::EXTERNAL_PREF); AddMockExternalProvider(pref_provider); - TestExternalProvider(pref_provider, Extension::EXTERNAL_PREF); + TestExternalProvider(pref_provider, Manifest::EXTERNAL_PREF); } TEST_F(ExtensionServiceTest, ExternalInstallPrefUpdateUrl) { @@ -4196,9 +4197,9 @@ TEST_F(ExtensionServiceTest, ExternalInstallPrefUpdateUrl) { // installed. MockExtensionProvider* pref_provider = new MockExtensionProvider(service_, - Extension::EXTERNAL_PREF_DOWNLOAD); + Manifest::EXTERNAL_PREF_DOWNLOAD); AddMockExternalProvider(pref_provider); - TestExternalProvider(pref_provider, Extension::EXTERNAL_PREF_DOWNLOAD); + TestExternalProvider(pref_provider, Manifest::EXTERNAL_PREF_DOWNLOAD); } TEST_F(ExtensionServiceTest, ExternalInstallPolicyUpdateUrl) { @@ -4215,9 +4216,9 @@ TEST_F(ExtensionServiceTest, ExternalInstallPolicyUpdateUrl) { // installed. MockExtensionProvider* pref_provider = new MockExtensionProvider(service_, - Extension::EXTERNAL_POLICY_DOWNLOAD); + Manifest::EXTERNAL_POLICY_DOWNLOAD); AddMockExternalProvider(pref_provider); - TestExternalProvider(pref_provider, Extension::EXTERNAL_POLICY_DOWNLOAD); + TestExternalProvider(pref_provider, Manifest::EXTERNAL_POLICY_DOWNLOAD); } // Tests that external extensions get uninstalled when the external extension @@ -4255,7 +4256,7 @@ TEST_F(ExtensionServiceTest, MultipleExternalUpdateCheck) { InitializeEmptyExtensionService(); MockExtensionProvider* provider = - new MockExtensionProvider(service_, Extension::EXTERNAL_PREF); + new MockExtensionProvider(service_, Manifest::EXTERNAL_PREF); AddMockExternalProvider(provider); // Verify that starting with no providers loads no extensions. @@ -4286,11 +4287,11 @@ TEST_F(ExtensionServiceTest, MultipleExternalUpdateCheck) { EXPECT_EQ(2, provider->visit_count()); ASSERT_EQ(0u, GetErrors().size()); ASSERT_EQ(1u, loaded_.size()); - ASSERT_EQ(Extension::EXTERNAL_PREF, loaded_[0]->location()); + ASSERT_EQ(Manifest::EXTERNAL_PREF, loaded_[0]->location()); ASSERT_EQ("1.0.0.0", loaded_[0]->version()->GetString()); ValidatePrefKeyCount(1); ValidateIntegerPref(good_crx, "state", Extension::ENABLED); - ValidateIntegerPref(good_crx, "location", Extension::EXTERNAL_PREF); + ValidateIntegerPref(good_crx, "location", Manifest::EXTERNAL_PREF); provider->RemoveExtension(good_crx); provider->set_visit_count(0); @@ -4695,7 +4696,7 @@ TEST_F(ExtensionServiceTest, ComponentExtensions) { EXPECT_EQ(0u, GetErrors().size()); ASSERT_EQ(1u, loaded_.size()); - EXPECT_EQ(Extension::COMPONENT, loaded_[0]->location()); + EXPECT_EQ(Manifest::COMPONENT, loaded_[0]->location()); EXPECT_EQ(1u, service_->extensions()->size()); // Component extensions get a prefs entry on first install. @@ -4835,7 +4836,7 @@ TEST_F(ExtensionServiceTest, GetSyncExtensionDataUserSettings) { TEST_F(ExtensionServiceTest, SyncForUninstalledExternalExtension) { InitializeEmptyExtensionService(); InstallCRXWithLocation(data_dir_.AppendASCII("good.crx"), - Extension::EXTERNAL_PREF, INSTALL_NEW); + Manifest::EXTERNAL_PREF, INSTALL_NEW); const Extension* extension = service_->GetInstalledExtension(good_crx); ASSERT_TRUE(extension); @@ -5271,7 +5272,7 @@ TEST_F(ExtensionServiceTest, ProcessSyncDataNotInstalled) { EXPECT_EQ(ext_specifics->update_url(), info->update_url().spec()); EXPECT_TRUE(info->is_from_sync()); EXPECT_TRUE(info->install_silently()); - EXPECT_EQ(Extension::INTERNAL, info->install_source()); + EXPECT_EQ(Manifest::INTERNAL, info->install_source()); // TODO(akalin): Figure out a way to test |info.ShouldAllowInstall()|. } @@ -5282,7 +5283,7 @@ TEST_F(ExtensionServiceTest, InstallPriorityExternalUpdateUrl) { InstallCRX(path, INSTALL_NEW); ValidatePrefKeyCount(1u); ValidateIntegerPref(good_crx, "state", Extension::ENABLED); - ValidateIntegerPref(good_crx, "location", Extension::INTERNAL); + ValidateIntegerPref(good_crx, "location", Manifest::INTERNAL); extensions::PendingExtensionManager* pending = service_->pending_extension_manager(); @@ -5291,19 +5292,19 @@ TEST_F(ExtensionServiceTest, InstallPriorityExternalUpdateUrl) { // Skip install when the location is the same. EXPECT_FALSE( service_->OnExternalExtensionUpdateUrlFound( - kGoodId, GURL(kGoodUpdateURL), Extension::INTERNAL)); + kGoodId, GURL(kGoodUpdateURL), Manifest::INTERNAL)); EXPECT_FALSE(pending->IsIdPending(kGoodId)); // Install when the location has higher priority. EXPECT_TRUE( service_->OnExternalExtensionUpdateUrlFound( - kGoodId, GURL(kGoodUpdateURL), Extension::EXTERNAL_POLICY_DOWNLOAD)); + kGoodId, GURL(kGoodUpdateURL), Manifest::EXTERNAL_POLICY_DOWNLOAD)); EXPECT_TRUE(pending->IsIdPending(kGoodId)); // Try the low priority again. Should be rejected. EXPECT_FALSE( service_->OnExternalExtensionUpdateUrlFound( - kGoodId, GURL(kGoodUpdateURL), Extension::EXTERNAL_PREF_DOWNLOAD)); + kGoodId, GURL(kGoodUpdateURL), Manifest::EXTERNAL_PREF_DOWNLOAD)); // The existing record should still be present in the pending extension // manager. EXPECT_TRUE(pending->IsIdPending(kGoodId)); @@ -5313,7 +5314,7 @@ TEST_F(ExtensionServiceTest, InstallPriorityExternalUpdateUrl) { // Skip install when the location has the same priority as the installed // location. EXPECT_FALSE(service_->OnExternalExtensionUpdateUrlFound( - kGoodId, GURL(kGoodUpdateURL), Extension::INTERNAL)); + kGoodId, GURL(kGoodUpdateURL), Manifest::INTERNAL)); EXPECT_FALSE(pending->IsIdPending(kGoodId)); } @@ -5336,15 +5337,15 @@ TEST_F(ExtensionServiceTest, InstallPriorityExternalLocalFile) { // sources: Registry (EXTERNAL_REGISTRY) overrides external pref // (EXTERNAL_PREF), and external pref overrides user install (INTERNAL). // The following assertions verify these assumptions: - ASSERT_EQ(Extension::EXTERNAL_REGISTRY, - Extension::GetHigherPriorityLocation(Extension::EXTERNAL_REGISTRY, - Extension::EXTERNAL_PREF)); - ASSERT_EQ(Extension::EXTERNAL_REGISTRY, - Extension::GetHigherPriorityLocation(Extension::EXTERNAL_REGISTRY, - Extension::INTERNAL)); - ASSERT_EQ(Extension::EXTERNAL_PREF, - Extension::GetHigherPriorityLocation(Extension::EXTERNAL_PREF, - Extension::INTERNAL)); + ASSERT_EQ(Manifest::EXTERNAL_REGISTRY, + Manifest::GetHigherPriorityLocation(Manifest::EXTERNAL_REGISTRY, + Manifest::EXTERNAL_PREF)); + ASSERT_EQ(Manifest::EXTERNAL_REGISTRY, + Manifest::GetHigherPriorityLocation(Manifest::EXTERNAL_REGISTRY, + Manifest::INTERNAL)); + ASSERT_EQ(Manifest::EXTERNAL_PREF, + Manifest::GetHigherPriorityLocation(Manifest::EXTERNAL_PREF, + Manifest::INTERNAL)); extensions::PendingExtensionManager* pending = service_->pending_extension_manager(); @@ -5354,7 +5355,7 @@ TEST_F(ExtensionServiceTest, InstallPriorityExternalLocalFile) { EXPECT_TRUE( service_->OnExternalExtensionFileFound( kGoodId, &older_version, kInvalidPathToCrx, - Extension::INTERNAL, kCreationFlags, kDontMarkAcknowledged)); + Manifest::INTERNAL, kCreationFlags, kDontMarkAcknowledged)); EXPECT_TRUE(pending->IsIdPending(kGoodId)); WaitForCrxInstall(kInvalidPathToCrx, INSTALL_FAILED); @@ -5362,7 +5363,7 @@ TEST_F(ExtensionServiceTest, InstallPriorityExternalLocalFile) { EXPECT_TRUE( service_->OnExternalExtensionFileFound( kGoodId, &older_version, kInvalidPathToCrx, - Extension::EXTERNAL_PREF, kCreationFlags, kDontMarkAcknowledged)); + Manifest::EXTERNAL_PREF, kCreationFlags, kDontMarkAcknowledged)); EXPECT_TRUE(pending->IsIdPending(kGoodId)); WaitForCrxInstall(kInvalidPathToCrx, INSTALL_FAILED); @@ -5372,21 +5373,21 @@ TEST_F(ExtensionServiceTest, InstallPriorityExternalLocalFile) { EXPECT_FALSE( service_->OnExternalExtensionFileFound( kGoodId, &older_version, kInvalidPathToCrx, - Extension::EXTERNAL_PREF, kCreationFlags, kDontMarkAcknowledged)); + Manifest::EXTERNAL_PREF, kCreationFlags, kDontMarkAcknowledged)); EXPECT_TRUE(pending->IsIdPending(kGoodId)); // Try INTERNAL again. Should fail. EXPECT_FALSE( service_->OnExternalExtensionFileFound( kGoodId, &older_version, kInvalidPathToCrx, - Extension::INTERNAL, kCreationFlags, kDontMarkAcknowledged)); + Manifest::INTERNAL, kCreationFlags, kDontMarkAcknowledged)); EXPECT_TRUE(pending->IsIdPending(kGoodId)); // Now the registry adds the extension. EXPECT_TRUE( service_->OnExternalExtensionFileFound( kGoodId, &older_version, kInvalidPathToCrx, - Extension::EXTERNAL_REGISTRY, kCreationFlags, kDontMarkAcknowledged)); + Manifest::EXTERNAL_REGISTRY, kCreationFlags, kDontMarkAcknowledged)); EXPECT_TRUE(pending->IsIdPending(kGoodId)); WaitForCrxInstall(kInvalidPathToCrx, INSTALL_FAILED); @@ -5394,13 +5395,13 @@ TEST_F(ExtensionServiceTest, InstallPriorityExternalLocalFile) { EXPECT_FALSE( service_->OnExternalExtensionFileFound( kGoodId, &older_version, kInvalidPathToCrx, - Extension::EXTERNAL_PREF, kCreationFlags, kDontMarkAcknowledged)); + Manifest::EXTERNAL_PREF, kCreationFlags, kDontMarkAcknowledged)); EXPECT_TRUE(pending->IsIdPending(kGoodId)); EXPECT_FALSE( service_->OnExternalExtensionFileFound( kGoodId, &older_version, kInvalidPathToCrx, - Extension::INTERNAL, kCreationFlags, kDontMarkAcknowledged)); + Manifest::INTERNAL, kCreationFlags, kDontMarkAcknowledged)); EXPECT_TRUE(pending->IsIdPending(kGoodId)); pending->Remove(kGoodId); @@ -5410,7 +5411,7 @@ TEST_F(ExtensionServiceTest, InstallPriorityExternalLocalFile) { const Extension* ext = InstallCRX(path, INSTALL_NEW); ValidatePrefKeyCount(1u); ValidateIntegerPref(good_crx, "state", Extension::ENABLED); - ValidateIntegerPref(good_crx, "location", Extension::INTERNAL); + ValidateIntegerPref(good_crx, "location", Manifest::INTERNAL); // Now test the logic of OnExternalExtensionFileFound() when the extension // being added is already installed. @@ -5427,21 +5428,21 @@ TEST_F(ExtensionServiceTest, InstallPriorityExternalLocalFile) { EXPECT_FALSE( service_->OnExternalExtensionFileFound( kGoodId, &older_version, kInvalidPathToCrx, - Extension::INTERNAL, kCreationFlags, kDontMarkAcknowledged)); + Manifest::INTERNAL, kCreationFlags, kDontMarkAcknowledged)); EXPECT_FALSE(pending->IsIdPending(kGoodId)); // Same version as the installed version... EXPECT_FALSE( service_->OnExternalExtensionFileFound( kGoodId, ext->version(), kInvalidPathToCrx, - Extension::INTERNAL, kCreationFlags, kDontMarkAcknowledged)); + Manifest::INTERNAL, kCreationFlags, kDontMarkAcknowledged)); EXPECT_FALSE(pending->IsIdPending(kGoodId)); // Newer than the installed version... EXPECT_TRUE( service_->OnExternalExtensionFileFound( kGoodId, &newer_version, kInvalidPathToCrx, - Extension::INTERNAL, kCreationFlags, kDontMarkAcknowledged)); + Manifest::INTERNAL, kCreationFlags, kDontMarkAcknowledged)); EXPECT_TRUE(pending->IsIdPending(kGoodId)); // An external install for a higher priority install source should succeed @@ -5449,14 +5450,14 @@ TEST_F(ExtensionServiceTest, InstallPriorityExternalLocalFile) { EXPECT_FALSE( service_->OnExternalExtensionFileFound( kGoodId, &older_version, kInvalidPathToCrx, - Extension::EXTERNAL_PREF, kCreationFlags, kDontMarkAcknowledged)); + Manifest::EXTERNAL_PREF, kCreationFlags, kDontMarkAcknowledged)); EXPECT_TRUE(pending->IsIdPending(kGoodId)); // |newer_version| is newer. EXPECT_TRUE( service_->OnExternalExtensionFileFound( kGoodId, &newer_version, kInvalidPathToCrx, - Extension::EXTERNAL_PREF, kCreationFlags, kDontMarkAcknowledged)); + Manifest::EXTERNAL_PREF, kCreationFlags, kDontMarkAcknowledged)); EXPECT_TRUE(pending->IsIdPending(kGoodId)); // An external install for an even higher priority install source should @@ -5464,7 +5465,7 @@ TEST_F(ExtensionServiceTest, InstallPriorityExternalLocalFile) { EXPECT_TRUE( service_->OnExternalExtensionFileFound( kGoodId, &newer_version, kInvalidPathToCrx, - Extension::EXTERNAL_REGISTRY, kCreationFlags, kDontMarkAcknowledged)); + Manifest::EXTERNAL_REGISTRY, kCreationFlags, kDontMarkAcknowledged)); EXPECT_TRUE(pending->IsIdPending(kGoodId)); // Because EXTERNAL_PREF is a lower priority source than EXTERNAL_REGISTRY, @@ -5472,7 +5473,7 @@ TEST_F(ExtensionServiceTest, InstallPriorityExternalLocalFile) { EXPECT_FALSE( service_->OnExternalExtensionFileFound( kGoodId, &newer_version, kInvalidPathToCrx, - Extension::EXTERNAL_PREF, kCreationFlags, kDontMarkAcknowledged)); + Manifest::EXTERNAL_PREF, kCreationFlags, kDontMarkAcknowledged)); EXPECT_TRUE(pending->IsIdPending(kGoodId)); } @@ -5494,7 +5495,7 @@ TEST_F(ExtensionServiceTest, ConcurrentExternalLocalFile) { EXPECT_TRUE( service_->OnExternalExtensionFileFound( kGoodId, &kVersion123, kInvalidPathToCrx, - Extension::EXTERNAL_PREF, kCreationFlags, kDontMarkAcknowledged)); + Manifest::EXTERNAL_PREF, kCreationFlags, kDontMarkAcknowledged)); const extensions::PendingExtensionInfo* info; EXPECT_TRUE((info = pending->GetById(kGoodId))); EXPECT_TRUE(info->version().IsValid()); @@ -5504,7 +5505,7 @@ TEST_F(ExtensionServiceTest, ConcurrentExternalLocalFile) { EXPECT_TRUE( service_->OnExternalExtensionFileFound( kGoodId, &kVersion124, kInvalidPathToCrx, - Extension::EXTERNAL_PREF, kCreationFlags, kDontMarkAcknowledged)); + Manifest::EXTERNAL_PREF, kCreationFlags, kDontMarkAcknowledged)); EXPECT_TRUE((info = pending->GetById(kGoodId))); EXPECT_TRUE(info->version().IsValid()); EXPECT_TRUE(info->version().Equals(kVersion124)); @@ -5513,7 +5514,7 @@ TEST_F(ExtensionServiceTest, ConcurrentExternalLocalFile) { EXPECT_FALSE( service_->OnExternalExtensionFileFound( kGoodId, &kVersion123, kInvalidPathToCrx, - Extension::EXTERNAL_PREF, kCreationFlags, kDontMarkAcknowledged)); + Manifest::EXTERNAL_PREF, kCreationFlags, kDontMarkAcknowledged)); EXPECT_TRUE((info = pending->GetById(kGoodId))); EXPECT_TRUE(info->version().IsValid()); EXPECT_TRUE(info->version().Equals(kVersion124)); @@ -5523,7 +5524,7 @@ TEST_F(ExtensionServiceTest, ConcurrentExternalLocalFile) { EXPECT_FALSE( service_->OnExternalExtensionFileFound( kGoodId, &kVersion123, kInvalidPathToCrx, - Extension::EXTERNAL_REGISTRY, kCreationFlags, kDontMarkAcknowledged)); + Manifest::EXTERNAL_REGISTRY, kCreationFlags, kDontMarkAcknowledged)); EXPECT_TRUE((info = pending->GetById(kGoodId))); EXPECT_TRUE(info->version().IsValid()); EXPECT_TRUE(info->version().Equals(kVersion124)); @@ -5532,7 +5533,7 @@ TEST_F(ExtensionServiceTest, ConcurrentExternalLocalFile) { GURL kUpdateUrl("http://example.com/update"); EXPECT_TRUE( service_->OnExternalExtensionUpdateUrlFound( - kGoodId, kUpdateUrl, Extension::EXTERNAL_POLICY_DOWNLOAD)); + kGoodId, kUpdateUrl, Manifest::EXTERNAL_POLICY_DOWNLOAD)); EXPECT_TRUE((info = pending->GetById(kGoodId))); EXPECT_FALSE(info->version().IsValid()); } @@ -5576,7 +5577,7 @@ class ExtensionSourcePriorityTest : public ExtensionServiceTest { // Fake an external source adding a URL to fetch an extension from. bool AddPendingExternalPrefUrl() { return service_->pending_extension_manager()->AddFromExternalUpdateUrl( - crx_id_, GURL(), Extension::EXTERNAL_PREF_DOWNLOAD); + crx_id_, GURL(), Manifest::EXTERNAL_PREF_DOWNLOAD); } // Fake an external file from external_extensions.json. @@ -5584,7 +5585,7 @@ class ExtensionSourcePriorityTest : public ExtensionServiceTest { Version version("1.0.0.0"); return service_->OnExternalExtensionFileFound( - crx_id_, &version, crx_path_, Extension::EXTERNAL_PREF, + crx_id_, &version, crx_path_, Manifest::EXTERNAL_PREF, Extension::NO_FLAGS, false); } @@ -5598,11 +5599,11 @@ class ExtensionSourcePriorityTest : public ExtensionServiceTest { bool AddPendingPolicyInstall() { // Get path to the CRX with id |kGoodId|. return service_->OnExternalExtensionUpdateUrlFound( - crx_id_, GURL(), Extension::EXTERNAL_POLICY_DOWNLOAD); + crx_id_, GURL(), Manifest::EXTERNAL_POLICY_DOWNLOAD); } // Get the install source of a pending extension. - Extension::Location GetPendingLocation() { + Manifest::Location GetPendingLocation() { const extensions::PendingExtensionInfo* info; EXPECT_TRUE((info = service_->pending_extension_manager()-> GetById(crx_id_))); @@ -5644,18 +5645,18 @@ TEST_F(ExtensionSourcePriorityTest, PendingExternalFileOverSync) { // Install pending extension from sync. EXPECT_TRUE(AddPendingSyncInstall()); - ASSERT_EQ(Extension::INTERNAL, GetPendingLocation()); + ASSERT_EQ(Manifest::INTERNAL, GetPendingLocation()); EXPECT_TRUE(GetPendingIsFromSync()); ASSERT_FALSE(IsCrxInstalled()); // Install pending as external prefs json would. AddPendingExternalPrefFileInstall(); - ASSERT_EQ(Extension::EXTERNAL_PREF, GetPendingLocation()); + ASSERT_EQ(Manifest::EXTERNAL_PREF, GetPendingLocation()); ASSERT_FALSE(IsCrxInstalled()); // Another request from sync should be ignorred. EXPECT_FALSE(AddPendingSyncInstall()); - ASSERT_EQ(Extension::EXTERNAL_PREF, GetPendingLocation()); + ASSERT_EQ(Manifest::EXTERNAL_PREF, GetPendingLocation()); ASSERT_FALSE(IsCrxInstalled()); WaitForCrxInstall(crx_path_, INSTALL_NEW); @@ -5669,17 +5670,17 @@ TEST_F(ExtensionSourcePriorityTest, PendingExternalUrlOverSync) { ASSERT_FALSE(IsCrxInstalled()); EXPECT_TRUE(AddPendingSyncInstall()); - ASSERT_EQ(Extension::INTERNAL, GetPendingLocation()); + ASSERT_EQ(Manifest::INTERNAL, GetPendingLocation()); EXPECT_TRUE(GetPendingIsFromSync()); ASSERT_FALSE(IsCrxInstalled()); ASSERT_TRUE(AddPendingExternalPrefUrl()); - ASSERT_EQ(Extension::EXTERNAL_PREF_DOWNLOAD, GetPendingLocation()); + ASSERT_EQ(Manifest::EXTERNAL_PREF_DOWNLOAD, GetPendingLocation()); EXPECT_FALSE(GetPendingIsFromSync()); ASSERT_FALSE(IsCrxInstalled()); EXPECT_FALSE(AddPendingSyncInstall()); - ASSERT_EQ(Extension::EXTERNAL_PREF_DOWNLOAD, GetPendingLocation()); + ASSERT_EQ(Manifest::EXTERNAL_PREF_DOWNLOAD, GetPendingLocation()); EXPECT_FALSE(GetPendingIsFromSync()); ASSERT_FALSE(IsCrxInstalled()); } @@ -5716,7 +5717,7 @@ TEST_F(ExtensionServiceTest, ExternalInstallGlobalError) { InitializeEmptyExtensionService(); MockExtensionProvider* provider = - new MockExtensionProvider(service_, Extension::EXTERNAL_PREF); + new MockExtensionProvider(service_, Manifest::EXTERNAL_PREF); AddMockExternalProvider(provider); service_->UpdateExternalExtensionAlert(); @@ -5761,7 +5762,7 @@ TEST_F(ExtensionServiceTest, ExternalInstallInitiallyDisabled) { InitializeEmptyExtensionService(); MockExtensionProvider* provider = - new MockExtensionProvider(service_, Extension::EXTERNAL_PREF); + new MockExtensionProvider(service_, Manifest::EXTERNAL_PREF); AddMockExternalProvider(provider); provider->UpdateOrAddExtension(page_action, "1.0.0.0", @@ -5789,7 +5790,7 @@ TEST_F(ExtensionServiceTest, ExternalInstallMultiple) { InitializeEmptyExtensionService(); MockExtensionProvider* provider = - new MockExtensionProvider(service_, Extension::EXTERNAL_PREF); + new MockExtensionProvider(service_, Manifest::EXTERNAL_PREF); AddMockExternalProvider(provider); provider->UpdateOrAddExtension(page_action, "1.0.0.0", @@ -5821,10 +5822,10 @@ TEST_F(ExtensionServiceTest, WipeOutExtension) { InitializeEmptyExtensionService(); MockExtensionProvider* provider_registry = - new MockExtensionProvider(service_, Extension::EXTERNAL_REGISTRY); + new MockExtensionProvider(service_, Manifest::EXTERNAL_REGISTRY); AddMockExternalProvider(provider_registry); MockExtensionProvider* provider_pref = - new MockExtensionProvider(service_, Extension::EXTERNAL_PREF); + new MockExtensionProvider(service_, Manifest::EXTERNAL_PREF); AddMockExternalProvider(provider_pref); provider_registry->UpdateOrAddExtension(good_crx, "1.0.0.0", diff --git a/chrome/browser/extensions/extension_sorting_unittest.cc b/chrome/browser/extensions/extension_sorting_unittest.cc index dfee25d..d12a854 100644 --- a/chrome/browser/extensions/extension_sorting_unittest.cc +++ b/chrome/browser/extensions/extension_sorting_unittest.cc @@ -12,6 +12,7 @@ #include "testing/gtest/include/gtest/gtest.h" using extensions::Extension; +using extensions::Manifest; namespace keys = extension_manifest_keys; @@ -627,14 +628,14 @@ class ExtensionSortingPreinstalledAppsBase std::string error; app1_scoped_ = Extension::Create( - prefs_.temp_dir().AppendASCII("app1_"), Extension::EXTERNAL_PREF, + prefs_.temp_dir().AppendASCII("app1_"), Manifest::EXTERNAL_PREF, simple_dict, Extension::NO_FLAGS, &error); prefs()->OnExtensionInstalled(app1_scoped_.get(), Extension::ENABLED, syncer::StringOrdinal()); app2_scoped_ = Extension::Create( - prefs_.temp_dir().AppendASCII("app2_"), Extension::EXTERNAL_PREF, + prefs_.temp_dir().AppendASCII("app2_"), Manifest::EXTERNAL_PREF, simple_dict, Extension::NO_FLAGS, &error); prefs()->OnExtensionInstalled(app2_scoped_.get(), Extension::ENABLED, @@ -804,7 +805,7 @@ class ExtensionSortingDefaultOrdinalsBase : public ExtensionSortingTest { std::string errors; scoped_refptr<Extension> app = Extension::Create( - prefs_.temp_dir().AppendASCII(name), Extension::EXTERNAL_PREF, + prefs_.temp_dir().AppendASCII(name), Manifest::EXTERNAL_PREF, simple_dict, Extension::NO_FLAGS, &errors); EXPECT_TRUE(app) << errors; EXPECT_TRUE(Extension::IdIsValid(app->id())); diff --git a/chrome/browser/extensions/extension_special_storage_policy_unittest.cc b/chrome/browser/extensions/extension_special_storage_policy_unittest.cc index bb62491..4dd098a 100644 --- a/chrome/browser/extensions/extension_special_storage_policy_unittest.cc +++ b/chrome/browser/extensions/extension_special_storage_policy_unittest.cc @@ -10,6 +10,7 @@ #include "chrome/common/content_settings_types.h" #include "chrome/common/extensions/extension.h" #include "chrome/common/extensions/extension_manifest_constants.h" +#include "chrome/common/extensions/manifest.h" #include "chrome/common/extensions/manifest_handler.h" #include "chrome/common/extensions/web_intents_handler.h" #include "chrome/test/base/testing_profile.h" @@ -18,6 +19,7 @@ using content::BrowserThread; using extensions::Extension; +using extensions::Manifest; namespace keys = extension_manifest_keys; @@ -46,7 +48,8 @@ class ExtensionSpecialStoragePolicyTest : public testing::Test { manifest.Set(keys::kWebURLs, list); std::string error; scoped_refptr<Extension> protected_app = Extension::Create( - path, Extension::INVALID, manifest, Extension::NO_FLAGS, &error); + path, Manifest::INVALID_LOCATION, manifest, + Extension::NO_FLAGS, &error); EXPECT_TRUE(protected_app.get()) << error; return protected_app; } @@ -70,7 +73,8 @@ class ExtensionSpecialStoragePolicyTest : public testing::Test { manifest.Set(keys::kWebURLs, list); std::string error; scoped_refptr<Extension> unlimited_app = Extension::Create( - path, Extension::INVALID, manifest, Extension::NO_FLAGS, &error); + path, Manifest::INVALID_LOCATION, manifest, + Extension::NO_FLAGS, &error); EXPECT_TRUE(unlimited_app.get()) << error; return unlimited_app; } @@ -96,7 +100,7 @@ class ExtensionSpecialStoragePolicyTest : public testing::Test { manifest.Set(keys::kPermissions, list); std::string error; scoped_refptr<Extension> component_app = Extension::Create( - path, Extension::COMPONENT, manifest, Extension::NO_FLAGS, &error); + path, Manifest::COMPONENT, manifest, Extension::NO_FLAGS, &error); EXPECT_TRUE(component_app.get()) << error; return component_app; } @@ -121,7 +125,8 @@ class ExtensionSpecialStoragePolicyTest : public testing::Test { manifest.Set(keys::kPermissions, list); std::string error; scoped_refptr<Extension> handler_app = Extension::Create( - path, Extension::INVALID, manifest, Extension::NO_FLAGS, &error); + path, Manifest::INVALID_LOCATION, manifest, + Extension::NO_FLAGS, &error); EXPECT_TRUE(handler_app.get()) << error; return handler_app; } @@ -154,7 +159,8 @@ class ExtensionSpecialStoragePolicyTest : public testing::Test { std::string error; scoped_refptr<Extension> intent_app = Extension::Create( - path, Extension::INVALID, manifest, Extension::NO_FLAGS, &error); + path, Manifest::INVALID_LOCATION, manifest, + Extension::NO_FLAGS, &error); EXPECT_TRUE(intent_app.get()) << error; return intent_app; } diff --git a/chrome/browser/extensions/extension_startup_browsertest.cc b/chrome/browser/extensions/extension_startup_browsertest.cc index 8557af0..81921da 100644 --- a/chrome/browser/extensions/extension_startup_browsertest.cc +++ b/chrome/browser/extensions/extension_startup_browsertest.cc @@ -98,7 +98,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() != extensions::Extension::COMPONENT) + if ((*it)->location() != extensions::Manifest::COMPONENT) found_extensions++; ASSERT_EQ(static_cast<uint32>(num_expected_extensions), @@ -191,7 +191,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionsStartupTest, MAYBE_NoFileAccess) { browser()->profile())->extension_service(); for (ExtensionSet::const_iterator it = service->extensions()->begin(); it != service->extensions()->end(); ++it) { - if ((*it)->location() == extensions::Extension::COMPONENT) + if ((*it)->location() == extensions::Manifest::COMPONENT) continue; if (service->AllowFileAccess(*it)) extension_list.push_back(*it); diff --git a/chrome/browser/extensions/extension_system.cc b/chrome/browser/extensions/extension_system.cc index dd7d8a1..7a1d9e8 100644 --- a/chrome/browser/extensions/extension_system.cc +++ b/chrome/browser/extensions/extension_system.cc @@ -43,6 +43,7 @@ #include "chrome/common/chrome_version_info.h" #include "chrome/common/extensions/extension.h" #include "chrome/common/extensions/features/feature.h" +#include "chrome/common/extensions/manifest.h" #include "chrome/common/pref_names.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/url_data_source.h" @@ -431,7 +432,7 @@ Blacklist* ExtensionSystemImpl::blacklist() { void ExtensionSystemImpl::RegisterExtensionWithRequestContexts( const Extension* extension) { base::Time install_time; - if (extension->location() != Extension::COMPONENT) { + if (extension->location() != Manifest::COMPONENT) { install_time = extension_service()->extension_prefs()-> GetInstallTime(extension->id()); } diff --git a/chrome/browser/extensions/extension_ui_unittest.cc b/chrome/browser/extensions/extension_ui_unittest.cc index 8f06329..2d5ef01 100644 --- a/chrome/browser/extensions/extension_ui_unittest.cc +++ b/chrome/browser/extensions/extension_ui_unittest.cc @@ -18,6 +18,7 @@ #include "testing/gtest/include/gtest/gtest.h" using extensions::Extension; +using extensions::Manifest; class ExtensionUITest : public testing::Test { public: @@ -61,7 +62,7 @@ class ExtensionUITest : public testing::Test { DictionaryValue* CreateExtensionDetailViewFromPath( const FilePath& extension_path, const std::vector<ExtensionPage>& pages, - Extension::Location location) { + Manifest::Location location) { std::string error; FilePath manifest_path = extension_path.Append( @@ -92,7 +93,7 @@ class ExtensionUITest : public testing::Test { // Produce test output. scoped_ptr<DictionaryValue> actual_output_data( CreateExtensionDetailViewFromPath( - extension_path, pages, Extension::INVALID)); + extension_path, pages, Manifest::INVALID_LOCATION)); // Compare the outputs. // Ignore unknown fields in the actual output data. @@ -188,7 +189,7 @@ TEST_F(ExtensionUITest, GenerateExtensionsJSONData) { CompareExpectedAndActualOutput(extension_path, pages, expected_output_path); } -// Test that using Extension::LOAD for the extension location triggers the +// Test that using Manifest::LOAD for the extension location triggers the // correct values in the details, including location, order, and allow_reload. TEST_F(ExtensionUITest, LocationLoadPropagation) { FilePath data_test_dir_path, extension_path; @@ -204,7 +205,7 @@ TEST_F(ExtensionUITest, LocationLoadPropagation) { scoped_ptr<DictionaryValue> extension_details( CreateExtensionDetailViewFromPath( - extension_path, pages, Extension::LOAD)); + extension_path, pages, Manifest::LOAD)); bool ui_allow_reload = false; bool ui_is_unpacked = false; @@ -218,9 +219,9 @@ TEST_F(ExtensionUITest, LocationLoadPropagation) { EXPECT_EQ(extension_path, FilePath(ui_path)); } -// Test that using Extension::EXTERNAL_PREF for the extension location triggers +// Test that using Manifest::EXTERNAL_PREF for the extension location triggers // the correct values in the details, including location, order, and -// allow_reload. Contrast to Extension::LOAD, which has somewhat different +// allow_reload. Contrast to Manifest::LOAD, which has somewhat different // values. TEST_F(ExtensionUITest, LocationExternalPrefPropagation) { FilePath data_test_dir_path, extension_path; @@ -236,7 +237,7 @@ TEST_F(ExtensionUITest, LocationExternalPrefPropagation) { scoped_ptr<DictionaryValue> extension_details( CreateExtensionDetailViewFromPath( - extension_path, pages, Extension::EXTERNAL_PREF)); + extension_path, pages, Manifest::EXTERNAL_PREF)); bool ui_allow_reload = true; bool ui_is_unpacked = true; @@ -265,7 +266,7 @@ TEST_F(ExtensionUITest, PathPropagation) { scoped_ptr<DictionaryValue> extension_details( CreateExtensionDetailViewFromPath( - extension_path, pages, Extension::LOAD)); + extension_path, pages, Manifest::LOAD)); FilePath::StringType ui_path; diff --git a/chrome/browser/extensions/extension_webkit_preferences.cc b/chrome/browser/extensions/extension_webkit_preferences.cc index 2b79fa6..3413442 100644 --- a/chrome/browser/extensions/extension_webkit_preferences.cc +++ b/chrome/browser/extensions/extension_webkit_preferences.cc @@ -7,6 +7,7 @@ #include "base/command_line.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/extensions/extension.h" +#include "chrome/common/extensions/manifest.h" #include "webkit/glue/webpreferences.h" namespace extension_webkit_preferences { @@ -53,7 +54,7 @@ void SetPreferences(const extensions::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() == extensions::Extension::COMPONENT && + if (extension->location() == extensions::Manifest::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/external_policy_loader_unittest.cc b/chrome/browser/extensions/external_policy_loader_unittest.cc index b655574..ad3fb6d 100644 --- a/chrome/browser/extensions/external_policy_loader_unittest.cc +++ b/chrome/browser/extensions/external_policy_loader_unittest.cc @@ -13,6 +13,7 @@ #include "chrome/browser/extensions/external_provider_impl.h" #include "chrome/browser/extensions/external_provider_interface.h" #include "chrome/common/extensions/extension.h" +#include "chrome/common/extensions/manifest.h" #include "chrome/common/pref_names.h" #include "chrome/test/base/testing_pref_service.h" #include "chrome/test/base/testing_profile.h" @@ -56,8 +57,8 @@ class MockExternalPolicyProviderVisitor provider_.reset(new ExternalProviderImpl( this, new ExternalPolicyLoader(profile_.get()), - Extension::INVALID, - Extension::EXTERNAL_POLICY_DOWNLOAD, + Manifest::INVALID_LOCATION, + Manifest::EXTERNAL_POLICY_DOWNLOAD, Extension::NO_FLAGS)); // Extensions will be removed from this list as they visited, @@ -70,7 +71,7 @@ class MockExternalPolicyProviderVisitor virtual bool OnExternalExtensionFileFound(const std::string& id, const Version* version, const FilePath& path, - Extension::Location unused, + Manifest::Location unused, int unused2, bool unused3) { ADD_FAILURE() << "There should be no external extensions from files."; @@ -79,15 +80,15 @@ class MockExternalPolicyProviderVisitor virtual bool OnExternalExtensionUpdateUrlFound( const std::string& id, const GURL& update_url, - Extension::Location location) { + Manifest::Location location) { // Extension has the correct location. - EXPECT_EQ(Extension::EXTERNAL_POLICY_DOWNLOAD, location); + EXPECT_EQ(Manifest::EXTERNAL_POLICY_DOWNLOAD, location); // Provider returns the correct location when asked. - Extension::Location location1; + Manifest::Location location1; scoped_ptr<Version> version1; provider_->GetExtensionDetails(id, &location1, &version1); - EXPECT_EQ(Extension::EXTERNAL_POLICY_DOWNLOAD, location1); + EXPECT_EQ(Manifest::EXTERNAL_POLICY_DOWNLOAD, location1); EXPECT_FALSE(version1.get()); // Remove the extension from our list. diff --git a/chrome/browser/extensions/external_provider_impl.cc b/chrome/browser/extensions/external_provider_impl.cc index 3e3efb5..641996e 100644 --- a/chrome/browser/extensions/external_provider_impl.cc +++ b/chrome/browser/extensions/external_provider_impl.cc @@ -21,6 +21,8 @@ #include "chrome/browser/profiles/profile.h" #include "chrome/common/chrome_paths.h" #include "chrome/common/chrome_switches.h" +#include "chrome/common/extensions/extension.h" +#include "chrome/common/extensions/manifest.h" #include "chrome/common/pref_names.h" #include "content/public/browser/browser_thread.h" #include "ui/base/l10n/l10n_util.h" @@ -54,8 +56,8 @@ const char ExternalProviderImpl::kIsFromWebstore[] = "is_from_webstore"; ExternalProviderImpl::ExternalProviderImpl( VisitorInterface* service, ExternalLoader* loader, - Extension::Location crx_location, - Extension::Location download_location, + Manifest::Location crx_location, + Manifest::Location download_location, int creation_flags) : crx_location_(crx_location), download_location_(download_location), @@ -195,7 +197,7 @@ void ExternalProviderImpl::SetPrefs(DictionaryValue* prefs) { } if (has_external_crx) { - if (crx_location_ == Extension::INVALID) { + if (crx_location_ == Manifest::INVALID_LOCATION) { LOG(WARNING) << "This provider does not support installing external " << "extensions from crx files."; continue; @@ -232,7 +234,7 @@ void ExternalProviderImpl::SetPrefs(DictionaryValue* prefs) { auto_acknowledge_); } else { // if (has_external_update_url) CHECK(has_external_update_url); // Checking of keys above ensures this. - if (download_location_ == Extension::INVALID) { + if (download_location_ == Manifest::INVALID_LOCATION) { LOG(WARNING) << "This provider does not support installing external " << "extensions from update URLs."; continue; @@ -277,7 +279,7 @@ bool ExternalProviderImpl::HasExtension( } bool ExternalProviderImpl::GetExtensionDetails( - const std::string& id, Extension::Location* location, + const std::string& id, Manifest::Location* location, scoped_ptr<Version>* version) const { CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); CHECK(prefs_.get()); @@ -286,7 +288,7 @@ bool ExternalProviderImpl::GetExtensionDetails( if (!prefs_->GetDictionary(id, &extension)) return false; - Extension::Location loc = Extension::INVALID; + Manifest::Location loc = Manifest::INVALID_LOCATION; if (extension->HasKey(kExternalUpdateUrl)) { loc = download_location_; @@ -322,8 +324,8 @@ void ExternalProviderImpl::CreateExternalProviders( new ExternalProviderImpl( service, new ExternalPolicyLoader(profile), - Extension::INVALID, - Extension::EXTERNAL_POLICY_DOWNLOAD, + Manifest::INVALID_LOCATION, + Manifest::EXTERNAL_POLICY_DOWNLOAD, Extension::NO_FLAGS))); // In tests don't install extensions from default external sources. @@ -361,8 +363,8 @@ void ExternalProviderImpl::CreateExternalProviders( service, new ExternalPrefLoader(chrome::DIR_EXTERNAL_EXTENSIONS, check_admin_permissions_on_mac), - Extension::EXTERNAL_PREF, - Extension::EXTERNAL_PREF_DOWNLOAD, + Manifest::EXTERNAL_PREF, + Manifest::EXTERNAL_PREF_DOWNLOAD, bundled_extension_creation_flags))); } @@ -375,8 +377,8 @@ void ExternalProviderImpl::CreateExternalProviders( service, new ExternalPrefLoader(chrome::DIR_USER_EXTERNAL_EXTENSIONS, ExternalPrefLoader::NONE), - Extension::EXTERNAL_PREF, - Extension::EXTERNAL_PREF_DOWNLOAD, + Manifest::EXTERNAL_PREF, + Manifest::EXTERNAL_PREF_DOWNLOAD, Extension::NO_FLAGS))); #endif #if defined(OS_WIN) @@ -385,8 +387,8 @@ void ExternalProviderImpl::CreateExternalProviders( new ExternalProviderImpl( service, new ExternalRegistryLoader, - Extension::EXTERNAL_REGISTRY, - Extension::INVALID, + Manifest::EXTERNAL_REGISTRY, + Manifest::INVALID_LOCATION, Extension::NO_FLAGS))); #endif @@ -397,8 +399,8 @@ void ExternalProviderImpl::CreateExternalProviders( service, new ExternalPrefLoader(chrome::DIR_STANDALONE_EXTERNAL_EXTENSIONS, ExternalPrefLoader::NONE), - Extension::EXTERNAL_PREF, - Extension::EXTERNAL_PREF_DOWNLOAD, + Manifest::EXTERNAL_PREF, + Manifest::EXTERNAL_PREF_DOWNLOAD, bundled_extension_creation_flags))); #endif @@ -412,8 +414,8 @@ void ExternalProviderImpl::CreateExternalProviders( service, new ExternalPrefLoader(chrome::DIR_DEFAULT_APPS, ExternalPrefLoader::NONE), - Extension::INTERNAL, - Extension::INVALID, + Manifest::INTERNAL, + Manifest::INVALID_LOCATION, Extension::FROM_WEBSTORE | Extension::WAS_INSTALLED_BY_DEFAULT))); #endif @@ -427,8 +429,8 @@ void ExternalProviderImpl::CreateExternalProviders( new ExternalProviderImpl( service, connector->GetAppPackUpdater()->CreateExternalLoader(), - Extension::EXTERNAL_PREF, - Extension::INVALID, + Manifest::EXTERNAL_PREF, + Manifest::INVALID_LOCATION, Extension::NO_FLAGS))); } #endif diff --git a/chrome/browser/extensions/external_provider_impl.h b/chrome/browser/extensions/external_provider_impl.h index e75cbd1..32d3763 100644 --- a/chrome/browser/extensions/external_provider_impl.h +++ b/chrome/browser/extensions/external_provider_impl.h @@ -11,6 +11,7 @@ #include "base/memory/ref_counted.h" #include "chrome/browser/extensions/external_loader.h" +#include "chrome/common/extensions/manifest.h" class Profile; class Version; @@ -20,7 +21,6 @@ class DictionaryValue; } namespace extensions { -class Extension; class ExternalLoader; // A specialization of the ExternalProvider that uses an instance of @@ -35,11 +35,11 @@ class ExternalProviderImpl : public ExternalProviderInterface { // |crx_location|: extensions originating from crx files // |download_location|: extensions originating from update URLs // If either of the origins is not supported by this provider, then it should - // be initialized as Extensions::INVALID. + // be initialized as Manifest::INVALID_LOCATION. ExternalProviderImpl(VisitorInterface* service, ExternalLoader* loader, - Extension::Location crx_location, - Extension::Location download_location, + Manifest::Location crx_location, + Manifest::Location download_location, int creation_flags); virtual ~ExternalProviderImpl(); @@ -59,7 +59,7 @@ class ExternalProviderImpl : public ExternalProviderInterface { virtual void VisitRegisteredExtension() OVERRIDE; virtual bool HasExtension(const std::string& id) const OVERRIDE; virtual bool GetExtensionDetails(const std::string& id, - Extension::Location* location, + Manifest::Location* location, scoped_ptr<Version>* version) const OVERRIDE; virtual bool IsReady() const OVERRIDE; @@ -78,11 +78,11 @@ class ExternalProviderImpl : public ExternalProviderInterface { private: // Location for external extensions that are provided by this provider from // local crx files. - const Extension::Location crx_location_; + const Manifest::Location crx_location_; // Location for external extensions that are provided by this provider from // update URLs. - const Extension::Location download_location_; + const Manifest::Location download_location_; // Weak pointer to the object that consumes the external extensions. // This is zeroed out by: ServiceShutdown() @@ -100,7 +100,7 @@ class ExternalProviderImpl : public ExternalProviderInterface { scoped_refptr<ExternalLoader> loader_; // Creation flags to use for the extension. These flags will be used - // when calling Extenion::Create() by the crx installer. + // when calling Extension::Create() by the crx installer. int creation_flags_; // Whether loaded extensions should be automatically acknowledged, so that diff --git a/chrome/browser/extensions/external_provider_interface.h b/chrome/browser/extensions/external_provider_interface.h index 8a71a9d..1d1f098 100644 --- a/chrome/browser/extensions/external_provider_interface.h +++ b/chrome/browser/extensions/external_provider_interface.h @@ -8,9 +8,10 @@ #include <vector> #include "base/memory/linked_ptr.h" -#include "chrome/common/extensions/extension.h" +#include "chrome/common/extensions/manifest.h" class FilePath; +class GURL; class Version; namespace extensions { @@ -33,7 +34,7 @@ class ExternalProviderInterface { const std::string& id, const Version* version, const FilePath& path, - Extension::Location location, + Manifest::Location location, int creation_flags, bool mark_acknowledged) = 0; @@ -43,7 +44,7 @@ class ExternalProviderInterface { virtual bool OnExternalExtensionUpdateUrlFound( const std::string& id, const GURL& update_url, - Extension::Location location) = 0; + Manifest::Location location) = 0; // Called after all the external extensions have been reported // through the above two methods. |provider| is a pointer to the @@ -75,7 +76,7 @@ class ExternalProviderInterface { // 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, + Manifest::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_registry_loader_win.cc b/chrome/browser/extensions/external_registry_loader_win.cc index 3b91fac..a6ccb89 100644 --- a/chrome/browser/extensions/external_registry_loader_win.cc +++ b/chrome/browser/extensions/external_registry_loader_win.cc @@ -16,6 +16,7 @@ #include "base/version.h" #include "base/win/registry.h" #include "chrome/browser/extensions/external_provider_impl.h" +#include "chrome/common/extensions/extension.h" #include "content/public/browser/browser_thread.h" using content::BrowserThread; diff --git a/chrome/browser/extensions/image_loader.cc b/chrome/browser/extensions/image_loader.cc index dc5d65f..a8a7895 100644 --- a/chrome/browser/extensions/image_loader.cc +++ b/chrome/browser/extensions/image_loader.cc @@ -25,6 +25,7 @@ using content::BrowserThread; using extensions::Extension; using extensions::ImageLoader; +using extensions::Manifest; namespace { @@ -243,7 +244,7 @@ void ImageLoader::LoadImagesAsync( extension->path() == it->resource.extension_root()); int resource_id; - if (extension->location() == Extension::COMPONENT && + if (extension->location() == Manifest::COMPONENT && IsComponentExtensionResource(extension->path(), it->resource.relative_path(), &resource_id)) { diff --git a/chrome/browser/extensions/image_loader_unittest.cc b/chrome/browser/extensions/image_loader_unittest.cc index 5ae02ce..893148c 100644 --- a/chrome/browser/extensions/image_loader_unittest.cc +++ b/chrome/browser/extensions/image_loader_unittest.cc @@ -13,6 +13,7 @@ #include "chrome/common/extensions/extension_constants.h" #include "chrome/common/extensions/extension_icon_set.h" #include "chrome/common/extensions/extension_resource.h" +#include "chrome/common/extensions/manifest.h" #include "content/public/browser/notification_service.h" #include "content/public/test/test_browser_thread.h" #include "grit/component_extension_resources.h" @@ -25,6 +26,7 @@ using content::BrowserThread; using extensions::Extension; using extensions::ImageLoader; +using extensions::Manifest; class ImageLoaderTest : public testing::Test { public: @@ -56,7 +58,7 @@ class ImageLoaderTest : public testing::Test { } scoped_refptr<Extension> CreateExtension(const char* name, - Extension::Location location) { + Manifest::Location location) { // Create and load an extension. FilePath test_file; if (!PathService::Get(chrome::DIR_TEST_DATA, &test_file)) { @@ -79,7 +81,7 @@ class ImageLoaderTest : public testing::Test { if (!valid_value.get()) return NULL; - if (location == Extension::COMPONENT) { + if (location == Manifest::COMPONENT) { if (!PathService::Get(chrome::DIR_RESOURCES, &test_file)) { EXPECT_FALSE(true); return NULL; @@ -109,7 +111,7 @@ class ImageLoaderTest : public testing::Test { // Tests loading an image works correctly. TEST_F(ImageLoaderTest, LoadImage) { scoped_refptr<Extension> extension(CreateExtension( - "image_loading_tracker", Extension::INVALID)); + "image_loading_tracker", Manifest::INVALID_LOCATION)); ASSERT_TRUE(extension.get() != NULL); ExtensionResource image_resource = @@ -141,7 +143,7 @@ TEST_F(ImageLoaderTest, LoadImage) { // problems. TEST_F(ImageLoaderTest, DeleteExtensionWhileWaitingForCache) { scoped_refptr<Extension> extension(CreateExtension( - "image_loading_tracker", Extension::INVALID)); + "image_loading_tracker", Manifest::INVALID_LOCATION)); ASSERT_TRUE(extension.get() != NULL); ExtensionResource image_resource = @@ -187,7 +189,7 @@ TEST_F(ImageLoaderTest, DeleteExtensionWhileWaitingForCache) { // Tests loading multiple dimensions of the same image. TEST_F(ImageLoaderTest, MultipleImages) { scoped_refptr<Extension> extension(CreateExtension( - "image_loading_tracker", Extension::INVALID)); + "image_loading_tracker", Manifest::INVALID_LOCATION)); ASSERT_TRUE(extension.get() != NULL); std::vector<ImageLoader::ImageRepresentation> info_list; @@ -234,7 +236,7 @@ TEST_F(ImageLoaderTest, MultipleImages) { // Tests IsComponentExtensionResource function. TEST_F(ImageLoaderTest, IsComponentExtensionResource) { scoped_refptr<Extension> extension(CreateExtension( - "file_manager", Extension::COMPONENT)); + "file_manager", Manifest::COMPONENT)); ASSERT_TRUE(extension.get() != NULL); ExtensionResource resource = diff --git a/chrome/browser/extensions/image_loading_tracker.cc b/chrome/browser/extensions/image_loading_tracker.cc index d519878..7f64e62 100644 --- a/chrome/browser/extensions/image_loading_tracker.cc +++ b/chrome/browser/extensions/image_loading_tracker.cc @@ -28,6 +28,7 @@ using content::BrowserThread; using extensions::Extension; +using extensions::Manifest; namespace { @@ -306,7 +307,7 @@ void ImageLoadingTracker::LoadImages( loader_ = new ImageLoader(this); int resource_id = -1; - if (extension->location() == Extension::COMPONENT && + if (extension->location() == Manifest::COMPONENT && extensions::ImageLoader::IsComponentExtensionResource( extension->path(), it->resource.relative_path(), &resource_id)) { loader_->LoadResource(*it, id, resource_id); diff --git a/chrome/browser/extensions/image_loading_tracker_unittest.cc b/chrome/browser/extensions/image_loading_tracker_unittest.cc index 5754d94..bb046d6 100644 --- a/chrome/browser/extensions/image_loading_tracker_unittest.cc +++ b/chrome/browser/extensions/image_loading_tracker_unittest.cc @@ -13,6 +13,7 @@ #include "chrome/common/extensions/extension_constants.h" #include "chrome/common/extensions/extension_icon_set.h" #include "chrome/common/extensions/extension_resource.h" +#include "chrome/common/extensions/manifest.h" #include "content/public/browser/notification_service.h" #include "content/public/test/test_browser_thread.h" #include "grit/component_extension_resources.h" @@ -24,6 +25,7 @@ using content::BrowserThread; using extensions::Extension; +using extensions::Manifest; class ImageLoadingTrackerTest : public testing::Test, public ImageLoadingTracker::Observer { @@ -58,7 +60,7 @@ class ImageLoadingTrackerTest : public testing::Test, } scoped_refptr<Extension> CreateExtension(const char* name, - Extension::Location location) { + Manifest::Location location) { // Create and load an extension. FilePath test_file; if (!PathService::Get(chrome::DIR_TEST_DATA, &test_file)) { @@ -81,7 +83,7 @@ class ImageLoadingTrackerTest : public testing::Test, if (!valid_value.get()) return NULL; - if (location == Extension::COMPONENT) { + if (location == Manifest::COMPONENT) { if (!PathService::Get(chrome::DIR_RESOURCES, &test_file)) { EXPECT_FALSE(true); return NULL; @@ -111,7 +113,7 @@ class ImageLoadingTrackerTest : public testing::Test, // Tests asking ImageLoadingTracker to cache pushes the result to the Extension. TEST_F(ImageLoadingTrackerTest, Cache) { scoped_refptr<Extension> extension(CreateExtension( - "image_loading_tracker", Extension::INVALID)); + "image_loading_tracker", Manifest::INVALID_LOCATION)); ASSERT_TRUE(extension.get() != NULL); ExtensionResource image_resource = @@ -161,7 +163,7 @@ TEST_F(ImageLoadingTrackerTest, Cache) { // problems. TEST_F(ImageLoadingTrackerTest, DeleteExtensionWhileWaitingForCache) { scoped_refptr<Extension> extension(CreateExtension( - "image_loading_tracker", Extension::INVALID)); + "image_loading_tracker", Manifest::INVALID_LOCATION)); ASSERT_TRUE(extension.get() != NULL); ExtensionResource image_resource = @@ -203,7 +205,7 @@ TEST_F(ImageLoadingTrackerTest, DeleteExtensionWhileWaitingForCache) { // Tests loading multiple dimensions of the same image. TEST_F(ImageLoadingTrackerTest, MultipleImages) { scoped_refptr<Extension> extension(CreateExtension( - "image_loading_tracker", Extension::INVALID)); + "image_loading_tracker", Manifest::INVALID_LOCATION)); ASSERT_TRUE(extension.get() != NULL); std::vector<ImageLoadingTracker::ImageRepresentation> info_list; diff --git a/chrome/browser/extensions/installed_loader.cc b/chrome/browser/extensions/installed_loader.cc index 945e678..22d4149 100644 --- a/chrome/browser/extensions/installed_loader.cc +++ b/chrome/browser/extensions/installed_loader.cc @@ -32,6 +32,7 @@ using content::BrowserThread; using content::UserMetricsAction; using extensions::Extension; using extensions::ExtensionInfo; +using extensions::Manifest; namespace errors = extension_manifest_errors; @@ -50,7 +51,7 @@ enum ManifestReloadReason { ManifestReloadReason ShouldReloadExtensionManifest(const ExtensionInfo& info) { // Always reload manifests of unpacked extensions, because they can change // on disk independent of the manifest in our prefs. - if (info.extension_location == Extension::LOAD) + if (info.extension_location == Manifest::LOAD) return UNPACKED_DIR; // Reload the manifest if it needs to be relocalized. @@ -105,7 +106,7 @@ void InstalledLoader::Load(const ExtensionInfo& info, bool write_to_prefs) { // updating the 'key' field in their manifest). // TODO(jstritar): migrate preferences when unpacked extensions change IDs. if (extension && - extension->location() != Extension::LOAD && + extension->location() != Manifest::LOAD && info.extension_id != extension->id()) { error = errors::kCannotChangeExtensionID; extension = NULL; @@ -253,24 +254,24 @@ void InstalledLoader::LoadAllExtensions() { const ExtensionSet* extensions = extension_service_->extensions(); ExtensionSet::const_iterator ex; for (ex = extensions->begin(); ex != extensions->end(); ++ex) { - Extension::Location location = (*ex)->location(); - Extension::Type type = (*ex)->GetType(); + Manifest::Location location = (*ex)->location(); + Manifest::Type type = (*ex)->GetType(); if ((*ex)->is_app()) { UMA_HISTOGRAM_ENUMERATION("Extensions.AppLocation", location, 100); - } else if (type == Extension::TYPE_EXTENSION) { + } else if (type == Manifest::TYPE_EXTENSION) { UMA_HISTOGRAM_ENUMERATION("Extensions.ExtensionLocation", location, 100); } // Don't count component extensions, since they are only extensions as an // implementation detail. - if (location == Extension::COMPONENT) + if (location == Manifest::COMPONENT) continue; // Don't count unpacked extensions, since they're a developer-specific // feature. - if (location == Extension::LOAD) + if (location == Manifest::LOAD) continue; // Using an enumeration shows us the total installed ratio across all users. @@ -278,46 +279,46 @@ void InstalledLoader::LoadAllExtensions() { // usage for each user (e.g. 40% of users have at least one app installed). UMA_HISTOGRAM_ENUMERATION("Extensions.LoadType", type, 100); switch (type) { - case Extension::TYPE_THEME: + case Manifest::TYPE_THEME: ++theme_count; break; - case Extension::TYPE_USER_SCRIPT: + case Manifest::TYPE_USER_SCRIPT: ++user_script_count; break; - case Extension::TYPE_HOSTED_APP: + case Manifest::TYPE_HOSTED_APP: ++hosted_app_count; - if (Extension::IsExternalLocation(location)) { + if (Manifest::IsExternalLocation(location)) { ++app_external_count; } else { ++app_user_count; } break; - case Extension::TYPE_LEGACY_PACKAGED_APP: + case Manifest::TYPE_LEGACY_PACKAGED_APP: ++legacy_packaged_app_count; - if (Extension::IsExternalLocation(location)) { + if (Manifest::IsExternalLocation(location)) { ++app_external_count; } else { ++app_user_count; } break; - case Extension::TYPE_PLATFORM_APP: + case Manifest::TYPE_PLATFORM_APP: ++platform_app_count; - if (Extension::IsExternalLocation(location)) { + if (Manifest::IsExternalLocation(location)) { ++app_external_count; } else { ++app_user_count; } break; - case Extension::TYPE_EXTENSION: + case Manifest::TYPE_EXTENSION: default: - if (Extension::IsExternalLocation(location)) { + if (Manifest::IsExternalLocation(location)) { ++extension_external_count; } else { ++extension_user_count; } break; } - if (!Extension::IsExternalLocation((*ex)->location())) + if (!Manifest::IsExternalLocation((*ex)->location())) ++item_user_count; ExtensionActionManager* extension_action_manager = ExtensionActionManager::Get(extension_service_->profile()); @@ -369,7 +370,7 @@ void InstalledLoader::LoadAllExtensions() { int InstalledLoader::GetCreationFlags(const ExtensionInfo* info) { int flags = extension_prefs_->GetCreationFlags(info->extension_id); - if (info->extension_location != Extension::LOAD) + if (info->extension_location != Manifest::LOAD) flags |= Extension::REQUIRE_KEY; if (extension_prefs_->AllowFileAccess(info->extension_id)) flags |= Extension::ALLOW_FILE_ACCESS; diff --git a/chrome/browser/extensions/pending_extension_info.cc b/chrome/browser/extensions/pending_extension_info.cc index bdf4fad..6fc0adc 100644 --- a/chrome/browser/extensions/pending_extension_info.cc +++ b/chrome/browser/extensions/pending_extension_info.cc @@ -15,7 +15,7 @@ PendingExtensionInfo::PendingExtensionInfo( ShouldAllowInstallPredicate should_allow_install, bool is_from_sync, bool install_silently, - Extension::Location install_source) + Manifest::Location install_source) : id_(id), update_url_(update_url), version_(version), @@ -30,7 +30,7 @@ PendingExtensionInfo::PendingExtensionInfo() should_allow_install_(NULL), is_from_sync_(true), install_silently_(false), - install_source_(Extension::INVALID) {} + install_source_(Manifest::INVALID_LOCATION) {} bool PendingExtensionInfo::operator==(const PendingExtensionInfo& rhs) const { return id_ == rhs.id_; @@ -55,8 +55,8 @@ int PendingExtensionInfo::CompareTo(const PendingExtensionInfo& other) const { // Different install sources; |this| has higher precedence if // |install_source_| is the higher priority source. - Extension::Location higher_priority_source = - Extension::GetHigherPriorityLocation( + Manifest::Location higher_priority_source = + Manifest::GetHigherPriorityLocation( install_source_, other.install_source_); return higher_priority_source == install_source_ ? 1 : -1; diff --git a/chrome/browser/extensions/pending_extension_info.h b/chrome/browser/extensions/pending_extension_info.h index 747c916..93688e3c 100644 --- a/chrome/browser/extensions/pending_extension_info.h +++ b/chrome/browser/extensions/pending_extension_info.h @@ -9,6 +9,7 @@ #include "base/version.h" #include "chrome/common/extensions/extension.h" +#include "chrome/common/extensions/manifest.h" #include "googleurl/src/gurl.h" FORWARD_DECLARE_TEST(ExtensionServiceTest, AddPendingExtensionFromSync); @@ -32,7 +33,7 @@ class PendingExtensionInfo { ShouldAllowInstallPredicate should_allow_install, bool is_from_sync, bool install_silently, - Extension::Location install_source); + Manifest::Location install_source); // Required for STL container membership. Should not be used directly. PendingExtensionInfo(); @@ -55,7 +56,7 @@ class PendingExtensionInfo { } bool is_from_sync() const { return is_from_sync_; } bool install_silently() const { return install_silently_; } - Extension::Location install_source() const { return install_source_; } + Manifest::Location install_source() const { return install_source_; } // Returns -1, 0 or 1 if |this| has lower, equal or higher precedence than // |other|, respectively. "Equal" precedence means that the version and the @@ -77,7 +78,7 @@ class PendingExtensionInfo { bool is_from_sync_; // This update check was initiated from sync. bool install_silently_; - Extension::Location install_source_; + Manifest::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 886d83d..0a769f2 100644 --- a/chrome/browser/extensions/pending_extension_manager.cc +++ b/chrome/browser/extensions/pending_extension_manager.cc @@ -113,7 +113,7 @@ bool PendingExtensionManager::AddFromSync( } const bool kIsFromSync = true; - const Extension::Location kSyncLocation = Extension::INTERNAL; + const Manifest::Location kSyncLocation = Manifest::INTERNAL; return AddExtensionImpl(id, update_url, Version(), should_allow_install, kIsFromSync, install_silently, kSyncLocation); @@ -122,7 +122,7 @@ bool PendingExtensionManager::AddFromSync( bool PendingExtensionManager::AddFromExternalUpdateUrl( const std::string& id, const GURL& update_url, - Extension::Location location) { + Manifest::Location location) { CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); const bool kIsFromSync = false; @@ -130,7 +130,7 @@ bool PendingExtensionManager::AddFromExternalUpdateUrl( const Extension* extension = service_.GetInstalledExtension(id); if (extension && - location == Extension::GetHigherPriorityLocation(location, + location == Manifest::GetHigherPriorityLocation(location, extension->location())) { // If the new location has higher priority than the location of an existing // extension, let the update process overwrite the existing extension. @@ -153,7 +153,7 @@ bool PendingExtensionManager::AddFromExternalUpdateUrl( bool PendingExtensionManager::AddFromExternalFile( const std::string& id, - Extension::Location install_source, + Manifest::Location install_source, const Version& version) { // TODO(skerner): AddFromSync() checks to see if the extension is // installed, but this method assumes that the caller already @@ -179,13 +179,13 @@ void PendingExtensionManager::GetPendingIdsForUpdateCheck( for (iter = pending_extension_list_.begin(); iter != pending_extension_list_.end(); ++iter) { - Extension::Location install_source = iter->install_source(); + Manifest::Location install_source = iter->install_source(); // Some install sources read a CRX from the filesystem. They can // not be fetched from an update URL, so don't include them in the // set of ids. - if (install_source == Extension::EXTERNAL_PREF || - install_source == Extension::EXTERNAL_REGISTRY) + if (install_source == Manifest::EXTERNAL_PREF || + install_source == Manifest::EXTERNAL_REGISTRY) continue; out_ids_for_update_check->push_back(iter->id()); @@ -199,7 +199,7 @@ bool PendingExtensionManager::AddExtensionImpl( PendingExtensionInfo::ShouldAllowInstallPredicate should_allow_install, bool is_from_sync, bool install_silently, - Extension::Location install_source) { + Manifest::Location install_source) { CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); PendingExtensionInfo info(id, diff --git a/chrome/browser/extensions/pending_extension_manager.h b/chrome/browser/extensions/pending_extension_manager.h index 181883b..df36d65 100644 --- a/chrome/browser/extensions/pending_extension_manager.h +++ b/chrome/browser/extensions/pending_extension_manager.h @@ -10,6 +10,7 @@ #include "chrome/browser/extensions/pending_extension_info.h" #include "chrome/common/extensions/extension.h" +#include "chrome/common/extensions/manifest.h" class ExtensionServiceInterface; class GURL; @@ -80,14 +81,14 @@ class PendingExtensionManager { // to be fetched, installed, and activated. bool AddFromExternalUpdateUrl(const std::string& id, const GURL& update_url, - Extension::Location location); + Manifest::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, + Manifest::Location location, const Version& version); // Get the list of pending IDs that should be installed from an update URL. @@ -108,7 +109,7 @@ class PendingExtensionManager { PendingExtensionInfo::ShouldAllowInstallPredicate should_allow_install, bool is_from_sync, bool install_silently, - Extension::Location install_source); + Manifest::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.cc b/chrome/browser/extensions/permissions_updater.cc index 31b4653..03fc8d5 100644 --- a/chrome/browser/extensions/permissions_updater.cc +++ b/chrome/browser/extensions/permissions_updater.cc @@ -135,8 +135,8 @@ void PermissionsUpdater::GrantActivePermissions(const Extension* extension, // We only maintain the granted permissions prefs for INTERNAL and LOAD // extensions. - if (extension->location() != Extension::LOAD && - extension->location() != Extension::INTERNAL) + if (extension->location() != Manifest::LOAD && + extension->location() != Manifest::INTERNAL) return; if (record_oauth2_grant) { diff --git a/chrome/browser/extensions/permissions_updater_unittest.cc b/chrome/browser/extensions/permissions_updater_unittest.cc index 207183f..715c7fd 100644 --- a/chrome/browser/extensions/permissions_updater_unittest.cc +++ b/chrome/browser/extensions/permissions_updater_unittest.cc @@ -102,7 +102,7 @@ scoped_refptr<Extension> LoadManifest(std::string* error) { return NULL; scoped_refptr<Extension> extension = Extension::Create( - path.DirName(), Extension::INTERNAL, + path.DirName(), Manifest::INTERNAL, *static_cast<DictionaryValue*>(result.get()), Extension::NO_FLAGS, error); return extension; } diff --git a/chrome/browser/extensions/requirements_checker_browsertest.cc b/chrome/browser/extensions/requirements_checker_browsertest.cc index 7c2f0e6..4d79d65 100644 --- a/chrome/browser/extensions/requirements_checker_browsertest.cc +++ b/chrome/browser/extensions/requirements_checker_browsertest.cc @@ -47,7 +47,7 @@ class RequirementsCheckerBrowserTest : public ExtensionBrowserTest { extension_path = extension_path.AppendASCII("requirements_checker") .AppendASCII(extension_dir_name); scoped_refptr<const Extension> extension = - extension_file_util::LoadExtension(extension_path, Extension::LOAD, + extension_file_util::LoadExtension(extension_path, Manifest::LOAD, 0, &load_error); CHECK(load_error.length() == 0u); return extension; diff --git a/chrome/browser/extensions/sandboxed_unpacker.cc b/chrome/browser/extensions/sandboxed_unpacker.cc index 5f3fcc4..0171b7c 100644 --- a/chrome/browser/extensions/sandboxed_unpacker.cc +++ b/chrome/browser/extensions/sandboxed_unpacker.cc @@ -23,6 +23,7 @@ #include "chrome/common/chrome_paths.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/chrome_utility_messages.h" +#include "chrome/common/extensions/extension.h" #include "chrome/common/extensions/extension_manifest_constants.h" #include "chrome/common/extensions/extension_file_util.h" #include "chrome/common/extensions/extension_l10n_util.h" @@ -175,7 +176,7 @@ namespace extensions { SandboxedUnpacker::SandboxedUnpacker( const FilePath& crx_path, bool run_out_of_process, - Extension::Location location, + Manifest::Location location, int creation_flags, const FilePath& extensions_dir, base::SequencedTaskRunner* unpacker_io_task_runner, diff --git a/chrome/browser/extensions/sandboxed_unpacker.h b/chrome/browser/extensions/sandboxed_unpacker.h index bb3d4f3..302997c 100644 --- a/chrome/browser/extensions/sandboxed_unpacker.h +++ b/chrome/browser/extensions/sandboxed_unpacker.h @@ -10,7 +10,8 @@ #include "base/file_path.h" #include "base/files/scoped_temp_dir.h" #include "base/memory/ref_counted.h" -#include "chrome/common/extensions/extension.h" +#include "base/time.h" +#include "chrome/common/extensions/manifest.h" #include "content/public/browser/utility_process_host_client.h" namespace base { @@ -19,6 +20,7 @@ class SequencedTaskRunner; } namespace extensions { +class Extension; class SandboxedUnpackerClient : public base::RefCountedThreadSafe<SandboxedUnpackerClient> { @@ -73,7 +75,7 @@ class SandboxedUnpacker : public content::UtilityProcessHostClient { // is done in a sandboxed subprocess. Otherwise, it is done in-process. SandboxedUnpacker(const FilePath& crx_path, bool run_out_of_process, - Extension::Location location, + Manifest::Location location, int creation_flags, const FilePath& extensions_dir, base::SequencedTaskRunner* unpacker_io_task_runner, @@ -225,7 +227,7 @@ class SandboxedUnpacker : public content::UtilityProcessHostClient { base::TimeTicks unpack_start_time_; // Location to use for the unpacked extension. - Extension::Location location_; + Manifest::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_unpacker_unittest.cc b/chrome/browser/extensions/sandboxed_unpacker_unittest.cc index 468916e..df63f7b 100644 --- a/chrome/browser/extensions/sandboxed_unpacker_unittest.cc +++ b/chrome/browser/extensions/sandboxed_unpacker_unittest.cc @@ -96,7 +96,7 @@ class SandboxedUnpackerTest : public testing::Test { ", Crx path: " << crx_path.value(); unpacker_.reset(new Unpacker( - crx_path, std::string(), Extension::INTERNAL, Extension::NO_FLAGS)); + crx_path, std::string(), Manifest::INTERNAL, Extension::NO_FLAGS)); // Build a temp area where the extension will be unpacked. temp_path_ = @@ -105,7 +105,7 @@ class SandboxedUnpackerTest : public testing::Test { sandboxed_unpacker_ = new SandboxedUnpacker( - crx_path, false, Extension::INTERNAL, Extension::NO_FLAGS, + crx_path, false, Manifest::INTERNAL, Extension::NO_FLAGS, extensions_dir_.path(), BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE), client_); diff --git a/chrome/browser/extensions/standard_management_policy_provider_unittest.cc b/chrome/browser/extensions/standard_management_policy_provider_unittest.cc index 8cdc3d8..61fccf3 100644 --- a/chrome/browser/extensions/standard_management_policy_provider_unittest.cc +++ b/chrome/browser/extensions/standard_management_policy_provider_unittest.cc @@ -29,7 +29,7 @@ class StandardManagementPolicyProviderTest : public testing::Test { return prefs_.prefs(); } - scoped_refptr<const Extension> CreateExtension(Extension::Location location, + scoped_refptr<const Extension> CreateExtension(Manifest::Location location, bool required) { base::DictionaryValue values; values.SetString(extension_manifest_keys::kName, "test"); @@ -54,7 +54,7 @@ class StandardManagementPolicyProviderTest : public testing::Test { // extension required by policy. TEST_F(StandardManagementPolicyProviderTest, RequiredExtension) { scoped_refptr<const Extension> extension = - CreateExtension(Extension::EXTERNAL_POLICY_DOWNLOAD, true); + CreateExtension(Manifest::EXTERNAL_POLICY_DOWNLOAD, true); string16 error16; EXPECT_TRUE(provider_.UserMayLoad(extension.get(), &error16)); @@ -72,7 +72,7 @@ TEST_F(StandardManagementPolicyProviderTest, RequiredExtension) { // extension required by policy. TEST_F(StandardManagementPolicyProviderTest, NotRequiredExtension) { scoped_refptr<const Extension> extension = - CreateExtension(Extension::INTERNAL, false); + CreateExtension(Manifest::INTERNAL, false); string16 error16; EXPECT_TRUE(provider_.UserMayLoad(extension.get(), &error16)); diff --git a/chrome/browser/extensions/tab_helper.h b/chrome/browser/extensions/tab_helper.h index 539871f..3dd1d40 100644 --- a/chrome/browser/extensions/tab_helper.h +++ b/chrome/browser/extensions/tab_helper.h @@ -129,7 +129,7 @@ class TabHelper : public content::WebContentsObserver, // is returned. // // NOTE: the returned icon is larger than 16x16 (its size is - // Extension::EXTENSION_ICON_SMALLISH). + // extension_misc::EXTENSION_ICON_SMALLISH). SkBitmap* GetExtensionAppIcon(); content::WebContents* web_contents() const { diff --git a/chrome/browser/extensions/test_extension_prefs.cc b/chrome/browser/extensions/test_extension_prefs.cc index d95e03c..a261c0e 100644 --- a/chrome/browser/extensions/test_extension_prefs.cc +++ b/chrome/browser/extensions/test_extension_prefs.cc @@ -111,7 +111,7 @@ scoped_refptr<Extension> TestExtensionPrefs::AddExtension(std::string name) { DictionaryValue dictionary; dictionary.SetString(extension_manifest_keys::kName, name); dictionary.SetString(extension_manifest_keys::kVersion, "0.1"); - return AddExtensionWithManifest(dictionary, Extension::INTERNAL); + return AddExtensionWithManifest(dictionary, Manifest::INTERNAL); } scoped_refptr<Extension> TestExtensionPrefs::AddApp(std::string name) { @@ -121,19 +121,19 @@ scoped_refptr<Extension> TestExtensionPrefs::AddApp(std::string name) { dictionary.SetString(extension_manifest_keys::kApp, "true"); dictionary.SetString(extension_manifest_keys::kLaunchWebURL, "http://example.com"); - return AddExtensionWithManifest(dictionary, Extension::INTERNAL); + return AddExtensionWithManifest(dictionary, Manifest::INTERNAL); } scoped_refptr<Extension> TestExtensionPrefs::AddExtensionWithManifest( - const DictionaryValue& manifest, Extension::Location location) { + const DictionaryValue& manifest, Manifest::Location location) { return AddExtensionWithManifestAndFlags(manifest, location, Extension::NO_FLAGS); } scoped_refptr<Extension> TestExtensionPrefs::AddExtensionWithManifestAndFlags( const DictionaryValue& manifest, - Extension::Location location, + Manifest::Location location, int extra_flags) { std::string name; EXPECT_TRUE(manifest.GetString(extension_manifest_keys::kName, &name)); diff --git a/chrome/browser/extensions/test_extension_prefs.h b/chrome/browser/extensions/test_extension_prefs.h index 6949f15..7111e09 100644 --- a/chrome/browser/extensions/test_extension_prefs.h +++ b/chrome/browser/extensions/test_extension_prefs.h @@ -8,8 +8,9 @@ #include <string> #include "base/files/scoped_temp_dir.h" +#include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" -#include "chrome/common/extensions/extension.h" +#include "chrome/common/extensions/manifest.h" class ExtensionPrefValueMap; class PrefServiceSyncable; @@ -20,6 +21,7 @@ class SequencedTaskRunner; } namespace extensions { +class Extension; class ExtensionPrefs; // This is a test class intended to make it easier to work with ExtensionPrefs @@ -51,13 +53,13 @@ class TestExtensionPrefs { // Similar to AddExtension, but takes a dictionary with manifest values. scoped_refptr<Extension> AddExtensionWithManifest( const base::DictionaryValue& manifest, - Extension::Location location); + Manifest::Location location); // Similar to AddExtension, but takes a dictionary with manifest values // and extension flags. scoped_refptr<Extension> AddExtensionWithManifestAndFlags( const base::DictionaryValue& manifest, - Extension::Location location, + Manifest::Location location, int extra_flags); // Similar to AddExtension, this adds a new test Extension. This is useful for diff --git a/chrome/browser/extensions/unpacked_installer.cc b/chrome/browser/extensions/unpacked_installer.cc index cd4ae8f..dceca42 100644 --- a/chrome/browser/extensions/unpacked_installer.cc +++ b/chrome/browser/extensions/unpacked_installer.cc @@ -17,6 +17,7 @@ #include "chrome/browser/extensions/requirements_checker.h" #include "chrome/common/extensions/extension.h" #include "chrome/common/extensions/extension_file_util.h" +#include "chrome/common/extensions/manifest.h" #include "content/public/browser/browser_thread.h" #include "sync/api/string_ordinal.h" @@ -135,7 +136,7 @@ void UnpackedInstaller::LoadFromCommandLine(const FilePath& path_in) { std::string error; extension_ = extension_file_util::LoadExtension( extension_path_, - Extension::LOAD, + Manifest::LOAD, GetFlags(), &error); @@ -169,7 +170,7 @@ void UnpackedInstaller::OnRequirementsChecked( int UnpackedInstaller::GetFlags() { std::string id = Extension::GenerateIdForPath(extension_path_); bool allow_file_access = - Extension::ShouldAlwaysAllowFileAccess(Extension::LOAD); + Manifest::ShouldAlwaysAllowFileAccess(Manifest::LOAD); if (service_weak_->extension_prefs()->HasAllowFileAccessSetting(id)) allow_file_access = service_weak_->extension_prefs()->AllowFileAccess(id); @@ -220,7 +221,7 @@ void UnpackedInstaller::LoadWithFileAccess(int flags) { std::string error; extension_ = extension_file_util::LoadExtension( extension_path_, - Extension::LOAD, + Manifest::LOAD, flags, &error); diff --git a/chrome/browser/extensions/updater/extension_downloader.cc b/chrome/browser/extensions/updater/extension_downloader.cc index 7a4336f..aed02ff 100644 --- a/chrome/browser/extensions/updater/extension_downloader.cc +++ b/chrome/browser/extensions/updater/extension_downloader.cc @@ -220,7 +220,7 @@ bool ExtensionDownloader::AddPendingExtension(const std::string& id, Version version("0.0.0.0"); DCHECK(version.IsValid()); - return AddExtensionData(id, version, Extension::TYPE_UNKNOWN, update_url, "", + return AddExtensionData(id, version, Manifest::TYPE_UNKNOWN, update_url, "", request_id); } @@ -256,7 +256,7 @@ void ExtensionDownloader::StartBlacklistUpdate( bool ExtensionDownloader::AddExtensionData(const std::string& id, const Version& version, - Extension::Type extension_type, + Manifest::Type extension_type, const GURL& extension_update_url, const std::string& update_url_data, int request_id) { @@ -290,21 +290,21 @@ bool ExtensionDownloader::AddExtensionData(const std::string& id, } switch (extension_type) { - case Extension::TYPE_THEME: + case Manifest::TYPE_THEME: ++url_stats_.theme_count; break; - case Extension::TYPE_EXTENSION: - case Extension::TYPE_USER_SCRIPT: + case Manifest::TYPE_EXTENSION: + case Manifest::TYPE_USER_SCRIPT: ++url_stats_.extension_count; break; - case Extension::TYPE_HOSTED_APP: - case Extension::TYPE_LEGACY_PACKAGED_APP: + case Manifest::TYPE_HOSTED_APP: + case Manifest::TYPE_LEGACY_PACKAGED_APP: ++url_stats_.app_count; break; - case Extension::TYPE_PLATFORM_APP: + case Manifest::TYPE_PLATFORM_APP: ++url_stats_.platform_app_count; break; - case Extension::TYPE_UNKNOWN: + case Manifest::TYPE_UNKNOWN: default: ++url_stats_.pending_count; break; diff --git a/chrome/browser/extensions/updater/extension_downloader.h b/chrome/browser/extensions/updater/extension_downloader.h index b8be362..302a74b 100644 --- a/chrome/browser/extensions/updater/extension_downloader.h +++ b/chrome/browser/extensions/updater/extension_downloader.h @@ -135,7 +135,7 @@ class ExtensionDownloader : public net::URLFetcherDelegate { // Helper for AddExtension() and AddPendingExtension(). bool AddExtensionData(const std::string& id, const Version& version, - Extension::Type extension_type, + Manifest::Type extension_type, const GURL& extension_update_url, const std::string& update_url_data, int request_id); diff --git a/chrome/browser/extensions/updater/extension_updater.cc b/chrome/browser/extensions/updater/extension_updater.cc index e379ceb..ab60b59 100644 --- a/chrome/browser/extensions/updater/extension_updater.cc +++ b/chrome/browser/extensions/updater/extension_updater.cc @@ -25,6 +25,7 @@ #include "chrome/common/chrome_notification_types.h" #include "chrome/common/extensions/extension.h" #include "chrome/common/extensions/extension_set.h" +#include "chrome/common/extensions/manifest.h" #include "chrome/common/pref_names.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/notification_details.h" @@ -304,7 +305,7 @@ void ExtensionUpdater::AddToDownloader( for (ExtensionSet::const_iterator extension_iter = extensions->begin(); extension_iter != extensions->end(); ++extension_iter) { const Extension& extension = **extension_iter; - if (!Extension::IsAutoUpdateableLocation(extension.location())) { + if (!Manifest::IsAutoUpdateableLocation(extension.location())) { VLOG(2) << "Extension " << extension.id() << " is not auto updateable"; continue; } @@ -354,7 +355,7 @@ void ExtensionUpdater::CheckNow(const CheckParams& params) { for (iter = pending_ids.begin(); iter != pending_ids.end(); ++iter) { const PendingExtensionInfo* info = pending_extension_manager->GetById( *iter); - if (!Extension::IsAutoUpdateableLocation(info->install_source())) { + if (!Manifest::IsAutoUpdateableLocation(info->install_source())) { VLOG(2) << "Extension " << *iter << " is not auto updateable"; continue; } diff --git a/chrome/browser/extensions/updater/extension_updater_unittest.cc b/chrome/browser/extensions/updater/extension_updater_unittest.cc index 276ec18..5298645 100644 --- a/chrome/browser/extensions/updater/extension_updater_unittest.cc +++ b/chrome/browser/extensions/updater/extension_updater_unittest.cc @@ -235,7 +235,7 @@ class MockService : public TestExtensionService { // no two extensions share the same name. void CreateTestExtensions(int id, int count, ExtensionList *list, const std::string* update_url, - Extension::Location location) { + Manifest::Location location) { for (int i = 1; i <= count; i++) { DictionaryValue manifest; manifest.SetString(extension_manifest_keys::kVersion, @@ -269,7 +269,7 @@ std::string GenerateId(std::string input) { } bool ShouldInstallExtensionsOnly(const Extension& extension) { - return extension.GetType() == Extension::TYPE_EXTENSION; + return extension.GetType() == Manifest::TYPE_EXTENSION; } bool ShouldInstallThemesOnly(const Extension& extension) { @@ -299,7 +299,7 @@ void SetupPendingExtensionManagerForTest( should_allow_install, kIsFromSync, kInstallSilently, - Extension::INTERNAL)); + Manifest::INTERNAL)); } } @@ -522,7 +522,7 @@ class ExtensionUpdaterTest : public testing::Test { pending_extension_manager); } else { service.CreateTestExtensions(1, 1, &extensions, &update_url, - Extension::INTERNAL); + Manifest::INTERNAL); service.set_extensions(extensions); } @@ -667,7 +667,7 @@ class ExtensionUpdaterTest : public testing::Test { ExtensionList extensions; std::string url(gallery_url); - service.CreateTestExtensions(1, 1, &extensions, &url, Extension::INTERNAL); + service.CreateTestExtensions(1, 1, &extensions, &url, Manifest::INTERNAL); const std::string& id = extensions[0]->id(); EXPECT_CALL(delegate, GetPingDataForExtension(id, _)); @@ -1004,7 +1004,7 @@ class ExtensionUpdaterTest : public testing::Test { PendingExtensionInfo(id, test_url, version, &ShouldAlwaysInstall, kIsFromSync, kInstallSilently, - Extension::INTERNAL)); + Manifest::INTERNAL)); } // Call back the ExtensionUpdater with a 200 response and some test data @@ -1288,9 +1288,9 @@ class ExtensionUpdaterTest : public testing::Test { GURL url1("http://clients2.google.com/service/update2/crx"); GURL url2("http://www.somewebsite.com"); service.CreateTestExtensions(1, 1, &tmp, &url1.possibly_invalid_spec(), - Extension::INTERNAL); + Manifest::INTERNAL); service.CreateTestExtensions(2, 1, &tmp, &url2.possibly_invalid_spec(), - Extension::INTERNAL); + Manifest::INTERNAL); EXPECT_EQ(2u, tmp.size()); service.set_extensions(tmp); @@ -1409,7 +1409,7 @@ class ExtensionUpdaterTest : public testing::Test { GURL update_url("http://www.google.com/manifest"); ExtensionList tmp; service.CreateTestExtensions(1, 1, &tmp, &update_url.spec(), - Extension::INTERNAL); + Manifest::INTERNAL); service.set_extensions(tmp); ExtensionUpdater updater( @@ -1543,8 +1543,9 @@ TEST_F(ExtensionUpdaterTest, TestNonAutoUpdateableLocations) { // Non-internal non-external extensions should be rejected. ExtensionList extensions; - service.CreateTestExtensions(1, 1, &extensions, NULL, Extension::INVALID); - service.CreateTestExtensions(2, 1, &extensions, NULL, Extension::INTERNAL); + service.CreateTestExtensions(1, 1, &extensions, NULL, + Manifest::INVALID_LOCATION); + service.CreateTestExtensions(2, 1, &extensions, NULL, Manifest::INTERNAL); ASSERT_EQ(2u, extensions.size()); const std::string& updateable_id = extensions[1]->id(); @@ -1577,9 +1578,9 @@ TEST_F(ExtensionUpdaterTest, TestUpdatingDisabledExtensions) { ExtensionList enabled_extensions; ExtensionList disabled_extensions; service.CreateTestExtensions(1, 1, &enabled_extensions, NULL, - Extension::INTERNAL); + Manifest::INTERNAL); service.CreateTestExtensions(2, 1, &disabled_extensions, NULL, - Extension::INTERNAL); + Manifest::INTERNAL); ASSERT_EQ(1u, enabled_extensions.size()); ASSERT_EQ(1u, disabled_extensions.size()); const std::string& enabled_id = enabled_extensions[0]->id(); diff --git a/chrome/browser/extensions/user_script_listener_unittest.cc b/chrome/browser/extensions/user_script_listener_unittest.cc index adc009d..ae227ef 100644 --- a/chrome/browser/extensions/user_script_listener_unittest.cc +++ b/chrome/browser/extensions/user_script_listener_unittest.cc @@ -94,7 +94,7 @@ scoped_refptr<Extension> LoadExtension(const std::string& filename, scoped_ptr<DictionaryValue> value(LoadManifestFile(path, error)); if (!value.get()) return NULL; - return Extension::Create(path.DirName(), Extension::LOAD, *value, + return Extension::Create(path.DirName(), Manifest::LOAD, *value, Extension::NO_FLAGS, error); } diff --git a/chrome/browser/intents/web_intents_registry_unittest.cc b/chrome/browser/intents/web_intents_registry_unittest.cc index 372ca70..d2738cd 100644 --- a/chrome/browser/intents/web_intents_registry_unittest.cc +++ b/chrome/browser/intents/web_intents_registry_unittest.cc @@ -15,8 +15,10 @@ #include "chrome/browser/intents/web_intents_registry.h" #include "chrome/browser/webdata/web_data_service.h" #include "chrome/common/chrome_paths.h" +#include "chrome/common/extensions/extension.h" #include "chrome/common/extensions/extension_manifest_constants.h" #include "chrome/common/extensions/extension_set.h" +#include "chrome/common/extensions/manifest.h" #include "chrome/common/extensions/manifest_handler.h" #include "chrome/common/extensions/web_intents_handler.h" #include "content/public/test/test_browser_thread.h" @@ -25,6 +27,7 @@ using content::BrowserThread; using extensions::Extension; +using extensions::Manifest; using webkit_glue::WebIntentServiceData; class MockExtensionService: public TestExtensionService { @@ -49,7 +52,7 @@ DictionaryValue* LoadManifestFile(const FilePath& path, scoped_refptr<Extension> LoadExtensionWithLocation( const std::string& name, - Extension::Location location, + Manifest::Location location, std::string* error) { FilePath path; PathService::Get(chrome::DIR_TEST_DATA, &path); @@ -69,7 +72,7 @@ scoped_refptr<Extension> LoadExtensionWithLocation( scoped_refptr<Extension> LoadExtension(const std::string& name, std::string* error) { - return LoadExtensionWithLocation(name, Extension::INTERNAL, error); + return LoadExtensionWithLocation(name, Manifest::INTERNAL, error); } scoped_refptr<Extension> LoadAndExpectSuccess(const std::string& name) { diff --git a/chrome/browser/media_gallery/media_galleries_test_util.cc b/chrome/browser/media_gallery/media_galleries_test_util.cc index 8c7635c..948bcf6 100644 --- a/chrome/browser/media_gallery/media_galleries_test_util.cc +++ b/chrome/browser/media_gallery/media_galleries_test_util.cc @@ -45,7 +45,7 @@ scoped_refptr<extensions::Extension> AddMediaGalleriesApp( FilePath path = profile->GetPath().AppendASCII(name); std::string errors; scoped_refptr<extensions::Extension> extension = - extensions::Extension::Create(path, extensions::Extension::INTERNAL, + extensions::Extension::Create(path, extensions::Manifest::INTERNAL, *manifest.get(), extensions::Extension::NO_FLAGS, &errors); EXPECT_TRUE(extension.get() != NULL) << errors; diff --git a/chrome/browser/performance_monitor/database_unittest.cc b/chrome/browser/performance_monitor/database_unittest.cc index e6826939..71b4690 100644 --- a/chrome/browser/performance_monitor/database_unittest.cc +++ b/chrome/browser/performance_monitor/database_unittest.cc @@ -16,11 +16,13 @@ #include "chrome/browser/performance_monitor/metric.h" #include "chrome/browser/performance_monitor/performance_monitor_util.h" #include "chrome/common/extensions/extension.h" +#include "chrome/common/extensions/manifest.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/leveldatabase/src/include/leveldb/db.h" #include "third_party/leveldatabase/src/include/leveldb/iterator.h" using extensions::Extension; +using extensions::Manifest; namespace performance_monitor { @@ -130,19 +132,19 @@ class PerformanceMonitorDatabaseEventTest : public ::testing::Test { void InitEvents() { install_event_1_ = util::CreateExtensionEvent( EVENT_EXTENSION_INSTALL, clock_->GetTime(), "a", "extension 1", - "http://foo.com", static_cast<int>(Extension::LOAD), "0.1", + "http://foo.com", static_cast<int>(Manifest::LOAD), "0.1", "Test Test"); install_event_2_ = util::CreateExtensionEvent( EVENT_EXTENSION_INSTALL, clock_->GetTime(), "b", "extension 2", - "http://bar.com", static_cast<int>(Extension::LOAD), "0.1", + "http://bar.com", static_cast<int>(Manifest::LOAD), "0.1", "Test Test"); uninstall_event_1_ = util::CreateExtensionEvent( EVENT_EXTENSION_UNINSTALL, clock_->GetTime(), "a", "extension 1", - "http://foo.com", static_cast<int>(Extension::LOAD), "0.1", + "http://foo.com", static_cast<int>(Manifest::LOAD), "0.1", "Test Test"); uninstall_event_2_ = util::CreateExtensionEvent( EVENT_EXTENSION_UNINSTALL, clock_->GetTime(), "b", "extension 2", - "http://bar.com", static_cast<int>(Extension::LOAD), "0.1", + "http://bar.com", static_cast<int>(Manifest::LOAD), "0.1", "Test Test"); } }; @@ -356,12 +358,12 @@ TEST_F(PerformanceMonitorDatabaseEventTest, GetEventsTimeRange) { scoped_ptr<Event> new_install_event = util::CreateExtensionEvent(EVENT_EXTENSION_INSTALL, clock_->GetTime(), "c", "test extension", "http://foo.com", - static_cast<int>(Extension::LOAD), "0.1", + static_cast<int>(Manifest::LOAD), "0.1", "Test Test"); scoped_ptr<Event> new_uninstall_event = util::CreateExtensionEvent(EVENT_EXTENSION_UNINSTALL, clock_->GetTime(), "c", "test extension", "http://foo.com", - static_cast<int>(Extension::LOAD), "0.1", + static_cast<int>(Manifest::LOAD), "0.1", "Test Test"); base::Time end_time = clock_->GetTime(); db_->AddEvent(*new_install_event.get()); diff --git a/chrome/browser/performance_monitor/performance_monitor_browsertest.cc b/chrome/browser/performance_monitor/performance_monitor_browsertest.cc index 2e00715..d30426d 100644 --- a/chrome/browser/performance_monitor/performance_monitor_browsertest.cc +++ b/chrome/browser/performance_monitor/performance_monitor_browsertest.cc @@ -74,7 +74,7 @@ struct ExtensionBasicInfo { std::string name; std::string url; std::string version; - Extension::Location location; + extensions::Manifest::Location location; }; // Compare the fields of |extension| to those in |value|; this is a check to diff --git a/chrome/browser/policy/configuration_policy_handler_list.cc b/chrome/browser/policy/configuration_policy_handler_list.cc index fd4ed8a..a80912b 100644 --- a/chrome/browser/policy/configuration_policy_handler_list.cc +++ b/chrome/browser/policy/configuration_policy_handler_list.cc @@ -10,7 +10,7 @@ #include "chrome/browser/policy/configuration_policy_handler.h" #include "chrome/browser/policy/policy_error_map.h" #include "chrome/browser/policy/policy_map.h" -#include "chrome/common/extensions/extension.h" +#include "chrome/common/extensions/manifest.h" #include "chrome/common/pref_names.h" #include "chromeos/network/onc/onc_constants.h" #include "grit/generated_resources.h" @@ -355,14 +355,14 @@ const PolicyToPreferenceMapEntry kSimplePolicyMap[] = { #endif // !defined(OS_MACOSX) && !defined(OS_CHROMEOS) }; -// Mapping from extension type names to Extension::Type. +// Mapping from extension type names to Manifest::Type. StringToIntEnumListPolicyHandler::MappingEntry kExtensionAllowedTypesMap[] = { - { "extension", extensions::Extension::TYPE_EXTENSION }, - { "theme", extensions::Extension::TYPE_THEME }, - { "user_script", extensions::Extension::TYPE_USER_SCRIPT }, - { "hosted_app", extensions::Extension::TYPE_HOSTED_APP }, - { "legacy_packaged_app", extensions::Extension::TYPE_LEGACY_PACKAGED_APP }, - { "platform_app", extensions::Extension::TYPE_PLATFORM_APP }, + { "extension", extensions::Manifest::TYPE_EXTENSION }, + { "theme", extensions::Manifest::TYPE_THEME }, + { "user_script", extensions::Manifest::TYPE_USER_SCRIPT }, + { "hosted_app", extensions::Manifest::TYPE_HOSTED_APP }, + { "legacy_packaged_app", extensions::Manifest::TYPE_LEGACY_PACKAGED_APP }, + { "platform_app", extensions::Manifest::TYPE_PLATFORM_APP }, }; } // namespace 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 fd9d9d1..47a4092 100644 --- a/chrome/browser/renderer_host/chrome_render_view_host_observer.cc +++ b/chrome/browser/renderer_host/chrome_render_view_host_observer.cc @@ -11,7 +11,9 @@ #include "chrome/browser/profiles/profile.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_messages.h" +#include "chrome/common/extensions/manifest.h" #include "chrome/common/render_messages.h" #include "chrome/common/url_constants.h" #include "content/public/browser/child_process_security_policy.h" @@ -29,6 +31,7 @@ using content::ChildProcessSecurityPolicy; using content::RenderViewHost; using content::SiteInstance; using extensions::Extension; +using extensions::Manifest; ChromeRenderViewHostObserver::ChromeRenderViewHostObserver( RenderViewHost* render_view_host, chrome_browser_net::Predictor* predictor) @@ -85,9 +88,9 @@ void ChromeRenderViewHostObserver::InitRenderViewForExtensions() { content::RenderProcessHost* process = render_view_host()->GetProcess(); // Some extensions use chrome:// URLs. - Extension::Type type = extension->GetType(); - if (type == Extension::TYPE_EXTENSION || - type == Extension::TYPE_LEGACY_PACKAGED_APP) { + Manifest::Type type = extension->GetType(); + if (type == Manifest::TYPE_EXTENSION || + type == Manifest::TYPE_LEGACY_PACKAGED_APP) { ChildProcessSecurityPolicy::GetInstance()->GrantScheme( process->GetID(), chrome::kChromeUIScheme); @@ -99,11 +102,11 @@ void ChromeRenderViewHostObserver::InitRenderViewForExtensions() { } switch (type) { - case Extension::TYPE_EXTENSION: - case Extension::TYPE_USER_SCRIPT: - case Extension::TYPE_HOSTED_APP: - case Extension::TYPE_LEGACY_PACKAGED_APP: - case Extension::TYPE_PLATFORM_APP: + case Manifest::TYPE_EXTENSION: + case Manifest::TYPE_USER_SCRIPT: + case Manifest::TYPE_HOSTED_APP: + case Manifest::TYPE_LEGACY_PACKAGED_APP: + case Manifest::TYPE_PLATFORM_APP: // Always send a Loaded message before ActivateExtension so that // ExtensionDispatcher knows what Extension is active, not just its ID. // This is important for classifying the Extension's JavaScript context @@ -114,8 +117,8 @@ void ChromeRenderViewHostObserver::InitRenderViewForExtensions() { Send(new ExtensionMsg_ActivateExtension(extension->id())); break; - case Extension::TYPE_UNKNOWN: - case Extension::TYPE_THEME: + case Manifest::TYPE_UNKNOWN: + case Manifest::TYPE_THEME: break; } } 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 507f56d..a4310d9 100644 --- a/chrome/browser/sync/glue/chrome_extensions_activity_monitor_unittest.cc +++ b/chrome/browser/sync/glue/chrome_extensions_activity_monitor_unittest.cc @@ -37,7 +37,8 @@ scoped_refptr<Extension> MakeExtension(const std::string& name) { value.SetString(keys::kName, name); std::string error; scoped_refptr<Extension> extension(Extension::Create( - path, Extension::INVALID, value, Extension::NO_FLAGS, &error)); + path, extensions::Manifest::INVALID_LOCATION, value, + Extension::NO_FLAGS, &error)); EXPECT_TRUE(error.empty()); return extension; } diff --git a/chrome/browser/sync/test/integration/apps_helper.cc b/chrome/browser/sync/test/integration/apps_helper.cc index fe9a379..26ff792 100644 --- a/chrome/browser/sync/test/integration/apps_helper.cc +++ b/chrome/browser/sync/test/integration/apps_helper.cc @@ -10,7 +10,7 @@ #include "chrome/browser/sync/test/integration/sync_app_helper.h" #include "chrome/browser/sync/test/integration/sync_datatype_helper.h" #include "chrome/browser/sync/test/integration/sync_extension_helper.h" -#include "chrome/common/extensions/extension.h" +#include "chrome/common/extensions/manifest.h" using sync_datatype_helper::test; @@ -44,14 +44,14 @@ std::string InstallApp(Profile* profile, int index) { return SyncExtensionHelper::GetInstance()->InstallExtension( profile, CreateFakeAppName(index), - extensions::Extension::TYPE_HOSTED_APP); + extensions::Manifest::TYPE_HOSTED_APP); } std::string InstallPlatformApp(Profile* profile, int index) { return SyncExtensionHelper::GetInstance()->InstallExtension( profile, CreateFakeAppName(index), - extensions::Extension::TYPE_PLATFORM_APP); + extensions::Manifest::TYPE_PLATFORM_APP); } std::string InstallAppForAllProfiles(int index) { diff --git a/chrome/browser/sync/test/integration/extensions_helper.cc b/chrome/browser/sync/test/integration/extensions_helper.cc index c6a91c4..e002eb5 100644 --- a/chrome/browser/sync/test/integration/extensions_helper.cc +++ b/chrome/browser/sync/test/integration/extensions_helper.cc @@ -12,7 +12,7 @@ #include "chrome/browser/profiles/profile.h" #include "chrome/browser/sync/test/integration/sync_datatype_helper.h" #include "chrome/browser/sync/test/integration/sync_extension_helper.h" -#include "chrome/common/extensions/extension.h" +#include "chrome/common/extensions/manifest.h" using sync_datatype_helper::test; @@ -53,7 +53,7 @@ std::string InstallExtension(Profile* profile, int index) { return SyncExtensionHelper::GetInstance()->InstallExtension( profile, CreateFakeExtensionName(index), - extensions::Extension::TYPE_EXTENSION); + extensions::Manifest::TYPE_EXTENSION); } std::string InstallExtensionForAllProfiles(int index) { diff --git a/chrome/browser/sync/test/integration/sync_extension_helper.cc b/chrome/browser/sync/test/integration/sync_extension_helper.cc index 1b0143a..69d54fa 100644 --- a/chrome/browser/sync/test/integration/sync_extension_helper.cc +++ b/chrome/browser/sync/test/integration/sync_extension_helper.cc @@ -21,6 +21,7 @@ #include "testing/gtest/include/gtest/gtest.h" using extensions::Extension; +using extensions::Manifest; SyncExtensionHelper::ExtensionState::ExtensionState() : enabled_state(ENABLED), incognito_enabled(false) {} @@ -64,7 +65,7 @@ void SyncExtensionHelper::SetupIfNecessary(SyncTest* test) { } std::string SyncExtensionHelper::InstallExtension( - Profile* profile, const std::string& name, Extension::Type type) { + Profile* profile, const std::string& name, Manifest::Type type) { scoped_refptr<Extension> extension = GetExtension(profile, name, type); if (!extension.get()) { NOTREACHED() << "Could not install extension " << name; @@ -266,27 +267,26 @@ std::string NameToPublicKey(const std::string& name) { // TODO(akalin): Somehow unify this with MakeExtension() in // extension_util_unittest.cc. scoped_refptr<Extension> CreateExtension( - const FilePath& base_dir, const std::string& name, - Extension::Type type) { + const FilePath& base_dir, const std::string& name, Manifest::Type type) { DictionaryValue source; source.SetString(extension_manifest_keys::kName, name); const std::string& public_key = NameToPublicKey(name); source.SetString(extension_manifest_keys::kPublicKey, public_key); source.SetString(extension_manifest_keys::kVersion, "0.0.0.0"); switch (type) { - case Extension::TYPE_EXTENSION: + case Manifest::TYPE_EXTENSION: // Do nothing. break; - case Extension::TYPE_THEME: + case Manifest::TYPE_THEME: source.Set(extension_manifest_keys::kTheme, new DictionaryValue()); break; - case Extension::TYPE_HOSTED_APP: - case Extension::TYPE_LEGACY_PACKAGED_APP: + case Manifest::TYPE_HOSTED_APP: + case Manifest::TYPE_LEGACY_PACKAGED_APP: source.Set(extension_manifest_keys::kApp, new DictionaryValue()); source.SetString(extension_manifest_keys::kLaunchWebURL, "http://www.example.com"); break; - case Extension::TYPE_PLATFORM_APP: { + case Manifest::TYPE_PLATFORM_APP: { source.Set(extension_manifest_keys::kApp, new DictionaryValue()); source.Set(extension_manifest_keys::kPlatformAppBackground, new DictionaryValue()); @@ -314,7 +314,7 @@ scoped_refptr<Extension> CreateExtension( } std::string error; scoped_refptr<Extension> extension = - Extension::Create(extension_dir, Extension::INTERNAL, source, + Extension::Create(extension_dir, Manifest::INTERNAL, source, Extension::NO_FLAGS, &error); if (!error.empty()) { ADD_FAILURE() << error; @@ -338,8 +338,7 @@ scoped_refptr<Extension> CreateExtension( } // namespace scoped_refptr<Extension> SyncExtensionHelper::GetExtension( - Profile* profile, const std::string& name, - Extension::Type type) { + Profile* profile, const std::string& name, Manifest::Type type) { if (name.empty()) { ADD_FAILURE(); return NULL; diff --git a/chrome/browser/sync/test/integration/sync_extension_helper.h b/chrome/browser/sync/test/integration/sync_extension_helper.h index 6cdca7d..a7f97e8 100644 --- a/chrome/browser/sync/test/integration/sync_extension_helper.h +++ b/chrome/browser/sync/test/integration/sync_extension_helper.h @@ -13,7 +13,7 @@ #include "base/compiler_specific.h" #include "base/memory/ref_counted.h" #include "base/memory/singleton.h" -#include "chrome/common/extensions/extension.h" +#include "chrome/common/extensions/manifest.h" class Profile; class SyncTest; @@ -38,7 +38,7 @@ class SyncExtensionHelper { // extension ID of the new extension. std::string InstallExtension(Profile* profile, const std::string& name, - extensions::Extension::Type type); + extensions::Manifest::Type type); // Uninstalls the extension with the given name from |profile|. void UninstallExtension(Profile* profile, const std::string& name); @@ -95,7 +95,7 @@ class SyncExtensionHelper { ExtensionNameMap; typedef std::map<Profile*, ExtensionNameMap> ProfileExtensionNameMap; typedef std::map<std::string, std::string> StringMap; - typedef std::map<std::string, extensions::Extension::Type> TypeMap; + typedef std::map<std::string, extensions::Manifest::Type> TypeMap; friend struct DefaultSingletonTraits<SyncExtensionHelper>; @@ -114,7 +114,7 @@ class SyncExtensionHelper { // have the same id. scoped_refptr<extensions::Extension> GetExtension( Profile* profile, const std::string& name, - extensions::Extension::Type type) WARN_UNUSED_RESULT; + extensions::Manifest::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 0ff10ce..28668c6 100644 --- a/chrome/browser/sync/test/integration/themes_helper.cc +++ b/chrome/browser/sync/test/integration/themes_helper.cc @@ -8,9 +8,9 @@ #include "base/string_number_conversions.h" #include "chrome/browser/themes/theme_service.h" #include "chrome/browser/themes/theme_service_factory.h" -#include "chrome/common/extensions/extension.h" #include "chrome/browser/sync/test/integration/sync_datatype_helper.h" #include "chrome/browser/sync/test/integration/sync_extension_helper.h" +#include "chrome/common/extensions/manifest.h" using sync_datatype_helper::test; @@ -60,7 +60,7 @@ bool HasOrWillHaveCustomTheme(Profile* profile, const std::string& id) { void UseCustomTheme(Profile* profile, int index) { SyncExtensionHelper::GetInstance()->InstallExtension( - profile, MakeName(index), extensions::Extension::TYPE_THEME); + profile, MakeName(index), extensions::Manifest::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 9a4fbd3..7f72b09 100644 --- a/chrome/browser/tab_contents/render_view_context_menu.cc +++ b/chrome/browser/tab_contents/render_view_context_menu.cc @@ -533,7 +533,7 @@ void RenderViewContextMenu::AppendPlatformAppItems() { PrintableSelectionText(), &index); // Add dev tools for unpacked extensions. - if (platform_app->location() == Extension::LOAD || + if (platform_app->location() == extensions::Manifest::LOAD || CommandLine::ForCurrentProcess()->HasSwitch( switches::kDebugPackedApps)) { // Add a separator if there are any items already in the menu. diff --git a/chrome/browser/themes/browser_theme_pack_unittest.cc b/chrome/browser/themes/browser_theme_pack_unittest.cc index 0021214..97bf82d 100644 --- a/chrome/browser/themes/browser_theme_pack_unittest.cc +++ b/chrome/browser/themes/browser_theme_pack_unittest.cc @@ -409,7 +409,7 @@ TEST_F(BrowserThemePackTest, CanBuildAndReadPack) { EXPECT_EQ("", error); ASSERT_TRUE(valid_value.get()); scoped_refptr<Extension> extension(Extension::Create( - star_gazing_path, Extension::INVALID, *valid_value, + star_gazing_path, extensions::Manifest::INVALID_LOCATION, *valid_value, Extension::REQUIRE_KEY, &error)); ASSERT_TRUE(extension.get()); ASSERT_EQ("", error); diff --git a/chrome/browser/themes/theme_service_unittest.cc b/chrome/browser/themes/theme_service_unittest.cc index 1c90389..81514ef 100644 --- a/chrome/browser/themes/theme_service_unittest.cc +++ b/chrome/browser/themes/theme_service_unittest.cc @@ -28,7 +28,7 @@ class ThemeServiceTest : public ExtensionServiceTestBase { std::string error; scoped_refptr<extensions::Extension> extension = extensions::Extension::Create( - path, extensions::Extension::EXTERNAL_PREF_DOWNLOAD, + path, extensions::Manifest::EXTERNAL_PREF_DOWNLOAD, source, extensions::Extension::NO_FLAGS, &error); EXPECT_TRUE(extension); EXPECT_EQ("", error); diff --git a/chrome/browser/themes/theme_syncable_service_unittest.cc b/chrome/browser/themes/theme_syncable_service_unittest.cc index b72750e..2f84f1e 100644 --- a/chrome/browser/themes/theme_syncable_service_unittest.cc +++ b/chrome/browser/themes/theme_syncable_service_unittest.cc @@ -138,7 +138,7 @@ scoped_refptr<extensions::Extension> MakeThemeExtension( string error; scoped_refptr<extensions::Extension> extension = extensions::Extension::Create( - extension_path, extensions::Extension::EXTERNAL_PREF_DOWNLOAD, source, + extension_path, extensions::Manifest::EXTERNAL_PREF_DOWNLOAD, source, extensions::Extension::NO_FLAGS, &error); EXPECT_TRUE(extension); EXPECT_EQ("", error); diff --git a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_per_app_unittest.cc b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_per_app_unittest.cc index 828d548..481363c 100644 --- a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_per_app_unittest.cc +++ b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_per_app_unittest.cc @@ -33,6 +33,7 @@ #include "ui/base/models/menu_model.h" using extensions::Extension; +using extensions::Manifest; namespace { const int kExpectedAppIndex = 1; @@ -60,22 +61,22 @@ class ChromeLauncherControllerPerAppTest : public BrowserWithTestWindowTest { CommandLine::ForCurrentProcess(), FilePath(), false); std::string error; - extension1_ = Extension::Create(FilePath(), Extension::LOAD, manifest, + extension1_ = Extension::Create(FilePath(), Manifest::LOAD, manifest, Extension::NO_FLAGS, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", &error); - extension2_ = Extension::Create(FilePath(), Extension::LOAD, manifest, + extension2_ = Extension::Create(FilePath(), Manifest::LOAD, manifest, Extension::NO_FLAGS, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", &error); // Fake gmail extension. - extension3_ = Extension::Create(FilePath(), Extension::LOAD, manifest, + extension3_ = Extension::Create(FilePath(), Manifest::LOAD, manifest, Extension::NO_FLAGS, gmail_app_id, &error); // Fake search extension. - extension4_ = Extension::Create(FilePath(), Extension::LOAD, manifest, + extension4_ = Extension::Create(FilePath(), Manifest::LOAD, manifest, Extension::NO_FLAGS, "coobgpohoikkiipiblmjeljniedjpjpf", &error); diff --git a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_per_browser_unittest.cc b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_per_browser_unittest.cc index e737b00..13aafbb 100644 --- a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_per_browser_unittest.cc +++ b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_per_browser_unittest.cc @@ -27,6 +27,7 @@ #include "testing/gtest/include/gtest/gtest.h" using extensions::Extension; +using extensions::Manifest; namespace { const int kExpectedAppIndex = 1; @@ -51,21 +52,21 @@ class ChromeLauncherControllerPerBrowserTest : public testing::Test { CommandLine::ForCurrentProcess(), FilePath(), false); std::string error; - extension1_ = Extension::Create(FilePath(), Extension::LOAD, manifest, + extension1_ = Extension::Create(FilePath(), Manifest::LOAD, manifest, Extension::NO_FLAGS, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", &error); - extension2_ = Extension::Create(FilePath(), Extension::LOAD, manifest, + extension2_ = Extension::Create(FilePath(), Manifest::LOAD, manifest, Extension::NO_FLAGS, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", &error); // Fake gmail extension. - extension3_ = Extension::Create(FilePath(), Extension::LOAD, manifest, + extension3_ = Extension::Create(FilePath(), Manifest::LOAD, manifest, Extension::NO_FLAGS, "pjkljhegncpnkpknbcohdijeoejaedia", &error); // Fake search extension. - extension4_ = Extension::Create(FilePath(), Extension::LOAD, manifest, + extension4_ = Extension::Create(FilePath(), Manifest::LOAD, manifest, Extension::NO_FLAGS, "coobgpohoikkiipiblmjeljniedjpjpf", &error); diff --git a/chrome/browser/ui/cocoa/extensions/extension_install_prompt_test_utils.mm b/chrome/browser/ui/cocoa/extensions/extension_install_prompt_test_utils.mm index 8dad9f2..88be605 100644 --- a/chrome/browser/ui/cocoa/extensions/extension_install_prompt_test_utils.mm +++ b/chrome/browser/ui/cocoa/extensions/extension_install_prompt_test_utils.mm @@ -41,8 +41,9 @@ scoped_refptr<Extension> LoadInstallPromptExtension() { return extension; } - extension = Extension::Create(path.DirName(), Extension::INVALID, *value, - Extension::NO_FLAGS, &error); + extension = Extension::Create( + path.DirName(), extensions::Manifest::INVALID_LOCATION, *value, + Extension::NO_FLAGS, &error); if (!extension.get()) LOG(ERROR) << error; 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 cf5cf2b..dd171ec 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 @@ -111,8 +111,8 @@ class ExtensionInstalledBubbleControllerTest : public CocoaProfileTest { std::string error; scoped_refptr<Extension> extension = - Extension::Create(path, Extension::INVALID, extension_input_value, - Extension::NO_FLAGS, &error); + Extension::Create(path, extensions::Manifest::INVALID_LOCATION, + extension_input_value, Extension::NO_FLAGS, &error); extension_service_->AddExtension(extension); return extension; } diff --git a/chrome/browser/ui/panels/base_panel_browser_test.cc b/chrome/browser/ui/panels/base_panel_browser_test.cc index fb42599..4846a55 100644 --- a/chrome/browser/ui/panels/base_panel_browser_test.cc +++ b/chrome/browser/ui/panels/base_panel_browser_test.cc @@ -411,7 +411,7 @@ NativePanelTesting* BasePanelBrowserTest::CreateNativePanelTesting( scoped_refptr<Extension> BasePanelBrowserTest::CreateExtension( const FilePath::StringType& path, - Extension::Location location, + extensions::Manifest::Location location, const DictionaryValue& extra_value) { #if defined(OS_WIN) FilePath full_path(FILE_PATH_LITERAL("c:\\")); diff --git a/chrome/browser/ui/panels/base_panel_browser_test.h b/chrome/browser/ui/panels/base_panel_browser_test.h index fc8f776..69db3b1 100644 --- a/chrome/browser/ui/panels/base_panel_browser_test.h +++ b/chrome/browser/ui/panels/base_panel_browser_test.h @@ -11,6 +11,7 @@ #include "chrome/browser/ui/panels/panel.h" #include "chrome/browser/ui/panels/panel_manager.h" #include "chrome/common/extensions/extension.h" +#include "chrome/common/extensions/manifest.h" #include "chrome/test/base/in_process_browser_test.h" #include "ui/gfx/rect.h" @@ -90,7 +91,7 @@ class BasePanelBrowserTest : public InProcessBrowserTest { scoped_refptr<extensions::Extension> CreateExtension( const FilePath::StringType& path, - extensions::Extension::Location location, + extensions::Manifest::Location location, const DictionaryValue& extra_value); void MoveMouseAndWaitForExpansionStateChange(Panel* panel, diff --git a/chrome/browser/ui/panels/panel_browsertest.cc b/chrome/browser/ui/panels/panel_browsertest.cc index 85bd89c..69a3486 100644 --- a/chrome/browser/ui/panels/panel_browsertest.cc +++ b/chrome/browser/ui/panels/panel_browsertest.cc @@ -45,7 +45,6 @@ #include "ui/gfx/screen.h" using content::WebContents; -using extensions::Extension; class PanelBrowserTest : public BasePanelBrowserTest { public: @@ -1438,9 +1437,9 @@ IN_PROC_BROWSER_TEST_F(PanelBrowserTest, MAYBE_NonExtensionDomainPanelsCloseOnUninstall) { // Create a test extension. DictionaryValue empty_value; - scoped_refptr<Extension> extension = + scoped_refptr<extensions::Extension> extension = CreateExtension(FILE_PATH_LITERAL("TestExtension"), - Extension::INVALID, empty_value); + extensions::Manifest::INVALID_LOCATION, empty_value); std::string extension_app_name = web_app::GenerateApplicationNameFromExtensionId(extension->id()); @@ -1464,9 +1463,9 @@ IN_PROC_BROWSER_TEST_F(PanelBrowserTest, EXPECT_EQ(2, panel_manager->num_panels()); // Create another extension and a panel from that extension. - scoped_refptr<Extension> extension_other = + scoped_refptr<extensions::Extension> extension_other = CreateExtension(FILE_PATH_LITERAL("TestExtensionOther"), - Extension::INVALID, empty_value); + extensions::Manifest::INVALID_LOCATION, empty_value); std::string extension_app_name_other = web_app::GenerateApplicationNameFromExtensionId(extension_other->id()); Panel* panel_other = CreatePanel(extension_app_name_other); diff --git a/chrome/browser/ui/tabs/tab_strip_model_unittest.cc b/chrome/browser/ui/tabs/tab_strip_model_unittest.cc index d865bee..ea200c7 100644 --- a/chrome/browser/ui/tabs/tab_strip_model_unittest.cc +++ b/chrome/browser/ui/tabs/tab_strip_model_unittest.cc @@ -1717,8 +1717,8 @@ TEST_F(TabStripModelTest, Apps) { manifest.SetString("version", "1"); std::string error; scoped_refptr<Extension> extension_app( - Extension::Create(path, Extension::INVALID, manifest, Extension::NO_FLAGS, - &error)); + Extension::Create(path, extensions::Manifest::INVALID_LOCATION, + manifest, Extension::NO_FLAGS, &error)); extension_app->launch_web_url_ = "http://www.google.com"; WebContents* contents1 = CreateWebContents(); extensions::TabHelper::CreateForWebContents(contents1); diff --git a/chrome/browser/ui/webui/extensions/extension_settings_handler.cc b/chrome/browser/ui/webui/extensions/extension_settings_handler.cc index 22840cc..30fbae5 100644 --- a/chrome/browser/ui/webui/extensions/extension_settings_handler.cc +++ b/chrome/browser/ui/webui/extensions/extension_settings_handler.cc @@ -75,6 +75,7 @@ using extensions::Extension; using extensions::ExtensionUpdater; using extensions::ExtensionWarning; using extensions::ManagementPolicy; +using extensions::Manifest; /////////////////////////////////////////////////////////////////////////////// // @@ -131,11 +132,11 @@ DictionaryValue* ExtensionSettingsHandler::CreateExtensionDetailValue( extension_misc::EXTENSION_ICON_MEDIUM, ExtensionIconSet::MATCH_BIGGER, !enabled, NULL); - if (extension->location() == Extension::LOAD) + if (extension->location() == Manifest::LOAD) extension_data->SetString("path", extension->path().value()); extension_data->SetString("icon", icon.spec()); extension_data->SetBoolean("isUnpacked", - extension->location() == Extension::LOAD); + extension->location() == Manifest::LOAD); extension_data->SetBoolean("terminated", extension_service_->terminated_extensions()->Contains(extension->id())); extension_data->SetBoolean("enabledIncognito", @@ -149,7 +150,7 @@ DictionaryValue* ExtensionSettingsHandler::CreateExtensionDetailValue( enabled && CommandLine::ForCurrentProcess()->HasSwitch( switches::kEnableExtensionActivityUI)); extension_data->SetBoolean("allow_reload", - extension->location() == Extension::LOAD); + extension->location() == Manifest::LOAD); extension_data->SetBoolean("is_hosted_app", extension->is_hosted_app()); extension_data->SetBoolean("is_platform_app", extension->is_platform_app()); extension_data->SetBoolean("homepageProvided", @@ -165,11 +166,11 @@ DictionaryValue* ExtensionSettingsHandler::CreateExtensionDetailValue( extension_data->SetString("disableReason", automatically_disabled_text); string16 location_text; - if (extension->location() == Extension::INTERNAL && + if (extension->location() == Manifest::INTERNAL && !extension->UpdatesFromGallery()) { location_text = l10n_util::GetStringUTF16( IDS_OPTIONS_SIDELOAD_WIPEOUT_DISABLE_REASON_UNKNOWN); - } else if (extension->location() == Extension::EXTERNAL_REGISTRY) { + } else if (extension->location() == Manifest::EXTERNAL_REGISTRY) { location_text = l10n_util::GetStringUTF16( IDS_OPTIONS_SIDELOAD_WIPEOUT_DISABLE_REASON_3RD_PARTY); } @@ -177,7 +178,7 @@ DictionaryValue* ExtensionSettingsHandler::CreateExtensionDetailValue( // Determine the sort order: Extensions loaded through --load-extensions show // up at the top. Disabled extensions show up at the bottom. - if (extension->location() == Extension::LOAD) + if (extension->location() == Manifest::LOAD) extension_data->SetInteger("order", 1); else extension_data->SetInteger("order", 2); @@ -228,16 +229,16 @@ DictionaryValue* ExtensionSettingsHandler::CreateExtensionDetailValue( } // Add install warnings (these are not the same as warnings!). - if (extension->location() == Extension::LOAD) { - const Extension::InstallWarningVector& install_warnings = + if (extension->location() == Manifest::LOAD) { + const std::vector<extensions::InstallWarning>& install_warnings = extension->install_warnings(); if (!install_warnings.empty()) { scoped_ptr<ListValue> list(new ListValue()); - for (Extension::InstallWarningVector::const_iterator it = + for (std::vector<extensions::InstallWarning>::const_iterator it = install_warnings.begin(); it != install_warnings.end(); ++it) { DictionaryValue* item = new DictionaryValue(); item->SetBoolean("isHTML", - it->format == Extension::InstallWarning::FORMAT_HTML); + it->format == extensions::InstallWarning::FORMAT_HTML); item->SetString("message", it->message); list->Append(item); } @@ -506,7 +507,7 @@ void ExtensionSettingsHandler::ReloadUnpackedExtensions() { std::vector<const Extension*> unpacked_extensions; for (ExtensionSet::const_iterator extension = extensions->begin(); extension != extensions->end(); ++extension) { - if ((*extension)->location() == Extension::LOAD) + if ((*extension)->location() == Manifest::LOAD) unpacked_extensions.push_back(*extension); } diff --git a/chrome/browser/ui/webui/ntp/app_launcher_handler.cc b/chrome/browser/ui/webui/ntp/app_launcher_handler.cc index 775a1d3..c847acb 100644 --- a/chrome/browser/ui/webui/ntp/app_launcher_handler.cc +++ b/chrome/browser/ui/webui/ntp/app_launcher_handler.cc @@ -134,7 +134,7 @@ void AppLauncherHandler::CreateAppInfo( prefs->GetLaunchType(extension, ExtensionPrefs::LAUNCH_DEFAULT)); value->SetBoolean("is_component", - extension->location() == Extension::COMPONENT); + extension->location() == extensions::Manifest::COMPONENT); value->SetBoolean("is_webstore", extension->id() == extension_misc::kWebStoreAppId); |