Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(333)

Side by Side Diff: chrome/browser/chromeos/login/screens/error_screen.h

Issue 2642823011: cros: Fold NetworkErrorModel into NetworkErrorView. (Closed)
Patch Set: Address comments Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/chromeos/BUILD.gn ('k') | chrome/browser/chromeos/login/screens/error_screen.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_ERROR_SCREEN_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_ERROR_SCREEN_H_
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_ERROR_SCREEN_H_ 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_ERROR_SCREEN_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/callback_list.h"
10 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
11 #include "base/macros.h" 12 #include "base/macros.h"
12 #include "base/memory/weak_ptr.h" 13 #include "base/memory/weak_ptr.h"
14 #include "chrome/browser/chromeos/login/screens/base_screen.h"
13 #include "chrome/browser/chromeos/login/screens/network_error.h" 15 #include "chrome/browser/chromeos/login/screens/network_error.h"
14 #include "chrome/browser/chromeos/login/screens/network_error_model.h"
15 #include "chrome/browser/chromeos/settings/device_settings_service.h" 16 #include "chrome/browser/chromeos/settings/device_settings_service.h"
16 #include "chrome/browser/ui/webui/chromeos/login/network_state_informer.h" 17 #include "chrome/browser/ui/webui/chromeos/login/network_state_informer.h"
17 #include "chromeos/login/auth/login_performer.h" 18 #include "chromeos/login/auth/login_performer.h"
18 19
19 namespace chromeos { 20 namespace chromeos {
20 21
21 class BaseScreenDelegate; 22 class BaseScreenDelegate;
22 class CaptivePortalWindowProxy; 23 class CaptivePortalWindowProxy;
23 class NetworkErrorView; 24 class NetworkErrorView;
24 25
25 // Controller for the error screen. 26 // Controller for the error screen.
26 class ErrorScreen : public NetworkErrorModel, public LoginPerformer::Delegate { 27 class ErrorScreen : public BaseScreen, public LoginPerformer::Delegate {
27 public: 28 public:
28 typedef std::unique_ptr<base::CallbackList<void()>::Subscription> 29 using ConnectRequestCallbackSubscription =
29 ConnectRequestCallbackSubscription; 30 std::unique_ptr<base::CallbackList<void()>::Subscription>;
31
32 // TODO(jdufault): Some of these are no longer used and can be removed. See
33 // crbug.com/672142.
34 static const char kUserActionConfigureCertsButtonClicked[];
35 static const char kUserActionDiagnoseButtonClicked[];
36 static const char kUserActionLaunchOobeGuestSessionClicked[];
37 static const char kUserActionLocalStateErrorPowerwashButtonClicked[];
38 static const char kUserActionRebootButtonClicked[];
39 static const char kUserActionShowCaptivePortalClicked[];
40 static const char kUserActionConnectRequested[];
30 41
31 ErrorScreen(BaseScreenDelegate* base_screen_delegate, NetworkErrorView* view); 42 ErrorScreen(BaseScreenDelegate* base_screen_delegate, NetworkErrorView* view);
32 ~ErrorScreen() override; 43 ~ErrorScreen() override;
33 44
34 // NetworkErrorModel: 45 // Toggles the guest sign-in prompt.
46 void AllowGuestSignin(bool allowed);
47
48 // Toggles the offline sign-in.
49 void AllowOfflineLogin(bool allowed);
50
51 // Initializes captive portal dialog and shows that if needed.
52 virtual void FixCaptivePortal();
53
54 NetworkError::UIState GetUIState() const;
55 NetworkError::ErrorState GetErrorState() const;
56
57 // Returns id of the screen behind error screen ("caller" screen).
58 // Returns OobeScreen::SCREEN_UNKNOWN if error screen isn't the current
59 // screen.
60 OobeScreen GetParentScreen() const;
61
62 // Called when we're asked to hide captive portal dialog.
63 void HideCaptivePortal();
64
65 // This method is called, when view is being destroyed. Note, if model
66 // is destroyed earlier then it has to call Unbind().
67 void OnViewDestroyed(NetworkErrorView* view);
68
69 // Sets current UI state.
70 virtual void SetUIState(NetworkError::UIState ui_state);
71
72 // Sets current error screen content according to current UI state,
73 // |error_state|, and |network|.
74 virtual void SetErrorState(NetworkError::ErrorState error_state,
75 const std::string& network);
76
77 // Sets "parent screen" i.e. one that has initiated this network error screen
78 // instance.
79 void SetParentScreen(OobeScreen parent_screen);
80
81 // Sets callback that is called on hide.
82 void SetHideCallback(const base::Closure& on_hide);
83
84 // Shows captive portal dialog.
85 void ShowCaptivePortal();
86
87 // Toggles the connection pending indicator.
88 void ShowConnectingIndicator(bool show);
89
90 // Register a callback to be invoked when the user indicates that an attempt
91 // to connect to the network should be made.
92 ConnectRequestCallbackSubscription RegisterConnectRequestCallback(
93 const base::Closure& callback);
94
95 // BaseScreen overrides:
35 void Show() override; 96 void Show() override;
36 void Hide() override; 97 void Hide() override;
37 void OnShow() override; 98 void OnShow() override;
38 void OnHide() override; 99 void OnHide() override;
39 void OnUserAction(const std::string& action_id) override; 100 void OnUserAction(const std::string& action_id) override;
40 void OnContextKeyUpdated(const ::login::ScreenContext::KeyType& key) override;
41 void AllowGuestSignin(bool allowed) override;
42 void AllowOfflineLogin(bool allowed) override;
43 void FixCaptivePortal() override;
44 NetworkError::UIState GetUIState() const override;
45 NetworkError::ErrorState GetErrorState() const override;
46 OobeScreen GetParentScreen() const override;
47 void HideCaptivePortal() override;
48 void OnViewDestroyed(NetworkErrorView* view) override;
49 void SetUIState(NetworkError::UIState ui_state) override;
50 void SetErrorState(NetworkError::ErrorState error_state,
51 const std::string& network) override;
52 void SetParentScreen(OobeScreen parent_screen) override;
53 void SetHideCallback(const base::Closure& on_hide) override;
54 void ShowCaptivePortal() override;
55 void ShowConnectingIndicator(bool show) override;
56 101
57 // LoginPerformer::Delegate implementation: 102 private:
103 // LoginPerformer::Delegate overrides:
58 void OnAuthFailure(const AuthFailure& error) override; 104 void OnAuthFailure(const AuthFailure& error) override;
59 void OnAuthSuccess(const UserContext& user_context) override; 105 void OnAuthSuccess(const UserContext& user_context) override;
60 void OnOffTheRecordAuthSuccess() override; 106 void OnOffTheRecordAuthSuccess() override;
61 void OnPasswordChangeDetected() override; 107 void OnPasswordChangeDetected() override;
62 void WhiteListCheckFailed(const std::string& email) override; 108 void WhiteListCheckFailed(const std::string& email) override;
63 void PolicyLoadFailed() override; 109 void PolicyLoadFailed() override;
64 void SetAuthFlowOffline(bool offline) override; 110 void SetAuthFlowOffline(bool offline) override;
65 111
66 // Register a callback to be invoked when the user indicates that an attempt
67 // to connect to the network should be made.
68 ConnectRequestCallbackSubscription RegisterConnectRequestCallback(
69 const base::Closure& callback);
70
71 private:
72 // Default hide_closure for Hide(). 112 // Default hide_closure for Hide().
73 void DefaultHideCallback(); 113 void DefaultHideCallback();
74 114
75 // Handle user action to configure certificates. 115 // Handle user action to configure certificates.
76 void OnConfigureCerts(); 116 void OnConfigureCerts();
77 117
78 // Handle user action to diagnose network configuration. 118 // Handle user action to diagnose network configuration.
79 void OnDiagnoseButtonClicked(); 119 void OnDiagnoseButtonClicked();
80 120
81 // Handle user action to launch guest session from out-of-box. 121 // Handle user action to launch guest session from out-of-box.
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 base::CallbackList<void()> connect_request_callbacks_; 158 base::CallbackList<void()> connect_request_callbacks_;
119 159
120 base::WeakPtrFactory<ErrorScreen> weak_factory_; 160 base::WeakPtrFactory<ErrorScreen> weak_factory_;
121 161
122 DISALLOW_COPY_AND_ASSIGN(ErrorScreen); 162 DISALLOW_COPY_AND_ASSIGN(ErrorScreen);
123 }; 163 };
124 164
125 } // namespace chromeos 165 } // namespace chromeos
126 166
127 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_ERROR_SCREEN_H_ 167 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_ERROR_SCREEN_H_
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/BUILD.gn ('k') | chrome/browser/chromeos/login/screens/error_screen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698