| 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" |
| 11 #include "base/prefs/pref_service.h" | 11 #include "base/prefs/pref_service.h" |
| 12 #include "chrome/browser/browser_process.h" | 12 #include "chrome/browser/browser_process.h" |
| 13 #include "chrome/browser/chrome_notification_types.h" | 13 #include "chrome/browser/chrome_notification_types.h" |
| 14 #include "chrome/browser/extensions/api/hotword_private/hotword_private_api.h" | 14 #include "chrome/browser/extensions/api/hotword_private/hotword_private_api.h" |
| 15 #include "chrome/browser/extensions/extension_service.h" | 15 #include "chrome/browser/extensions/extension_service.h" |
| 16 #include "chrome/browser/extensions/pending_extension_manager.h" | 16 #include "chrome/browser/extensions/pending_extension_manager.h" |
| 17 #include "chrome/browser/extensions/updater/extension_updater.h" | 17 #include "chrome/browser/extensions/updater/extension_updater.h" |
| 18 #include "chrome/browser/extensions/webstore_startup_installer.h" | 18 #include "chrome/browser/extensions/webstore_startup_installer.h" |
| 19 #include "chrome/browser/plugins/plugin_prefs.h" | 19 #include "chrome/browser/plugins/plugin_prefs.h" |
| 20 #include "chrome/browser/profiles/profile.h" | 20 #include "chrome/browser/profiles/profile.h" |
| 21 #include "chrome/browser/search/hotword_service_factory.h" | 21 #include "chrome/browser/search/hotword_service_factory.h" |
| 22 #include "chrome/common/chrome_paths.h" | 22 #include "chrome/common/chrome_paths.h" |
| 23 #include "chrome/common/extensions/extension_constants.h" | 23 #include "chrome/common/extensions/extension_constants.h" |
| 24 #include "chrome/common/pref_names.h" | 24 #include "chrome/common/pref_names.h" |
| 25 #include "chrome/grit/generated_resources.h" |
| 25 #include "content/public/browser/browser_thread.h" | 26 #include "content/public/browser/browser_thread.h" |
| 26 #include "content/public/browser/notification_service.h" | 27 #include "content/public/browser/notification_service.h" |
| 27 #include "content/public/browser/plugin_service.h" | 28 #include "content/public/browser/plugin_service.h" |
| 28 #include "content/public/common/webplugininfo.h" | 29 #include "content/public/common/webplugininfo.h" |
| 29 #include "extensions/browser/extension_system.h" | 30 #include "extensions/browser/extension_system.h" |
| 30 #include "extensions/browser/uninstall_reason.h" | 31 #include "extensions/browser/uninstall_reason.h" |
| 31 #include "extensions/common/extension.h" | 32 #include "extensions/common/extension.h" |
| 32 #include "extensions/common/one_shot_event.h" | 33 #include "extensions/common/one_shot_event.h" |
| 33 #include "grit/generated_resources.h" | |
| 34 #include "ui/base/l10n/l10n_util.h" | 34 #include "ui/base/l10n/l10n_util.h" |
| 35 | 35 |
| 36 using extensions::BrowserContextKeyedAPIFactory; | 36 using extensions::BrowserContextKeyedAPIFactory; |
| 37 using extensions::HotwordPrivateEventService; | 37 using extensions::HotwordPrivateEventService; |
| 38 | 38 |
| 39 namespace { | 39 namespace { |
| 40 | 40 |
| 41 // Allowed languages for hotwording. | 41 // Allowed languages for hotwording. |
| 42 static const char* kSupportedLocales[] = { | 42 static const char* kSupportedLocales[] = { |
| 43 "en", | 43 "en", |
| (...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 483 return false; | 483 return false; |
| 484 | 484 |
| 485 std::string previous_locale = | 485 std::string previous_locale = |
| 486 profile_->GetPrefs()->GetString(prefs::kHotwordPreviousLanguage); | 486 profile_->GetPrefs()->GetString(prefs::kHotwordPreviousLanguage); |
| 487 std::string locale = GetCurrentLocale(profile_); | 487 std::string locale = GetCurrentLocale(profile_); |
| 488 | 488 |
| 489 // If it's a new locale, then the old extension should be uninstalled. | 489 // If it's a new locale, then the old extension should be uninstalled. |
| 490 return locale != previous_locale && | 490 return locale != previous_locale && |
| 491 HotwordService::DoesHotwordSupportLanguage(profile_); | 491 HotwordService::DoesHotwordSupportLanguage(profile_); |
| 492 } | 492 } |
| OLD | NEW |