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

Side by Side Diff: chrome/browser/ui/webui/chromeos/login/network_state_informer.h

Issue 872633008: Migrate (Network)ErrorScreen to ScreenContext (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nit Created 5 years, 10 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
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_UI_WEBUI_CHROMEOS_LOGIN_NETWORK_STATE_INFORMER_H_ 5 #ifndef CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_NETWORK_STATE_INFORMER_H_
6 #define CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_NETWORK_STATE_INFORMER_H_ 6 #define CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_NETWORK_STATE_INFORMER_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 10
11 #include "base/cancelable_callback.h" 11 #include "base/cancelable_callback.h"
12 #include "base/compiler_specific.h" 12 #include "base/compiler_specific.h"
13 #include "base/memory/ref_counted.h" 13 #include "base/memory/ref_counted.h"
14 #include "base/memory/weak_ptr.h" 14 #include "base/memory/weak_ptr.h"
15 #include "base/observer_list.h" 15 #include "base/observer_list.h"
16 #include "chrome/browser/chromeos/login/screens/error_screen_actor.h" 16 #include "chrome/browser/chromeos/login/screens/network_error.h"
17 #include "chrome/browser/chromeos/login/ui/captive_portal_window_proxy.h" 17 #include "chrome/browser/chromeos/login/ui/captive_portal_window_proxy.h"
18 #include "chromeos/network/network_state_handler_observer.h" 18 #include "chromeos/network/network_state_handler_observer.h"
19 #include "chromeos/network/portal_detector/network_portal_detector.h" 19 #include "chromeos/network/portal_detector/network_portal_detector.h"
20 #include "content/public/browser/notification_observer.h" 20 #include "content/public/browser/notification_observer.h"
21 #include "content/public/browser/notification_registrar.h" 21 #include "content/public/browser/notification_registrar.h"
22 #include "content/public/browser/notification_service.h" 22 #include "content/public/browser/notification_service.h"
23 23
24 namespace chromeos { 24 namespace chromeos {
25 25
26 // Class which observes network state changes and calls registered callbacks. 26 // Class which observes network state changes and calls registered callbacks.
(...skipping 13 matching lines...) Expand all
40 CONNECTING, 40 CONNECTING,
41 PROXY_AUTH_REQUIRED, 41 PROXY_AUTH_REQUIRED,
42 UNKNOWN 42 UNKNOWN
43 }; 43 };
44 44
45 class NetworkStateInformerObserver { 45 class NetworkStateInformerObserver {
46 public: 46 public:
47 NetworkStateInformerObserver() {} 47 NetworkStateInformerObserver() {}
48 virtual ~NetworkStateInformerObserver() {} 48 virtual ~NetworkStateInformerObserver() {}
49 49
50 virtual void UpdateState(ErrorScreenActor::ErrorReason reason) = 0; 50 virtual void UpdateState(NetworkError::ErrorReason reason) = 0;
51 virtual void OnNetworkReady() {} 51 virtual void OnNetworkReady() {}
52 }; 52 };
53 53
54 NetworkStateInformer(); 54 NetworkStateInformer();
55 55
56 void Init(); 56 void Init();
57 57
58 // Adds observer to be notified when network state has been changed. 58 // Adds observer to be notified when network state has been changed.
59 void AddObserver(NetworkStateInformerObserver* observer); 59 void AddObserver(NetworkStateInformerObserver* observer);
60 60
(...skipping 24 matching lines...) Expand all
85 85
86 private: 86 private:
87 friend class base::RefCounted<NetworkStateInformer>; 87 friend class base::RefCounted<NetworkStateInformer>;
88 88
89 ~NetworkStateInformer() override; 89 ~NetworkStateInformer() override;
90 90
91 bool UpdateState(); 91 bool UpdateState();
92 92
93 void UpdateStateAndNotify(); 93 void UpdateStateAndNotify();
94 94
95 void SendStateToObservers(ErrorScreenActor::ErrorReason reason); 95 void SendStateToObservers(NetworkError::ErrorReason reason);
96 96
97 State state_; 97 State state_;
98 std::string network_path_; 98 std::string network_path_;
99 std::string network_type_; 99 std::string network_type_;
100 100
101 ObserverList<NetworkStateInformerObserver> observers_; 101 ObserverList<NetworkStateInformerObserver> observers_;
102 content::NotificationRegistrar registrar_; 102 content::NotificationRegistrar registrar_;
103 103
104 base::WeakPtrFactory<NetworkStateInformer> weak_ptr_factory_; 104 base::WeakPtrFactory<NetworkStateInformer> weak_ptr_factory_;
105 }; 105 };
106 106
107 } // namespace chromeos 107 } // namespace chromeos
108 108
109 #endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_NETWORK_STATE_INFORMER_H_ 109 #endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_NETWORK_STATE_INFORMER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698