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

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

Issue 880313002: webui: add [lang] attribute to <html> element on all webui pages so (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: cros Created 5 years, 10 months 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 <string> 7 #include <string>
8 8
9 #include "base/i18n/rtl.h"
10 #include "base/lazy_instance.h" 9 #include "base/lazy_instance.h"
11 #include "base/prefs/pref_service.h" 10 #include "base/prefs/pref_service.h"
11 #include "chrome/browser/browser_process.h"
12 #include "chrome/browser/profiles/profile.h" 12 #include "chrome/browser/profiles/profile.h"
13 #include "chrome/browser/search/hotword_audio_history_handler.h" 13 #include "chrome/browser/search/hotword_audio_history_handler.h"
14 #include "chrome/browser/search/hotword_client.h" 14 #include "chrome/browser/search/hotword_client.h"
15 #include "chrome/browser/search/hotword_service.h" 15 #include "chrome/browser/search/hotword_service.h"
16 #include "chrome/browser/search/hotword_service_factory.h" 16 #include "chrome/browser/search/hotword_service_factory.h"
17 #include "chrome/browser/ui/app_list/app_list_service.h" 17 #include "chrome/browser/ui/app_list/app_list_service.h"
18 #include "chrome/browser/ui/browser.h" 18 #include "chrome/browser/ui/browser.h"
19 #include "chrome/common/pref_names.h" 19 #include "chrome/common/pref_names.h"
20 #include "chrome/grit/generated_resources.h" 20 #include "chrome/grit/generated_resources.h"
21 #include "content/public/browser/speech_recognition_session_preamble.h" 21 #include "content/public/browser/speech_recognition_session_preamble.h"
22 #include "extensions/browser/event_router.h" 22 #include "extensions/browser/event_router.h"
23 #include "ui/base/l10n/l10n_util.h" 23 #include "ui/base/l10n/l10n_util.h"
24 #include "ui/base/webui/web_ui_util.h"
24 25
25 namespace extensions { 26 namespace extensions {
26 27
27 namespace hotword_private_constants { 28 namespace hotword_private_constants {
28 const char kHotwordServiceUnavailable[] = "Hotword Service is unavailable."; 29 const char kHotwordServiceUnavailable[] = "Hotword Service is unavailable.";
29 const char kHotwordEventServiceUnavailable[] = 30 const char kHotwordEventServiceUnavailable[] =
30 "Hotword Private Event Service is unavailable."; 31 "Hotword Private Event Service is unavailable.";
31 } // hotword_private_constants 32 } // hotword_private_constants
32 33
33 namespace OnEnabledChanged = 34 namespace OnEnabledChanged =
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 "finishedAudioHistory", 383 "finishedAudioHistory",
383 l10n_util::GetStringUTF16( 384 l10n_util::GetStringUTF16(
384 IDS_HOTWORD_OPT_IN_FINISHED_AUDIO_HISTORY)); 385 IDS_HOTWORD_OPT_IN_FINISHED_AUDIO_HISTORY));
385 localized_strings->SetString( 386 localized_strings->SetString(
386 "finish", 387 "finish",
387 l10n_util::GetStringUTF16(IDS_HOTWORD_OPT_IN_FINISH)); 388 l10n_util::GetStringUTF16(IDS_HOTWORD_OPT_IN_FINISH));
388 localized_strings->SetString( 389 localized_strings->SetString(
389 "finishedWait", 390 "finishedWait",
390 l10n_util::GetStringUTF16(IDS_HOTWORD_OPT_IN_FINISHED_WAIT)); 391 l10n_util::GetStringUTF16(IDS_HOTWORD_OPT_IN_FINISHED_WAIT));
391 392
392 localized_strings->SetString("textdirection", 393 const std::string& app_locale = g_browser_process->GetApplicationLocale();
393 base::i18n::IsRTL() ? "rtl" : "ltr"); 394 webui::SetLoadTimeDataDefaults(app_locale, localized_strings);
394 395
395 SetResult(localized_strings); 396 SetResult(localized_strings);
396 return true; 397 return true;
397 } 398 }
398 399
399 bool HotwordPrivateSetAudioHistoryEnabledFunction::RunAsync() { 400 bool HotwordPrivateSetAudioHistoryEnabledFunction::RunAsync() {
400 scoped_ptr<api::hotword_private::SetAudioHistoryEnabled::Params> params( 401 scoped_ptr<api::hotword_private::SetAudioHistoryEnabled::Params> params(
401 api::hotword_private::SetAudioHistoryEnabled::Params::Create(*args_)); 402 api::hotword_private::SetAudioHistoryEnabled::Params::Create(*args_));
402 EXTENSION_FUNCTION_VALIDATE(params.get()); 403 EXTENSION_FUNCTION_VALIDATE(params.get());
403 404
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 void HotwordPrivateGetAudioHistoryEnabledFunction::SetResultAndSendResponse( 444 void HotwordPrivateGetAudioHistoryEnabledFunction::SetResultAndSendResponse(
444 bool success, bool new_enabled_value) { 445 bool success, bool new_enabled_value) {
445 api::hotword_private::AudioHistoryState result; 446 api::hotword_private::AudioHistoryState result;
446 result.success = success; 447 result.success = success;
447 result.enabled = new_enabled_value; 448 result.enabled = new_enabled_value;
448 SetResult(result.ToValue().release()); 449 SetResult(result.ToValue().release());
449 SendResponse(true); 450 SendResponse(true);
450 } 451 }
451 452
452 } // namespace extensions 453 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698