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/ui/webui/chromeos/login/controller_pairing_screen_handl
er.h" | 5 #include "chrome/browser/ui/webui/chromeos/login/controller_pairing_screen_handl
er.h" |
6 | 6 |
7 #include "base/strings/string_util.h" | 7 #include "base/strings/string_util.h" |
8 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" | 8 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" |
| 9 #include "components/login/localized_values_builder.h" |
9 #include "content/public/browser/web_contents.h" | 10 #include "content/public/browser/web_contents.h" |
10 #include "grit/generated_resources.h" | 11 #include "grit/generated_resources.h" |
11 | 12 |
12 namespace chromeos { | 13 namespace chromeos { |
13 | 14 |
14 namespace { | 15 namespace { |
15 | 16 |
16 const char kJsScreenPath[] = "login.ControllerPairingScreen"; | 17 const char kJsScreenPath[] = "login.ControllerPairingScreen"; |
17 | 18 |
18 const char kMethodContextChanged[] = "contextChanged"; | 19 const char kMethodContextChanged[] = "contextChanged"; |
(...skipping 30 matching lines...) Expand all Loading... |
49 if (!page_is_ready() || !delegate_) | 50 if (!page_is_ready() || !delegate_) |
50 return; | 51 return; |
51 | 52 |
52 if (show_on_init_) { | 53 if (show_on_init_) { |
53 Show(); | 54 Show(); |
54 show_on_init_ = false; | 55 show_on_init_ = false; |
55 } | 56 } |
56 } | 57 } |
57 | 58 |
58 void ControllerPairingScreenHandler::DeclareLocalizedValues( | 59 void ControllerPairingScreenHandler::DeclareLocalizedValues( |
59 LocalizedValuesBuilder* builder) { | 60 ::login::LocalizedValuesBuilder* builder) { |
60 // TODO(dzhioev): Move the prefix logic to the base screen handler after | 61 // TODO(dzhioev): Move the prefix logic to the base screen handler after |
61 // migration. | 62 // migration. |
62 std::string prefix; | 63 std::string prefix; |
63 base::ReplaceChars(kJsScreenPath, ".", "_", &prefix); | 64 base::ReplaceChars(kJsScreenPath, ".", "_", &prefix); |
64 prefix += "_"; | 65 prefix += "_"; |
65 | 66 |
66 builder->Add(prefix + "welcomeTitle", IDS_PAIRING_CONTROLLER_WELCOME); | 67 builder->Add(prefix + "welcomeTitle", IDS_PAIRING_CONTROLLER_WELCOME); |
67 builder->Add(prefix + "searching", IDS_PAIRING_CONTROLLER_SEARCHING); | 68 builder->Add(prefix + "searching", IDS_PAIRING_CONTROLLER_SEARCHING); |
68 builder->Add(prefix + "helpBtn", IDS_PAIRING_NEED_HELP); | 69 builder->Add(prefix + "helpBtn", IDS_PAIRING_NEED_HELP); |
69 builder->Add(prefix + "troubleConnectingTitle", | 70 builder->Add(prefix + "troubleConnectingTitle", |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 void ControllerPairingScreenHandler::OnContextChanged( | 130 void ControllerPairingScreenHandler::OnContextChanged( |
130 const base::DictionaryValue& diff) { | 131 const base::DictionaryValue& diff) { |
131 CallJS(kMethodContextChanged, diff); | 132 CallJS(kMethodContextChanged, diff); |
132 } | 133 } |
133 | 134 |
134 content::BrowserContext* ControllerPairingScreenHandler::GetBrowserContext() { | 135 content::BrowserContext* ControllerPairingScreenHandler::GetBrowserContext() { |
135 return web_ui()->GetWebContents()->GetBrowserContext(); | 136 return web_ui()->GetWebContents()->GetBrowserContext(); |
136 } | 137 } |
137 | 138 |
138 } // namespace chromeos | 139 } // namespace chromeos |
OLD | NEW |