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 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
358 | 358 |
359 return UninstallHotwordExtension(extension_service); | 359 return UninstallHotwordExtension(extension_service); |
360 } | 360 } |
361 | 361 |
362 bool HotwordService::UninstallHotwordExtension( | 362 bool HotwordService::UninstallHotwordExtension( |
363 ExtensionService* extension_service) { | 363 ExtensionService* extension_service) { |
364 base::string16 error; | 364 base::string16 error; |
365 if (!extension_service->UninstallExtension( | 365 if (!extension_service->UninstallExtension( |
366 extension_misc::kHotwordExtensionId, | 366 extension_misc::kHotwordExtensionId, |
367 extensions::UNINSTALL_REASON_INTERNAL_MANAGEMENT, | 367 extensions::UNINSTALL_REASON_INTERNAL_MANAGEMENT, |
| 368 base::Bind(&base::DoNothing), |
368 &error)) { | 369 &error)) { |
369 LOG(WARNING) << "Cannot uninstall extension with id " | 370 LOG(WARNING) << "Cannot uninstall extension with id " |
370 << extension_misc::kHotwordExtensionId | 371 << extension_misc::kHotwordExtensionId |
371 << ": " << error; | 372 << ": " << error; |
372 reinstall_pending_ = false; | 373 reinstall_pending_ = false; |
373 return false; | 374 return false; |
374 } | 375 } |
375 return true; | 376 return true; |
376 } | 377 } |
377 | 378 |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
502 return false; | 503 return false; |
503 | 504 |
504 std::string previous_locale = | 505 std::string previous_locale = |
505 profile_->GetPrefs()->GetString(prefs::kHotwordPreviousLanguage); | 506 profile_->GetPrefs()->GetString(prefs::kHotwordPreviousLanguage); |
506 std::string locale = GetCurrentLocale(profile_); | 507 std::string locale = GetCurrentLocale(profile_); |
507 | 508 |
508 // If it's a new locale, then the old extension should be uninstalled. | 509 // If it's a new locale, then the old extension should be uninstalled. |
509 return locale != previous_locale && | 510 return locale != previous_locale && |
510 HotwordService::DoesHotwordSupportLanguage(profile_); | 511 HotwordService::DoesHotwordSupportLanguage(profile_); |
511 } | 512 } |
OLD | NEW |