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 <string> | 7 #include <string> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/i18n/case_conversion.h" | 10 #include "base/i18n/case_conversion.h" |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 // static | 205 // static |
206 bool HotwordService::IsExperimentalHotwordingEnabled() { | 206 bool HotwordService::IsExperimentalHotwordingEnabled() { |
207 std::string group = base::FieldTrialList::FindFullName( | 207 std::string group = base::FieldTrialList::FindFullName( |
208 hotword_internal::kHotwordFieldTrialName); | 208 hotword_internal::kHotwordFieldTrialName); |
209 if (!group.empty() && | 209 if (!group.empty() && |
210 group == hotword_internal::kHotwordFieldTrialExperimentalGroupName) { | 210 group == hotword_internal::kHotwordFieldTrialExperimentalGroupName) { |
211 return true; | 211 return true; |
212 } | 212 } |
213 | 213 |
214 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 214 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
215 return command_line->HasSwitch(switches::kEnableExperimentalHotwording); | 215 return !command_line->HasSwitch(switches::kDisableExperimentalHotwording); |
216 } | 216 } |
217 | 217 |
218 HotwordService::HotwordService(Profile* profile) | 218 HotwordService::HotwordService(Profile* profile) |
219 : profile_(profile), | 219 : profile_(profile), |
220 extension_registry_observer_(this), | 220 extension_registry_observer_(this), |
221 client_(NULL), | 221 client_(NULL), |
222 error_message_(0), | 222 error_message_(0), |
223 reinstall_pending_(false), | 223 reinstall_pending_(false), |
224 training_(false), | 224 training_(false), |
225 weak_factory_(this) { | 225 weak_factory_(this) { |
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
623 return false; | 623 return false; |
624 | 624 |
625 std::string previous_locale = | 625 std::string previous_locale = |
626 profile_->GetPrefs()->GetString(prefs::kHotwordPreviousLanguage); | 626 profile_->GetPrefs()->GetString(prefs::kHotwordPreviousLanguage); |
627 std::string locale = GetCurrentLocale(profile_); | 627 std::string locale = GetCurrentLocale(profile_); |
628 | 628 |
629 // If it's a new locale, then the old extension should be uninstalled. | 629 // If it's a new locale, then the old extension should be uninstalled. |
630 return locale != previous_locale && | 630 return locale != previous_locale && |
631 HotwordService::DoesHotwordSupportLanguage(profile_); | 631 HotwordService::DoesHotwordSupportLanguage(profile_); |
632 } | 632 } |
OLD | NEW |