Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(51)

Unified Diff: chrome/browser/search/hotword_service.cc

Issue 647083003: Reinstall the hotword shared module on a lanuage change. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Test update. Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/search/hotword_service.cc
diff --git a/chrome/browser/search/hotword_service.cc b/chrome/browser/search/hotword_service.cc
index c8bf7052843e9341eb97979ae99b4535468377eb..86912083f9a7cbeff6bf66b3c68da57a80639f75 100644
--- a/chrome/browser/search/hotword_service.cc
+++ b/chrome/browser/search/hotword_service.cc
@@ -261,8 +261,9 @@ void HotwordService::OnExtensionUninstalled(
extensions::UninstallReason reason) {
CHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
- if (extension->id() != extension_misc::kHotwordExtensionId ||
- profile_ != Profile::FromBrowserContext(browser_context) ||
+ if ((extension->id() != extension_misc::kHotwordExtensionId &&
+ extension->id() != extension_misc::kHotwordSharedModuleId) ||
+ profile_ != Profile::FromBrowserContext(browser_context) ||
!GetExtensionService(profile_))
return;
@@ -276,8 +277,13 @@ void HotwordService::OnExtensionUninstalled(
}
void HotwordService::InstallHotwordExtensionFromWebstore() {
+ std::string extension_id;
+ if (IsExperimentalHotwordingEnabled())
+ extension_id = extension_misc::kHotwordSharedModuleId;
+ else
+ extension_id = extension_misc::kHotwordExtensionId;
rpetterson 2014/10/20 06:31:21 You're repeating this code a lot in here. Helper f
Anand Mistry (off Chromium) 2014/10/20 10:04:49 Done.
installer_ = new extensions::WebstoreStartupInstaller(
- extension_misc::kHotwordExtensionId,
+ extension_id,
profile_,
false,
extensions::WebstoreStandaloneInstaller::Callback());
@@ -289,8 +295,9 @@ void HotwordService::OnExtensionInstalled(
const extensions::Extension* extension,
bool is_update) {
- if (extension->id() != extension_misc::kHotwordExtensionId ||
- profile_ != Profile::FromBrowserContext(browser_context))
+ if ((extension->id() != extension_misc::kHotwordExtensionId &&
+ extension->id() != extension_misc::kHotwordSharedModuleId) ||
+ profile_ != Profile::FromBrowserContext(browser_context))
return;
// If the previous locale pref has never been set, set it now since
@@ -329,8 +336,13 @@ bool HotwordService::MaybeReinstallHotwordExtension() {
if (!extension_service)
return false;
+ std::string extension_id;
+ if (IsExperimentalHotwordingEnabled())
+ extension_id = extension_misc::kHotwordSharedModuleId;
+ else
+ extension_id = extension_misc::kHotwordExtensionId;
const extensions::Extension* extension = extension_service->GetExtensionById(
- extension_misc::kHotwordExtensionId, true);
+ extension_id, true);
if (!extension)
return false;
@@ -361,13 +373,18 @@ bool HotwordService::MaybeReinstallHotwordExtension() {
bool HotwordService::UninstallHotwordExtension(
ExtensionService* extension_service) {
base::string16 error;
+ std::string extension_id;
+ if (IsExperimentalHotwordingEnabled())
+ extension_id = extension_misc::kHotwordSharedModuleId;
+ else
+ extension_id = extension_misc::kHotwordExtensionId;
if (!extension_service->UninstallExtension(
- extension_misc::kHotwordExtensionId,
+ extension_id,
extensions::UNINSTALL_REASON_INTERNAL_MANAGEMENT,
base::Bind(&base::DoNothing),
&error)) {
LOG(WARNING) << "Cannot uninstall extension with id "
- << extension_misc::kHotwordExtensionId
+ << extension_id
<< ": " << error;
reinstall_pending_ = false;
return false;
@@ -386,8 +403,6 @@ bool HotwordService::IsServiceAvailable() {
// if the user opted out.
std::string extensionId;
if (IsExperimentalHotwordingEnabled()) {
- // TODO(amistry): Handle reloading on language change as the old extension
- // does.
extensionId = extension_misc::kHotwordSharedModuleId;
} else {
extensionId = extension_misc::kHotwordExtensionId;
« no previous file with comments | « chrome/browser/extensions/extension_service_test_base.h ('k') | chrome/browser/search/hotword_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698