| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_screen_handler.h" | 5 #include "chrome/browser/ui/webui/chromeos/login/base_screen_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" |
| 11 #include "chrome/browser/chromeos/login/ui/login_display_host.h" | 11 #include "chrome/browser/chromeos/login/ui/login_display_host.h" |
| 12 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" | 12 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" |
| 13 #include "components/login/localized_values_builder.h" | 13 #include "components/login/localized_values_builder.h" |
| 14 #include "content/public/browser/web_ui.h" | 14 #include "content/public/browser/web_ui.h" |
| 15 | 15 |
| 16 namespace chromeos { | 16 namespace chromeos { |
| 17 | 17 |
| 18 namespace { | 18 namespace { |
| 19 const char kMethodContextChanged[] = "contextChanged"; | 19 const char kMethodContextChanged[] = "contextChanged"; |
| 20 } // namespace | 20 } // namespace |
| 21 | 21 |
| 22 JSCallsContainer::JSCallsContainer() = default; |
| 23 |
| 24 JSCallsContainer::~JSCallsContainer() = default; |
| 25 |
| 22 BaseScreenHandler::BaseScreenHandler() = default; | 26 BaseScreenHandler::BaseScreenHandler() = default; |
| 23 | 27 |
| 28 BaseScreenHandler::BaseScreenHandler(JSCallsContainer* js_calls_container) |
| 29 : js_calls_container_(js_calls_container) {} |
| 30 |
| 24 BaseScreenHandler::~BaseScreenHandler() { | 31 BaseScreenHandler::~BaseScreenHandler() { |
| 25 if (base_screen_) | 32 if (base_screen_) |
| 26 base_screen_->set_model_view_channel(nullptr); | 33 base_screen_->set_model_view_channel(nullptr); |
| 27 } | 34 } |
| 28 | 35 |
| 29 void BaseScreenHandler::InitializeBase() { | 36 void BaseScreenHandler::InitializeBase() { |
| 30 page_is_ready_ = true; | 37 page_is_ready_ = true; |
| 31 Initialize(); | 38 Initialize(); |
| 32 if (!pending_context_changes_.empty()) { | 39 if (!pending_context_changes_.empty()) { |
| 33 CommitContextChanges(pending_context_changes_); | 40 CommitContextChanges(pending_context_changes_); |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 if (base_screen_) | 121 if (base_screen_) |
| 115 base_screen_->OnUserAction(action_id); | 122 base_screen_->OnUserAction(action_id); |
| 116 } | 123 } |
| 117 | 124 |
| 118 void BaseScreenHandler::HandleContextChanged( | 125 void BaseScreenHandler::HandleContextChanged( |
| 119 const base::DictionaryValue* diff) { | 126 const base::DictionaryValue* diff) { |
| 120 if (diff && base_screen_) | 127 if (diff && base_screen_) |
| 121 base_screen_->OnContextChanged(*diff); | 128 base_screen_->OnContextChanged(*diff); |
| 122 } | 129 } |
| 123 | 130 |
| 131 void BaseScreenHandler::ExecuteDeferredJSCalls() { |
| 132 DCHECK(!js_calls_container_->is_initialized()); |
| 133 js_calls_container_->mark_initialized(); |
| 134 for (const auto& deferred_js_call : js_calls_container_->deferred_js_calls()) |
| 135 deferred_js_call.Run(); |
| 136 js_calls_container_->deferred_js_calls().clear(); |
| 137 } |
| 138 |
| 124 } // namespace chromeos | 139 } // namespace chromeos |
| OLD | NEW |