| 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/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
| 9 #include "chrome/browser/chromeos/login/oobe_screen.h" | 9 #include "chrome/browser/chromeos/login/oobe_screen.h" |
| 10 #include "chrome/grit/generated_resources.h" | 10 #include "chrome/grit/generated_resources.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 const char kCallbackUserActed[] = "userActed"; | 23 const char kCallbackUserActed[] = "userActed"; |
| 24 const char kCallbackContextChanged[] = "contextChanged"; | 24 const char kCallbackContextChanged[] = "contextChanged"; |
| 25 | 25 |
| 26 bool IsBootstrappingMaster() { | 26 bool IsBootstrappingMaster() { |
| 27 return base::CommandLine::ForCurrentProcess()->HasSwitch( | 27 return base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 28 chromeos::switches::kOobeBootstrappingMaster); | 28 chromeos::switches::kOobeBootstrappingMaster); |
| 29 } | 29 } |
| 30 | 30 |
| 31 } // namespace | 31 } // namespace |
| 32 | 32 |
| 33 ControllerPairingScreenHandler::ControllerPairingScreenHandler() { | 33 ControllerPairingScreenHandler::ControllerPairingScreenHandler() |
| 34 : BaseScreenHandler(kScreenId) { |
| 34 set_call_js_prefix(kJsScreenPath); | 35 set_call_js_prefix(kJsScreenPath); |
| 35 } | 36 } |
| 36 | 37 |
| 37 ControllerPairingScreenHandler::~ControllerPairingScreenHandler() { | 38 ControllerPairingScreenHandler::~ControllerPairingScreenHandler() { |
| 38 if (delegate_) | 39 if (delegate_) |
| 39 delegate_->OnViewDestroyed(this); | 40 delegate_->OnViewDestroyed(this); |
| 40 } | 41 } |
| 41 | 42 |
| 42 void ControllerPairingScreenHandler::HandleUserActed( | 43 void ControllerPairingScreenHandler::HandleUserActed( |
| 43 const std::string& action) { | 44 const std::string& action) { |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 &ControllerPairingScreenHandler::HandleUserActed); | 144 &ControllerPairingScreenHandler::HandleUserActed); |
| 144 AddPrefixedCallback(kCallbackContextChanged, | 145 AddPrefixedCallback(kCallbackContextChanged, |
| 145 &ControllerPairingScreenHandler::HandleContextChanged); | 146 &ControllerPairingScreenHandler::HandleContextChanged); |
| 146 } | 147 } |
| 147 | 148 |
| 148 void ControllerPairingScreenHandler::Show() { | 149 void ControllerPairingScreenHandler::Show() { |
| 149 if (!page_is_ready()) { | 150 if (!page_is_ready()) { |
| 150 show_on_init_ = true; | 151 show_on_init_ = true; |
| 151 return; | 152 return; |
| 152 } | 153 } |
| 153 ShowScreen(OobeScreen::SCREEN_OOBE_CONTROLLER_PAIRING); | 154 ShowScreen(kScreenId); |
| 154 } | 155 } |
| 155 | 156 |
| 156 void ControllerPairingScreenHandler::Hide() { | 157 void ControllerPairingScreenHandler::Hide() { |
| 157 } | 158 } |
| 158 | 159 |
| 159 void ControllerPairingScreenHandler::SetDelegate(Delegate* delegate) { | 160 void ControllerPairingScreenHandler::SetDelegate(Delegate* delegate) { |
| 160 delegate_ = delegate; | 161 delegate_ = delegate; |
| 161 if (page_is_ready()) | 162 if (page_is_ready()) |
| 162 Initialize(); | 163 Initialize(); |
| 163 } | 164 } |
| 164 | 165 |
| 165 void ControllerPairingScreenHandler::OnContextChanged( | 166 void ControllerPairingScreenHandler::OnContextChanged( |
| 166 const base::DictionaryValue& diff) { | 167 const base::DictionaryValue& diff) { |
| 167 CallJS(kMethodContextChanged, diff); | 168 CallJS(kMethodContextChanged, diff); |
| 168 } | 169 } |
| 169 | 170 |
| 170 content::BrowserContext* ControllerPairingScreenHandler::GetBrowserContext() { | 171 content::BrowserContext* ControllerPairingScreenHandler::GetBrowserContext() { |
| 171 return web_ui()->GetWebContents()->GetBrowserContext(); | 172 return web_ui()->GetWebContents()->GetBrowserContext(); |
| 172 } | 173 } |
| 173 | 174 |
| 174 } // namespace chromeos | 175 } // namespace chromeos |
| OLD | NEW |