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/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "base/time/time.h" | 9 #include "base/time/time.h" |
10 #include "chrome/browser/chrome_notification_types.h" | 10 #include "chrome/browser/chrome_notification_types.h" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
46 DCHECK(network_state_informer_.get()); | 46 DCHECK(network_state_informer_.get()); |
47 } | 47 } |
48 | 48 |
49 ErrorScreenHandler::~ErrorScreenHandler() {} | 49 ErrorScreenHandler::~ErrorScreenHandler() {} |
50 | 50 |
51 void ErrorScreenHandler::SetDelegate(ErrorScreenActorDelegate* delegate) { | 51 void ErrorScreenHandler::SetDelegate(ErrorScreenActorDelegate* delegate) { |
52 delegate_ = delegate; | 52 delegate_ = delegate; |
53 } | 53 } |
54 | 54 |
55 void ErrorScreenHandler::Show(OobeDisplay::Screen parent_screen, | 55 void ErrorScreenHandler::Show(OobeDisplay::Screen parent_screen, |
56 base::DictionaryValue* params) { | 56 base::DictionaryValue* params, |
57 base::Closure closure) { | |
57 if (!page_is_ready()) { | 58 if (!page_is_ready()) { |
58 show_on_init_ = true; | 59 show_on_init_ = true; |
59 return; | 60 return; |
60 } | 61 } |
61 parent_screen_ = parent_screen; | 62 parent_screen_ = parent_screen; |
63 closure_.reset(new base::Closure(closure)); | |
62 ShowScreen(OobeUI::kScreenErrorMessage, params); | 64 ShowScreen(OobeUI::kScreenErrorMessage, params); |
63 NetworkErrorShown(); | 65 NetworkErrorShown(); |
64 NetworkPortalDetector::Get()->SetStrategy( | 66 NetworkPortalDetector::Get()->SetStrategy( |
65 PortalDetectorStrategy::STRATEGY_ID_ERROR_SCREEN); | 67 PortalDetectorStrategy::STRATEGY_ID_ERROR_SCREEN); |
66 if (delegate_) | 68 if (delegate_) |
67 delegate_->OnErrorShow(); | 69 delegate_->OnErrorShow(); |
68 LOG(WARNING) << "Offline message is displayed"; | 70 LOG(WARNING) << "Offline message is displayed"; |
69 } | 71 } |
70 | 72 |
73 void ErrorScreenHandler::CheckAndShowScreen() { | |
74 std::string screen_name; | |
75 if (GetScreenName(parent_screen(), &screen_name)) | |
76 ShowScreen(screen_name.c_str(), NULL); | |
77 } | |
78 | |
79 void ErrorScreenHandler::Show(OobeDisplay::Screen parent_screen, | |
80 base::DictionaryValue* params) { | |
81 Show(parent_screen, | |
82 params, | |
83 base::Bind(&ErrorScreenHandler::CheckAndShowScreen, | |
84 base::Unretained(this))); | |
85 } | |
86 | |
71 void ErrorScreenHandler::Hide() { | 87 void ErrorScreenHandler::Hide() { |
72 if (parent_screen_ == OobeUI::SCREEN_UNKNOWN) | 88 if (parent_screen_ == OobeUI::SCREEN_UNKNOWN) |
73 return; | 89 return; |
74 std::string screen_name; | 90 DCHECK(closure_.get()); |
ygorshenin1
2014/06/18 13:11:35
No need in DCHECK() as you're check closure_.get()
Roman Sorokin (ftl)
2014/06/19 11:57:38
Done.
| |
75 if (GetScreenName(parent_screen_, &screen_name)) | 91 if (closure_.get()) |
76 ShowScreen(screen_name.c_str(), NULL); | 92 closure_->Run(); |
77 NetworkPortalDetector::Get()->SetStrategy( | 93 NetworkPortalDetector::Get()->SetStrategy( |
78 PortalDetectorStrategy::STRATEGY_ID_LOGIN_SCREEN); | 94 PortalDetectorStrategy::STRATEGY_ID_LOGIN_SCREEN); |
79 if (delegate_) | 95 if (delegate_) |
80 delegate_->OnErrorHide(); | 96 delegate_->OnErrorHide(); |
81 LOG(WARNING) << "Offline message is hidden"; | 97 LOG(WARNING) << "Offline message is hidden"; |
82 } | 98 } |
83 | 99 |
84 void ErrorScreenHandler::FixCaptivePortal() { | 100 void ErrorScreenHandler::FixCaptivePortal() { |
85 if (!captive_portal_window_proxy_.get()) { | 101 if (!captive_portal_window_proxy_.get()) { |
86 content::WebContents* web_contents = | 102 content::WebContents* web_contents = |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
271 params.SetString("network", network_); | 287 params.SetString("network", network_); |
272 params.SetBoolean("guestSigninAllowed", guest_signin_allowed_); | 288 params.SetBoolean("guestSigninAllowed", guest_signin_allowed_); |
273 params.SetBoolean("offlineLoginAllowed", offline_login_allowed_); | 289 params.SetBoolean("offlineLoginAllowed", offline_login_allowed_); |
274 params.SetBoolean("showConnectingIndicator", show_connecting_indicator_); | 290 params.SetBoolean("showConnectingIndicator", show_connecting_indicator_); |
275 Show(parent_screen_, ¶ms); | 291 Show(parent_screen_, ¶ms); |
276 show_on_init_ = false; | 292 show_on_init_ = false; |
277 } | 293 } |
278 } | 294 } |
279 | 295 |
280 } // namespace chromeos | 296 } // namespace chromeos |
OLD | NEW |