OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/search/hotword_service.h" | 5 #include "chrome/browser/search/hotword_service.h" |
6 | 6 |
7 #include "base/i18n/case_conversion.h" | 7 #include "base/i18n/case_conversion.h" |
8 #include "base/metrics/field_trial.h" | 8 #include "base/metrics/field_trial.h" |
9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
353 // change so it's okay to reinstall. | 353 // change so it's okay to reinstall. |
354 reinstall_pending_ = true; | 354 reinstall_pending_ = true; |
355 | 355 |
356 return UninstallHotwordExtension(extension_service); | 356 return UninstallHotwordExtension(extension_service); |
357 } | 357 } |
358 | 358 |
359 bool HotwordService::UninstallHotwordExtension( | 359 bool HotwordService::UninstallHotwordExtension( |
360 ExtensionService* extension_service) { | 360 ExtensionService* extension_service) { |
361 base::string16 error; | 361 base::string16 error; |
362 if (!extension_service->UninstallExtension( | 362 if (!extension_service->UninstallExtension( |
363 extension_misc::kHotwordExtensionId, true, &error)) { | 363 extension_misc::kHotwordExtensionId, |
364 ExtensionService::UNINSTALL_REASON_DEFAULT, | |
Devlin
2014/07/01 17:39:10
This one's tricky. I'd love to get rid of DEFAULT
rpaquay
2014/07/01 22:56:53
I like the "internal management" idea. I added a c
| |
365 &error)) { | |
364 LOG(WARNING) << "Cannot uninstall extension with id " | 366 LOG(WARNING) << "Cannot uninstall extension with id " |
365 << extension_misc::kHotwordExtensionId | 367 << extension_misc::kHotwordExtensionId |
366 << ": " << error; | 368 << ": " << error; |
367 reinstall_pending_ = false; | 369 reinstall_pending_ = false; |
368 return false; | 370 return false; |
369 } | 371 } |
370 return true; | 372 return true; |
371 } | 373 } |
372 | 374 |
373 bool HotwordService::IsServiceAvailable() { | 375 bool HotwordService::IsServiceAvailable() { |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
497 return false; | 499 return false; |
498 | 500 |
499 std::string previous_locale = | 501 std::string previous_locale = |
500 profile_->GetPrefs()->GetString(prefs::kHotwordPreviousLanguage); | 502 profile_->GetPrefs()->GetString(prefs::kHotwordPreviousLanguage); |
501 std::string locale = GetCurrentLocale(profile_); | 503 std::string locale = GetCurrentLocale(profile_); |
502 | 504 |
503 // If it's a new locale, then the old extension should be uninstalled. | 505 // If it's a new locale, then the old extension should be uninstalled. |
504 return locale != previous_locale && | 506 return locale != previous_locale && |
505 HotwordService::DoesHotwordSupportLanguage(profile_); | 507 HotwordService::DoesHotwordSupportLanguage(profile_); |
506 } | 508 } |
OLD | NEW |