diff options
Diffstat (limited to 'chrome/browser')
-rw-r--r-- | chrome/browser/browser_theme_pack.cc | 2 | ||||
-rw-r--r-- | chrome/browser/browser_theme_provider.cc | 4 | ||||
-rw-r--r-- | chrome/browser/dom_ui/app_launcher_handler.cc | 2 | ||||
-rw-r--r-- | chrome/browser/extensions/crx_installer.cc | 2 | ||||
-rw-r--r-- | chrome/browser/extensions/extension_install_ui.cc | 6 | ||||
-rw-r--r-- | chrome/browser/extensions/extension_updater.cc | 2 | ||||
-rw-r--r-- | chrome/browser/extensions/extensions_service.cc | 12 | ||||
-rw-r--r-- | chrome/browser/extensions/extensions_service_unittest.cc | 52 | ||||
-rw-r--r-- | chrome/browser/extensions/extensions_ui.cc | 2 | ||||
-rw-r--r-- | chrome/browser/extensions/sandboxed_extension_unpacker.cc | 5 | ||||
-rw-r--r-- | chrome/browser/gtk/extension_install_prompt2_gtk.cc | 2 | ||||
-rw-r--r-- | chrome/browser/sync/glue/extension_util.cc | 4 | ||||
-rw-r--r-- | chrome/browser/sync/glue/theme_change_processor.cc | 10 | ||||
-rw-r--r-- | chrome/browser/sync/glue/theme_util.cc | 8 | ||||
-rw-r--r-- | chrome/browser/views/extensions/extension_install_prompt2.cc | 2 |
15 files changed, 58 insertions, 57 deletions
diff --git a/chrome/browser/browser_theme_pack.cc b/chrome/browser/browser_theme_pack.cc index fb85301..bf40435 100644 --- a/chrome/browser/browser_theme_pack.cc +++ b/chrome/browser/browser_theme_pack.cc @@ -326,7 +326,7 @@ BrowserThemePack::~BrowserThemePack() { BrowserThemePack* BrowserThemePack::BuildFromExtension(Extension* extension) { DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI)); DCHECK(extension); - DCHECK(extension->IsTheme()); + DCHECK(extension->is_theme()); BrowserThemePack* pack = new BrowserThemePack; pack->BuildHeader(extension); diff --git a/chrome/browser/browser_theme_provider.cc b/chrome/browser/browser_theme_provider.cc index cdbb684..b26ff4e 100644 --- a/chrome/browser/browser_theme_provider.cc +++ b/chrome/browser/browser_theme_provider.cc @@ -269,7 +269,7 @@ void BrowserThemeProvider::SetTheme(Extension* extension) { FreePlatformCaches(); DCHECK(extension); - DCHECK(extension->IsTheme()); + DCHECK(extension->is_theme()); BuildFromExtension(extension); SaveThemeID(extension->id()); @@ -289,7 +289,7 @@ void BrowserThemeProvider::RemoveUnusedThemes() { const ExtensionList* extensions = service->extensions(); for (ExtensionList::const_iterator it = extensions->begin(); it != extensions->end(); ++it) { - if ((*it)->IsTheme() && (*it)->id() != current_theme) { + if ((*it)->is_theme() && (*it)->id() != current_theme) { remove_list.push_back((*it)->id()); } } diff --git a/chrome/browser/dom_ui/app_launcher_handler.cc b/chrome/browser/dom_ui/app_launcher_handler.cc index 5fe6ba5..31384cb 100644 --- a/chrome/browser/dom_ui/app_launcher_handler.cc +++ b/chrome/browser/dom_ui/app_launcher_handler.cc @@ -115,7 +115,7 @@ void AppLauncherHandler::HandleGetApps(const Value* value) { const ExtensionList* extensions = extensions_service_->extensions(); for (ExtensionList::const_iterator it = extensions->begin(); it != extensions->end(); ++it) { - if ((*it)->IsApp()) { + if ((*it)->is_app()) { DictionaryValue* app_info = new DictionaryValue(); CreateAppInfo(*it, app_info); list->Append(app_info); diff --git a/chrome/browser/extensions/crx_installer.cc b/chrome/browser/extensions/crx_installer.cc index 832318c..e5bed66 100644 --- a/chrome/browser/extensions/crx_installer.cc +++ b/chrome/browser/extensions/crx_installer.cc @@ -137,7 +137,7 @@ void CrxInstaller::OnUnpackSuccess(const FilePath& temp_dir, // Determine whether to allow installation. We always allow themes and // external installs. - if (!extensions_enabled_ && !extension->IsTheme() && + if (!extensions_enabled_ && !extension->is_theme() && !Extension::IsExternalLocation(install_source_)) { ReportFailureFromFileThread("Extensions are not enabled."); return; diff --git a/chrome/browser/extensions/extension_install_ui.cc b/chrome/browser/extensions/extension_install_ui.cc index dfd3ef6..c5c22f6 100644 --- a/chrome/browser/extensions/extension_install_ui.cc +++ b/chrome/browser/extensions/extension_install_ui.cc @@ -158,7 +158,7 @@ void ExtensionInstallUI::ConfirmInstall(Delegate* delegate, // We special-case themes to not show any confirm UI. Instead they are // immediately installed, and then we show an infobar (see OnInstallSuccess) // to allow the user to revert if they don't like it. - if (extension->IsTheme()) { + if (extension->is_theme()) { // Remember the current theme in case the user pressed undo. Extension* previous_theme = profile_->GetTheme(); if (previous_theme) @@ -190,7 +190,7 @@ void ExtensionInstallUI::ConfirmUninstall(Delegate* delegate, } void ExtensionInstallUI::OnInstallSuccess(Extension* extension) { - if (extension->IsTheme()) { + if (extension->is_theme()) { ShowThemeInfoBar(previous_theme_id_, previous_use_system_theme_, extension, profile_); return; @@ -302,7 +302,7 @@ void ExtensionInstallUI::OnImageLoaded( void ExtensionInstallUI::ShowThemeInfoBar( const std::string& previous_theme_id, bool previous_use_system_theme, Extension* new_theme, Profile* profile) { - if (!new_theme->IsTheme()) + if (!new_theme->is_theme()) return; // Get last active normal browser of profile. diff --git a/chrome/browser/extensions/extension_updater.cc b/chrome/browser/extensions/extension_updater.cc index f4a0443..781a200 100644 --- a/chrome/browser/extensions/extension_updater.cc +++ b/chrome/browser/extensions/extension_updater.cc @@ -166,7 +166,7 @@ void ManifestFetchesBuilder::AddExtension(const Extension& extension) { extension.id(), *extension.version(), extension.converted_from_user_script(), - extension.IsTheme(), + extension.is_theme(), extension.update_url()); } diff --git a/chrome/browser/extensions/extensions_service.cc b/chrome/browser/extensions/extensions_service.cc index e474576..57ef3e2 100644 --- a/chrome/browser/extensions/extensions_service.cc +++ b/chrome/browser/extensions/extensions_service.cc @@ -504,7 +504,7 @@ void ExtensionsService::ContinueLoadAllExtensions( if ((*ex)->location() == Extension::LOAD) continue; - if ((*ex)->IsTheme()) { + if ((*ex)->is_theme()) { theme_count++; } else if ((*ex)->converted_from_user_script()) { user_script_count++; @@ -780,7 +780,7 @@ void ExtensionsService::OnExtensionLoaded(Extension* extension, // TODO(aa): Need to re-evaluate this branch. Does this still make sense now // that extensions are enabled by default? if (extensions_enabled() || - extension->IsTheme() || + extension->is_theme() || extension->location() == Extension::LOAD || Extension::IsExternalLocation(extension->location())) { Extension* old = GetExtensionByIdInternal(extension->id(), true, true); @@ -842,7 +842,7 @@ void ExtensionsService::OnExtensionLoaded(Extension* extension, void ExtensionsService::UpdateActiveExtensionsInCrashReporter() { std::set<std::string> extension_ids; for (size_t i = 0; i < extensions_.size(); ++i) { - if (!extensions_[i]->IsTheme()) + if (!extensions_[i]->is_theme()) extension_ids.insert(extensions_[i]->id()); } @@ -854,9 +854,9 @@ void ExtensionsService::OnExtensionInstalled(Extension* extension, PendingExtensionMap::iterator it = pending_extensions_.find(extension->id()); if (it != pending_extensions_.end() && - (it->second.is_theme != extension->IsTheme())) { + (it->second.is_theme != extension->is_theme())) { LOG(WARNING) << "Not installing pending extension " << extension->id() - << " with is_theme = " << extension->IsTheme() + << " with is_theme = " << extension->is_theme() << "; expected is_theme = " << it->second.is_theme; // Delete the extension directory since we're not going to load // it. @@ -871,7 +871,7 @@ void ExtensionsService::OnExtensionInstalled(Extension* extension, // If the extension is a theme, tell the profile (and therefore ThemeProvider) // to apply it. - if (extension->IsTheme()) { + if (extension->is_theme()) { NotificationService::current()->Notify( NotificationType::THEME_INSTALLED, Source<Profile>(profile_), diff --git a/chrome/browser/extensions/extensions_service_unittest.cc b/chrome/browser/extensions/extensions_service_unittest.cc index 5d7aac7..f3660cf 100644 --- a/chrome/browser/extensions/extensions_service_unittest.cc +++ b/chrome/browser/extensions/extensions_service_unittest.cc @@ -61,7 +61,6 @@ const char* const good_crx = "ldnnhddmnhbkjipkidpdiheffobcpfmf"; const char* const page_action = "obcimlgaoabeegjmmpldobjndiealpln"; const char* const theme_crx = "iamefpfkojoapidjnbafmgkgncegbkad"; const char* const theme2_crx = "pjpgmfcmabopnnfonnhmdjglfpjjfkbf"; -const char* const app_crx = "hnbefahlpjbkldcaldefcnonockppomb"; struct ExtensionsOrder { bool operator()(const Extension* a, const Extension* b) { @@ -382,6 +381,22 @@ class ExtensionsServiceTest void TestExternalProvider(MockExtensionProvider* provider, Extension::Location location); + void PackAndInstallExtension(const FilePath& dir_path, + bool should_succeed) { + FilePath crx_path; + ASSERT_TRUE(PathService::Get(base::DIR_TEMP, &crx_path)); + crx_path = crx_path.AppendASCII("temp.crx"); + FilePath pem_path = crx_path.DirName().AppendASCII("temp.pem"); + + ASSERT_TRUE(file_util::Delete(crx_path, false)); + ASSERT_TRUE(file_util::Delete(pem_path, false)); + scoped_ptr<ExtensionCreator> creator(new ExtensionCreator()); + ASSERT_TRUE(creator->Run(dir_path, crx_path, FilePath(), pem_path)); + ASSERT_TRUE(file_util::PathExists(crx_path)); + + InstallExtension(crx_path, should_succeed); + } + void InstallExtension(const FilePath& path, bool should_succeed) { ASSERT_TRUE(file_util::PathExists(path)); @@ -981,28 +996,15 @@ TEST_F(ExtensionsServiceTest, LoadLocalizedTheme) { } TEST_F(ExtensionsServiceTest, InstallLocalizedTheme) { - // Pack. InitializeEmptyExtensionsService(); - FilePath extension_path; - ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &extension_path)); - extension_path = extension_path + FilePath theme_path; + ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &theme_path)); + theme_path = theme_path .AppendASCII("extensions") .AppendASCII("theme_i18n"); - FilePath crx_path; - ASSERT_TRUE(PathService::Get(base::DIR_TEMP, &crx_path)); - crx_path = crx_path.AppendASCII("theme.crx"); - FilePath pem_path = crx_path.DirName().AppendASCII("theme.pem"); - - ASSERT_TRUE(file_util::Delete(crx_path, false)); - ASSERT_TRUE(file_util::Delete(pem_path, false)); - scoped_ptr<ExtensionCreator> creator(new ExtensionCreator()); - ASSERT_TRUE(creator->Run(extension_path, crx_path, FilePath(), pem_path)); - ASSERT_TRUE(file_util::PathExists(crx_path)); + PackAndInstallExtension(theme_path, true); - // Install. - service_->UnloadAllExtensions(); - InstallExtension(crx_path, true); EXPECT_EQ(0u, GetErrors().size()); EXPECT_EQ(1u, service_->extensions()->size()); EXPECT_EQ("name", service_->extensions()->at(0)->name()); @@ -1016,18 +1018,20 @@ TEST_F(ExtensionsServiceTest, InstallApps) { extensions_path = extensions_path.AppendASCII("extensions"); // An empty app. - InstallExtension(extensions_path.AppendASCII("app1.crx"), true); + PackAndInstallExtension(extensions_path.AppendASCII("app1"), true); int pref_count = 0; ValidatePrefKeyCount(++pref_count); - ValidateIntegerPref(app_crx, L"state", Extension::ENABLED); - ValidateIntegerPref(app_crx, L"location", Extension::INTERNAL); + ASSERT_EQ(1u, service_->extensions()->size()); + std::string id = service_->extensions()->at(0)->id(); + ValidateIntegerPref(id, L"state", Extension::ENABLED); + ValidateIntegerPref(id, L"location", Extension::INTERNAL); // Another app with non-overlapping extent. Should succeed. - InstallExtension(extensions_path.AppendASCII("app2.crx"), true); + PackAndInstallExtension(extensions_path.AppendASCII("app2"), true); ValidatePrefKeyCount(++pref_count); // A third app whose extent overlaps the first. Should fail. - InstallExtension(extensions_path.AppendASCII("app3.crx"), false); + PackAndInstallExtension(extensions_path.AppendASCII("app3"), false); ValidatePrefKeyCount(pref_count); } @@ -1299,7 +1303,7 @@ TEST_F(ExtensionsServiceTest, UpdatePendingExtensionAlreadyInstalled) { // balk. service_->AddPendingExtensionInternal( good->id(), good->update_url(), *good->version(), - good->IsTheme(), kGoodInstallSilently); + good->is_theme(), kGoodInstallSilently); UpdateExtension(good->id(), path, true, true, false); diff --git a/chrome/browser/extensions/extensions_ui.cc b/chrome/browser/extensions/extensions_ui.cc index 9155705..8c6664b 100644 --- a/chrome/browser/extensions/extensions_ui.cc +++ b/chrome/browser/extensions/extensions_ui.cc @@ -55,7 +55,7 @@ namespace { static bool ShouldShowExtension(Extension* extension) { // Don't show the themes since this page's UI isn't really useful for // themes. - if (extension->IsTheme()) + if (extension->is_theme()) return false; // Don't show component extensions because they are only extensions as an diff --git a/chrome/browser/extensions/sandboxed_extension_unpacker.cc b/chrome/browser/extensions/sandboxed_extension_unpacker.cc index 600d832..ab72325 100644 --- a/chrome/browser/extensions/sandboxed_extension_unpacker.cc +++ b/chrome/browser/extensions/sandboxed_extension_unpacker.cc @@ -276,10 +276,7 @@ DictionaryValue* SandboxedExtensionUnpacker::RewriteManifestFile( static_cast<DictionaryValue*>(manifest.DeepCopy())); final_manifest->SetString(extension_manifest_keys::kPublicKey, public_key_); - bool web_content_enabled = false; - if (final_manifest->GetBoolean(extension_manifest_keys::kWebContentEnabled, - &web_content_enabled) && - web_content_enabled) { + if (final_manifest->HasKey(extension_manifest_keys::kApp)) { bool has_web_origin = final_manifest->Get(extension_manifest_keys::kWebOrigin, NULL); if (force_web_origin_override_) { diff --git a/chrome/browser/gtk/extension_install_prompt2_gtk.cc b/chrome/browser/gtk/extension_install_prompt2_gtk.cc index 6a442f2..106a0eb 100644 --- a/chrome/browser/gtk/extension_install_prompt2_gtk.cc +++ b/chrome/browser/gtk/extension_install_prompt2_gtk.cc @@ -107,7 +107,7 @@ void ShowInstallPromptDialog2(GtkWindow* parent, SkBitmap* skia_icon, !show_permissions, !show_permissions, 0); if (show_permissions) { - int label = extension->IsApp() ? + int label = extension->is_app() ? IDS_EXTENSION_PROMPT2_APP_WILL_HAVE_ACCESS_TO : IDS_EXTENSION_PROMPT2_WILL_HAVE_ACCESS_TO; GtkWidget* warning_label = gtk_label_new(l10n_util::GetStringUTF8( diff --git a/chrome/browser/sync/glue/extension_util.cc b/chrome/browser/sync/glue/extension_util.cc index e2b7505..9cc8f7f 100644 --- a/chrome/browser/sync/glue/extension_util.cc +++ b/chrome/browser/sync/glue/extension_util.cc @@ -17,11 +17,11 @@ namespace browser_sync { bool IsExtensionSyncable(const Extension& extension) { - if (extension.IsTheme()) { + if (extension.is_theme()) { return false; } - // TODO(akalin): Add Extensions::IsApp(). + // TODO(akalin): Add Extensions::is_app(). // TODO(akalin): Figure out if we want to treat extensions and apps // identically after all. if (!extension.GetFullLaunchURL().is_empty()) { diff --git a/chrome/browser/sync/glue/theme_change_processor.cc b/chrome/browser/sync/glue/theme_change_processor.cc index c44dbb1..c4e4f68 100644 --- a/chrome/browser/sync/glue/theme_change_processor.cc +++ b/chrome/browser/sync/glue/theme_change_processor.cc @@ -19,7 +19,7 @@ namespace browser_sync { namespace { std::string GetThemeId(Extension* current_theme) { if (current_theme) { - DCHECK(current_theme->IsTheme()); + DCHECK(current_theme->is_theme()); } return current_theme ? current_theme->id() : "default/system"; } @@ -56,7 +56,7 @@ void ThemeChangeProcessor::Observe(NotificationType type, DCHECK_EQ(Source<BrowserThemeProvider>(source).ptr(), profile_->GetThemeProvider()); if (extension != NULL) { - DCHECK(extension->IsTheme()); + DCHECK(extension->is_theme()); DCHECK_EQ(extension->id(), current_or_future_theme_id); if (!current_theme || (current_theme->id() != extension->id())) { return; @@ -71,7 +71,7 @@ void ThemeChangeProcessor::Observe(NotificationType type, // installed successfully. DCHECK_EQ(Source<Profile>(source).ptr(), profile_); CHECK(extension); - if (!extension->IsTheme()) { + if (!extension->is_theme()) { return; } LOG(INFO) << "Got EXTENSION_LOADED notification for theme " @@ -87,7 +87,7 @@ void ThemeChangeProcessor::Observe(NotificationType type, // theme). DCHECK_EQ(Source<Profile>(source).ptr(), profile_); CHECK(extension); - if (!extension->IsTheme()) { + if (!extension->is_theme()) { return; } LOG(INFO) << "Got EXTENSION_UNLOADED notification for theme " @@ -101,7 +101,7 @@ void ThemeChangeProcessor::Observe(NotificationType type, DCHECK_EQ(extension, current_theme); if (extension) { - DCHECK(extension->IsTheme()); + DCHECK(extension->is_theme()); } LOG(INFO) << "Theme changed to " << GetThemeId(extension); diff --git a/chrome/browser/sync/glue/theme_util.cc b/chrome/browser/sync/glue/theme_util.cc index 75f768a..4ea65a4 100644 --- a/chrome/browser/sync/glue/theme_util.cc +++ b/chrome/browser/sync/glue/theme_util.cc @@ -91,7 +91,7 @@ void SetCurrentThemeFromThemeSpecifics( CHECK(extensions_service); Extension* extension = extensions_service->GetExtensionById(id, true); if (extension) { - if (!extension->IsTheme()) { + if (!extension->is_theme()) { LOG(INFO) << "Extension " << id << " is not a theme; aborting"; return; } @@ -111,7 +111,7 @@ void SetCurrentThemeFromThemeSpecifics( { const Extension* current_theme = profile->GetTheme(); if (current_theme) { - DCHECK(current_theme->IsTheme()); + DCHECK(current_theme->is_theme()); previous_theme_id = current_theme->id(); } } @@ -159,7 +159,7 @@ void GetThemeSpecificsFromCurrentTheme( DCHECK(profile); const Extension* current_theme = profile->GetTheme(); if (current_theme) { - DCHECK(current_theme->IsTheme()); + DCHECK(current_theme->is_theme()); } GetThemeSpecificsFromCurrentThemeHelper( current_theme, @@ -183,7 +183,7 @@ void GetThemeSpecificsFromCurrentThemeHelper( } if (use_custom_theme) { DCHECK(current_theme); - DCHECK(current_theme->IsTheme()); + DCHECK(current_theme->is_theme()); theme_specifics->set_custom_theme_name(current_theme->name()); theme_specifics->set_custom_theme_id(current_theme->id()); theme_specifics->set_custom_theme_update_url( diff --git a/chrome/browser/views/extensions/extension_install_prompt2.cc b/chrome/browser/views/extensions/extension_install_prompt2.cc index cb6dab9..397ade7 100644 --- a/chrome/browser/views/extensions/extension_install_prompt2.cc +++ b/chrome/browser/views/extensions/extension_install_prompt2.cc @@ -139,7 +139,7 @@ InstallDialogContent2::InstallDialogContent2( right_column_width_ = kNoPermissionsRightColumnWidth; } else { right_column_width_ = kPermissionBoxWidth; - int label = extension->IsApp() ? + int label = extension->is_app() ? IDS_EXTENSION_PROMPT2_APP_WILL_HAVE_ACCESS_TO : IDS_EXTENSION_PROMPT2_WILL_HAVE_ACCESS_TO; will_have_access_to_ = new views::Label(l10n_util::GetString(label)); |