OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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/base_webui_handler.h" | 5 #include "chrome/browser/ui/webui/chromeos/login/base_webui_handler.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
9 #include "base/values.h" | 9 #include "base/values.h" |
10 #include "chrome/browser/chromeos/login/screens/base_screen.h" | 10 #include "chrome/browser/chromeos/login/screens/base_screen.h" |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 ShowScreenWithData(screen, nullptr); | 72 ShowScreenWithData(screen, nullptr); |
73 } | 73 } |
74 | 74 |
75 void BaseWebUIHandler::ShowScreenWithData(OobeScreen screen, | 75 void BaseWebUIHandler::ShowScreenWithData(OobeScreen screen, |
76 const base::DictionaryValue* data) { | 76 const base::DictionaryValue* data) { |
77 if (!web_ui()) | 77 if (!web_ui()) |
78 return; | 78 return; |
79 base::DictionaryValue screen_params; | 79 base::DictionaryValue screen_params; |
80 screen_params.SetString("id", GetOobeScreenName(screen)); | 80 screen_params.SetString("id", GetOobeScreenName(screen)); |
81 if (data) | 81 if (data) |
82 screen_params.SetWithoutPathExpansion("data", data->DeepCopy()); | 82 screen_params.SetWithoutPathExpansion("data", data->CreateDeepCopy()); |
83 web_ui()->CallJavascriptFunctionUnsafe("cr.ui.Oobe.showScreen", | 83 web_ui()->CallJavascriptFunctionUnsafe("cr.ui.Oobe.showScreen", |
84 screen_params); | 84 screen_params); |
85 } | 85 } |
86 | 86 |
87 OobeUI* BaseWebUIHandler::GetOobeUI() const { | 87 OobeUI* BaseWebUIHandler::GetOobeUI() const { |
88 return static_cast<OobeUI*>(web_ui()->GetController()); | 88 return static_cast<OobeUI*>(web_ui()->GetController()); |
89 } | 89 } |
90 | 90 |
91 OobeScreen BaseWebUIHandler::GetCurrentScreen() const { | 91 OobeScreen BaseWebUIHandler::GetCurrentScreen() const { |
92 OobeUI* oobe_ui = GetOobeUI(); | 92 OobeUI* oobe_ui = GetOobeUI(); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 | 126 |
127 void BaseWebUIHandler::ExecuteDeferredJSCalls() { | 127 void BaseWebUIHandler::ExecuteDeferredJSCalls() { |
128 DCHECK(!js_calls_container_->is_initialized()); | 128 DCHECK(!js_calls_container_->is_initialized()); |
129 js_calls_container_->mark_initialized(); | 129 js_calls_container_->mark_initialized(); |
130 for (const auto& deferred_js_call : js_calls_container_->deferred_js_calls()) | 130 for (const auto& deferred_js_call : js_calls_container_->deferred_js_calls()) |
131 deferred_js_call.Run(); | 131 deferred_js_call.Run(); |
132 js_calls_container_->deferred_js_calls().clear(); | 132 js_calls_container_->deferred_js_calls().clear(); |
133 } | 133 } |
134 | 134 |
135 } // namespace chromeos | 135 } // namespace chromeos |
OLD | NEW |