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/error_screen_handler.h" | 5 #include "chrome/browser/ui/webui/chromeos/login/error_screen_handler.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "base/time.h" | 9 #include "base/time.h" |
10 #include "base/values.h" | |
11 #include "chrome/browser/chromeos/login/captive_portal_window_proxy.h" | 10 #include "chrome/browser/chromeos/login/captive_portal_window_proxy.h" |
12 #include "chrome/browser/chromeos/login/webui_login_display_host.h" | 11 #include "chrome/browser/chromeos/login/webui_login_display_host.h" |
13 #include "chrome/browser/chromeos/net/network_portal_detector.h" | 12 #include "chrome/browser/chromeos/net/network_portal_detector.h" |
14 #include "chrome/browser/ui/webui/chromeos/login/native_window_delegate.h" | 13 #include "chrome/browser/ui/webui/chromeos/login/native_window_delegate.h" |
15 #include "chrome/browser/ui/webui/chromeos/login/network_state_informer.h" | 14 #include "chrome/browser/ui/webui/chromeos/login/network_state_informer.h" |
16 #include "chrome/common/chrome_notification_types.h" | 15 #include "chrome/common/chrome_notification_types.h" |
17 #include "grit/generated_resources.h" | 16 #include "grit/generated_resources.h" |
18 | 17 |
19 namespace chromeos { | 18 namespace chromeos { |
20 | 19 |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 captive_portal_window_proxy_->Show(); | 80 captive_portal_window_proxy_->Show(); |
82 } | 81 } |
83 | 82 |
84 void ErrorScreenHandler::HideCaptivePortal() { | 83 void ErrorScreenHandler::HideCaptivePortal() { |
85 if (captive_portal_window_proxy_.get()) | 84 if (captive_portal_window_proxy_.get()) |
86 captive_portal_window_proxy_->Close(); | 85 captive_portal_window_proxy_->Close(); |
87 } | 86 } |
88 | 87 |
89 void ErrorScreenHandler::SetUIState(ErrorScreen::UIState ui_state) { | 88 void ErrorScreenHandler::SetUIState(ErrorScreen::UIState ui_state) { |
90 ui_state_ = ui_state; | 89 ui_state_ = ui_state; |
91 base::FundamentalValue ui_state_value(static_cast<int>(ui_state)); | 90 CallJS("login.ErrorMessageScreen.setUIState", static_cast<int>(ui_state_)); |
92 CallJS("login.ErrorMessageScreen.setUIState", ui_state_value); | |
93 } | 91 } |
94 | 92 |
95 void ErrorScreenHandler::SetErrorState(ErrorScreen::ErrorState error_state, | 93 void ErrorScreenHandler::SetErrorState(ErrorScreen::ErrorState error_state, |
96 const std::string& network) { | 94 const std::string& network) { |
97 error_state_ = error_state; | 95 error_state_ = error_state; |
98 base::FundamentalValue error_state_value(static_cast<int>(error_state)); | |
99 base::StringValue network_value(network); | |
100 CallJS("login.ErrorMessageScreen.setErrorState", | 96 CallJS("login.ErrorMessageScreen.setErrorState", |
101 error_state_value, | 97 static_cast<int>(error_state_), network); |
102 network_value); | |
103 } | 98 } |
104 | 99 |
105 void ErrorScreenHandler::AllowGuestSignin(bool allowed) { | 100 void ErrorScreenHandler::AllowGuestSignin(bool allowed) { |
106 base::FundamentalValue allowed_value(allowed); | 101 CallJS("login.ErrorMessageScreen.allowGuestSignin", allowed); |
107 CallJS("login.ErrorMessageScreen.allowGuestSignin", allowed_value); | |
108 } | 102 } |
109 | 103 |
110 void ErrorScreenHandler::AllowOfflineLogin(bool allowed) { | 104 void ErrorScreenHandler::AllowOfflineLogin(bool allowed) { |
111 base::FundamentalValue allowed_value(allowed); | 105 CallJS("login.ErrorMessageScreen.allowOfflineLogin", allowed); |
112 CallJS("login.ErrorMessageScreen.allowOfflineLogin", allowed_value); | |
113 } | 106 } |
114 | 107 |
115 void ErrorScreenHandler::NetworkErrorShown() { | 108 void ErrorScreenHandler::NetworkErrorShown() { |
116 content::NotificationService::current()->Notify( | 109 content::NotificationService::current()->Notify( |
117 chrome::NOTIFICATION_LOGIN_NETWORK_ERROR_SHOWN, | 110 chrome::NOTIFICATION_LOGIN_NETWORK_ERROR_SHOWN, |
118 content::NotificationService::AllSources(), | 111 content::NotificationService::AllSources(), |
119 content::NotificationService::NoDetails()); | 112 content::NotificationService::NoDetails()); |
120 } | 113 } |
121 | 114 |
122 bool ErrorScreenHandler::GetScreenName(OobeUI::Screen screen, | 115 bool ErrorScreenHandler::GetScreenName(OobeUI::Screen screen, |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 void ErrorScreenHandler::Initialize() { | 155 void ErrorScreenHandler::Initialize() { |
163 if (!page_is_ready()) | 156 if (!page_is_ready()) |
164 return; | 157 return; |
165 if (show_on_init_) { | 158 if (show_on_init_) { |
166 Show(parent_screen_, NULL); | 159 Show(parent_screen_, NULL); |
167 show_on_init_ = false; | 160 show_on_init_ = false; |
168 } | 161 } |
169 } | 162 } |
170 | 163 |
171 } // namespace chromeos | 164 } // namespace chromeos |
OLD | NEW |