Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(437)

Side by Side Diff: chrome/browser/extensions/api/hotword_private/hotword_private_api.cc

Issue 715773002: Hotword Private API: Add support for retrieving localized strings. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 const char kHotwordEventServiceUnavailable[] = 24 const char kHotwordEventServiceUnavailable[] =
23 "Hotword Private Event Service is unavailable."; 25 "Hotword Private Event Service is unavailable.";
24 } // hotword_private_constants 26 } // hotword_private_constants
25 27
26 namespace OnEnabledChanged = 28 namespace OnEnabledChanged =
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 HotwordServiceFactory::GetForProfile(GetProfile()); 253 HotwordServiceFactory::GetForProfile(GetProfile());
252 if (!hotword_service) { 254 if (!hotword_service) {
253 error_ = hotword_private_constants::kHotwordServiceUnavailable; 255 error_ = hotword_private_constants::kHotwordServiceUnavailable;
254 return false; 256 return false;
255 } 257 }
256 258
257 hotword_service->StopTraining(); 259 hotword_service->StopTraining();
258 return true; 260 return true;
259 } 261 }
260 262
263 bool HotwordPrivateGetLocalizedStringsFunction::RunSync() {
264 base::DictionaryValue* localized_strings = new base::DictionaryValue();
265
266 localized_strings->SetString(
267 "cancel",
268 l10n_util::GetStringUTF16(IDS_HOTWORD_OPT_IN_CANCEL));
269 localized_strings->SetString(
270 "introTitle",
271 l10n_util::GetStringUTF16(IDS_HOTWORD_OPT_IN_INTRO_TITLE));
272 localized_strings->SetString(
273 "introSubtitle",
274 l10n_util::GetStringUTF16(IDS_HOTWORD_OPT_IN_INTRO_SUBTITLE));
275 localized_strings->SetString(
276 "introDescription",
277 l10n_util::GetStringUTF16(IDS_HOTWORD_OPT_IN_INTRO_DESCRIPTION));
278 localized_strings->SetString(
279 "introDescriptionAudioHistoryEnabled",
280 l10n_util::GetStringUTF16(
281 IDS_HOTWORD_OPT_IN_INTRO_DESCRIPTION_AUDIO_HISTORY_ENABLED));
282 localized_strings->SetString(
283 "introStart",
284 l10n_util::GetStringUTF16(IDS_HOTWORD_OPT_IN_INTRO_START));
285 localized_strings->SetString(
286 "audioHistoryTitle",
287 l10n_util::GetStringUTF16(IDS_HOTWORD_OPT_IN_AUDIO_HISTORY_TITLE));
288 localized_strings->SetString(
289 "audioHistoryDescription",
290 l10n_util::GetStringUTF16(IDS_HOTWORD_OPT_IN_AUDIO_HISTORY_DESCRIPTION));
291 localized_strings->SetString(
292 "audioHistoryLearnMore",
293 l10n_util::GetStringUTF16(IDS_HOTWORD_OPT_IN_AUDIO_HISTORY_LEARN_MORE));
294 localized_strings->SetString(
295 "audioHistoryDecline",
296 l10n_util::GetStringUTF16(IDS_HOTWORD_OPT_IN_AUDIO_HISTORY_DECLINE));
297 localized_strings->SetString(
298 "audioHistoryAgree",
299 l10n_util::GetStringUTF16(IDS_HOTWORD_OPT_IN_AUDIO_HISTORY_AGREE));
300 localized_strings->SetString(
301 "trainingTitle",
302 l10n_util::GetStringUTF16(IDS_HOTWORD_OPT_IN_TRAINING_TITLE));
303 localized_strings->SetString(
304 "trainingDescription",
305 l10n_util::GetStringUTF16(IDS_HOTWORD_OPT_IN_TRAINING_DESCRIPTION));
306 localized_strings->SetString(
307 "trainingSpeak",
308 l10n_util::GetStringUTF16(IDS_HOTWORD_OPT_IN_TRAINING_SPEAK));
309 localized_strings->SetString(
310 "trainingFirstPrompt",
311 l10n_util::GetStringUTF16(IDS_HOTWORD_OPT_IN_TRAINING_FIRST_PROMPT));
312 localized_strings->SetString(
313 "trainingMiddlePrompt",
314 l10n_util::GetStringUTF16(IDS_HOTWORD_OPT_IN_TRAINING_MIDDLE_PROMPT));
315 localized_strings->SetString(
316 "trainingLastPrompt",
317 l10n_util::GetStringUTF16(IDS_HOTWORD_OPT_IN_TRAINING_LAST_PROMPT));
318 localized_strings->SetString(
319 "trainingRecorded",
320 l10n_util::GetStringUTF16(IDS_HOTWORD_OPT_IN_TRAINING_RECORDED));
321 localized_strings->SetString(
322 "trainingTimeout",
323 l10n_util::GetStringUTF16(IDS_HOTWORD_OPT_IN_TRAINING_TIMEOUT));
324 localized_strings->SetString(
325 "trainingRetry",
326 l10n_util::GetStringUTF16(IDS_HOTWORD_OPT_IN_TRAINING_RETRY));
327 localized_strings->SetString(
328 "finishedTitle",
329 l10n_util::GetStringUTF16(IDS_HOTWORD_OPT_IN_FINISHED_TITLE));
330 localized_strings->SetString(
331 "finishedListIntro",
332 l10n_util::GetStringUTF16(IDS_HOTWORD_OPT_IN_FINISHED_LIST_INTRO));
333 localized_strings->SetString(
334 "finishedListItem1",
335 l10n_util::GetStringUTF16(IDS_HOTWORD_OPT_IN_FINISHED_LIST_ITEM_1));
336 localized_strings->SetString(
337 "finishedListItem2",
338 l10n_util::GetStringUTF16(IDS_HOTWORD_OPT_IN_FINISHED_LIST_ITEM_2));
339 localized_strings->SetString(
340 "finishedSettings",
341 l10n_util::GetStringUTF16(IDS_HOTWORD_OPT_IN_FINISHED_SETTINGS));
342 localized_strings->SetString(
343 "finishedAudioHistory",
344 l10n_util::GetStringUTF16(
345 IDS_HOTWORD_OPT_IN_FINISHED_AUDIO_HISTORY));
346 localized_strings->SetString(
347 "finish",
348 l10n_util::GetStringUTF16(IDS_HOTWORD_OPT_IN_FINISH));
349 localized_strings->SetString(
350 "finishedWait",
351 l10n_util::GetStringUTF16(IDS_HOTWORD_OPT_IN_FINISHED_WAIT));
352
353 SetResult(localized_strings);
354 return true;
355 }
356
261 } // namespace extensions 357 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/hotword_private/hotword_private_api.h ('k') | chrome/common/extensions/api/hotword_private.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698