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 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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, | 363 extension_misc::kHotwordExtensionId, |
364 ExtensionService::UNINSTALL_REASON_INTERNAL_MANAGEMENT, | 364 extensions::UninstalledExtensionInfo::REASON_INTERNAL_MANAGEMENT, |
365 &error)) { | 365 &error)) { |
366 LOG(WARNING) << "Cannot uninstall extension with id " | 366 LOG(WARNING) << "Cannot uninstall extension with id " |
367 << extension_misc::kHotwordExtensionId | 367 << extension_misc::kHotwordExtensionId |
368 << ": " << error; | 368 << ": " << error; |
369 reinstall_pending_ = false; | 369 reinstall_pending_ = false; |
370 return false; | 370 return false; |
371 } | 371 } |
372 return true; | 372 return true; |
373 } | 373 } |
374 | 374 |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
499 return false; | 499 return false; |
500 | 500 |
501 std::string previous_locale = | 501 std::string previous_locale = |
502 profile_->GetPrefs()->GetString(prefs::kHotwordPreviousLanguage); | 502 profile_->GetPrefs()->GetString(prefs::kHotwordPreviousLanguage); |
503 std::string locale = GetCurrentLocale(profile_); | 503 std::string locale = GetCurrentLocale(profile_); |
504 | 504 |
505 // 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. |
506 return locale != previous_locale && | 506 return locale != previous_locale && |
507 HotwordService::DoesHotwordSupportLanguage(profile_); | 507 HotwordService::DoesHotwordSupportLanguage(profile_); |
508 } | 508 } |
OLD | NEW |