OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/extensions/api/hotword_private/hotword_private_api.h" | 5 #include "chrome/browser/extensions/api/hotword_private/hotword_private_api.h" |
6 | 6 |
7 #include "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
10 #include "chrome/browser/search/hotword_client.h" | 10 #include "chrome/browser/search/hotword_client.h" |
11 #include "chrome/browser/search/hotword_service.h" | 11 #include "chrome/browser/search/hotword_service.h" |
12 #include "chrome/browser/search/hotword_service_factory.h" | 12 #include "chrome/browser/search/hotword_service_factory.h" |
13 #include "chrome/browser/ui/app_list/app_list_service.h" | 13 #include "chrome/browser/ui/app_list/app_list_service.h" |
14 #include "chrome/browser/ui/browser.h" | 14 #include "chrome/browser/ui/browser.h" |
15 #include "chrome/common/pref_names.h" | 15 #include "chrome/common/pref_names.h" |
| 16 #include "chrome/grit/generated_resources.h" |
16 #include "extensions/browser/event_router.h" | 17 #include "extensions/browser/event_router.h" |
| 18 #include "ui/base/l10n/l10n_util.h" |
17 | 19 |
18 namespace extensions { | 20 namespace extensions { |
19 | 21 |
20 namespace hotword_private_constants { | 22 namespace hotword_private_constants { |
21 const char kHotwordServiceUnavailable[] = "Hotword Service is unavailable."; | 23 const char kHotwordServiceUnavailable[] = "Hotword Service is unavailable."; |
22 } // hotword_private_constants | 24 } // hotword_private_constants |
23 | 25 |
24 namespace OnEnabledChanged = | 26 namespace OnEnabledChanged = |
25 api::hotword_private::OnEnabledChanged; | 27 api::hotword_private::OnEnabledChanged; |
26 | 28 |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 HotwordServiceFactory::GetForProfile(GetProfile()); | 234 HotwordServiceFactory::GetForProfile(GetProfile()); |
233 if (!hotword_service) { | 235 if (!hotword_service) { |
234 error_ = hotword_private_constants::kHotwordServiceUnavailable; | 236 error_ = hotword_private_constants::kHotwordServiceUnavailable; |
235 return false; | 237 return false; |
236 } | 238 } |
237 | 239 |
238 hotword_service->StopTraining(); | 240 hotword_service->StopTraining(); |
239 return true; | 241 return true; |
240 } | 242 } |
241 | 243 |
| 244 bool HotwordPrivateGetLocalizedStringsFunction::RunSync() { |
| 245 base::DictionaryValue* localized_strings = new base::DictionaryValue(); |
| 246 |
| 247 localized_strings->SetString( |
| 248 "cancel", |
| 249 l10n_util::GetStringUTF16(IDS_HOTWORD_OPT_IN_CANCEL)); |
| 250 localized_strings->SetString( |
| 251 "introTitle", |
| 252 l10n_util::GetStringUTF16(IDS_HOTWORD_OPT_IN_INTRO_TITLE)); |
| 253 localized_strings->SetString( |
| 254 "introSubtitle", |
| 255 l10n_util::GetStringUTF16(IDS_HOTWORD_OPT_IN_INTRO_SUBTITLE)); |
| 256 localized_strings->SetString( |
| 257 "introDescription", |
| 258 l10n_util::GetStringUTF16(IDS_HOTWORD_OPT_IN_INTRO_DESCRIPTION)); |
| 259 localized_strings->SetString( |
| 260 "introDescriptionAudioHistoryEnabled", |
| 261 l10n_util::GetStringUTF16( |
| 262 IDS_HOTWORD_OPT_IN_INTRO_DESCRIPTION_AUDIO_HISTORY_ENABLED)); |
| 263 localized_strings->SetString( |
| 264 "introStart", |
| 265 l10n_util::GetStringUTF16(IDS_HOTWORD_OPT_IN_INTRO_START)); |
| 266 localized_strings->SetString( |
| 267 "trainingTitle", |
| 268 l10n_util::GetStringUTF16(IDS_HOTWORD_OPT_IN_TRAINING_TITLE)); |
| 269 localized_strings->SetString( |
| 270 "trainingDescription", |
| 271 l10n_util::GetStringUTF16(IDS_HOTWORD_OPT_IN_TRAINING_DESCRIPTION)); |
| 272 localized_strings->SetString( |
| 273 "trainingSpeak", |
| 274 l10n_util::GetStringUTF16(IDS_HOTWORD_OPT_IN_TRAINING_SPEAK)); |
| 275 localized_strings->SetString( |
| 276 "trainingFirstPrompt", |
| 277 l10n_util::GetStringUTF16(IDS_HOTWORD_OPT_IN_TRAINING_FIRST_PROMPT)); |
| 278 localized_strings->SetString( |
| 279 "trainingMiddlePrompt", |
| 280 l10n_util::GetStringUTF16(IDS_HOTWORD_OPT_IN_TRAINING_MIDDLE_PROMPT)); |
| 281 localized_strings->SetString( |
| 282 "trainingLastPrompt", |
| 283 l10n_util::GetStringUTF16(IDS_HOTWORD_OPT_IN_TRAINING_LAST_PROMPT)); |
| 284 localized_strings->SetString( |
| 285 "trainingRecorded", |
| 286 l10n_util::GetStringUTF16(IDS_HOTWORD_OPT_IN_TRAINING_RECORDED)); |
| 287 localized_strings->SetString( |
| 288 "trainingTimeout", |
| 289 l10n_util::GetStringUTF16(IDS_HOTWORD_OPT_IN_TRAINING_TIMEOUT)); |
| 290 localized_strings->SetString( |
| 291 "trainingRetry", |
| 292 l10n_util::GetStringUTF16(IDS_HOTWORD_OPT_IN_TRAINING_RETRY)); |
| 293 localized_strings->SetString( |
| 294 "finishedTitle", |
| 295 l10n_util::GetStringUTF16(IDS_HOTWORD_OPT_IN_FINISHED_TITLE)); |
| 296 localized_strings->SetString( |
| 297 "finishedListIntro", |
| 298 l10n_util::GetStringUTF16(IDS_HOTWORD_OPT_IN_FINISHED_LIST_INTRO)); |
| 299 localized_strings->SetString( |
| 300 "finishedListItem1", |
| 301 l10n_util::GetStringUTF16(IDS_HOTWORD_OPT_IN_FINISHED_LIST_ITEM_1)); |
| 302 localized_strings->SetString( |
| 303 "finishedListItem2", |
| 304 l10n_util::GetStringUTF16(IDS_HOTWORD_OPT_IN_FINISHED_LIST_ITEM_2)); |
| 305 localized_strings->SetString( |
| 306 "finishedSettings", |
| 307 l10n_util::GetStringUTF16(IDS_HOTWORD_OPT_IN_FINISHED_SETTINGS)); |
| 308 localized_strings->SetString( |
| 309 "finishedAudioHistory", |
| 310 l10n_util::GetStringUTF16( |
| 311 IDS_HOTWORD_OPT_IN_FINISHED_AUDIO_HISTORY)); |
| 312 localized_strings->SetString( |
| 313 "finish", |
| 314 l10n_util::GetStringUTF16(IDS_HOTWORD_OPT_IN_FINISH)); |
| 315 localized_strings->SetString( |
| 316 "finishedWait", |
| 317 l10n_util::GetStringUTF16(IDS_HOTWORD_OPT_IN_FINISHED_WAIT)); |
| 318 |
| 319 SetResult(localized_strings); |
| 320 return true; |
| 321 } |
| 322 |
242 } // namespace extensions | 323 } // namespace extensions |
OLD | NEW |