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