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

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

Issue 22264004: Remove ConnectivityStateHelper (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove redundant IsConnected() check Created 7 years, 4 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 | Annotate | Revision Log
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_NETWORK_SCREEN_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_NETWORK_SCREEN_H_
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_NETWORK_SCREEN_H_ 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_NETWORK_SCREEN_H_
7 7
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/strings/string16.h" 10 #include "base/strings/string16.h"
11 #include "base/timer/timer.h" 11 #include "base/timer/timer.h"
12 #include "chrome/browser/chromeos/login/language_switch_menu.h" 12 #include "chrome/browser/chromeos/login/language_switch_menu.h"
13 #include "chrome/browser/chromeos/login/screens/network_screen_actor.h" 13 #include "chrome/browser/chromeos/login/screens/network_screen_actor.h"
14 #include "chrome/browser/chromeos/login/screens/wizard_screen.h" 14 #include "chrome/browser/chromeos/login/screens/wizard_screen.h"
15 #include "chrome/browser/chromeos/net/connectivity_state_helper_observer.h" 15 #include "chromeos/network/network_state_handler_observer.h"
16 16
17 namespace chromeos { 17 namespace chromeos {
18 18
19 namespace login {
20 class NetworkStateHelper;
21 } // namespace login
22
19 class NetworkScreen : public WizardScreen, 23 class NetworkScreen : public WizardScreen,
20 public ConnectivityStateHelperObserver, 24 public NetworkStateHandlerObserver,
21 public NetworkScreenActor::Delegate { 25 public NetworkScreenActor::Delegate {
22 public: 26 public:
23 NetworkScreen(ScreenObserver* screen_observer, NetworkScreenActor* actor); 27 NetworkScreen(ScreenObserver* screen_observer, NetworkScreenActor* actor);
24 virtual ~NetworkScreen(); 28 virtual ~NetworkScreen();
25 29
26 // WizardScreen implementation: 30 // WizardScreen implementation:
27 virtual void PrepareToShow() OVERRIDE; 31 virtual void PrepareToShow() OVERRIDE;
28 virtual void Show() OVERRIDE; 32 virtual void Show() OVERRIDE;
29 virtual void Hide() OVERRIDE; 33 virtual void Hide() OVERRIDE;
30 virtual std::string GetName() const OVERRIDE; 34 virtual std::string GetName() const OVERRIDE;
31 35
32 // ConnectivityStateHelperObserver implementation: 36 // NetworkStateHandlerObserver implementation:
33 virtual void NetworkManagerChanged() OVERRIDE; 37 virtual void NetworkManagerChanged() OVERRIDE;
34 virtual void DefaultNetworkChanged() OVERRIDE; 38 virtual void DefaultNetworkChanged(const NetworkState* network) OVERRIDE;
35 39
36 // NetworkScreenActor::Delegate implementation: 40 // NetworkScreenActor::Delegate implementation:
37 virtual void OnActorDestroyed(NetworkScreenActor* actor) OVERRIDE; 41 virtual void OnActorDestroyed(NetworkScreenActor* actor) OVERRIDE;
38 virtual void OnContinuePressed() OVERRIDE; 42 virtual void OnContinuePressed() OVERRIDE;
39 43
40 NetworkScreenActor* actor() const { return actor_; } 44 NetworkScreenActor* actor() const { return actor_; }
41 45
42 protected: 46 protected:
43 // Subscribes NetworkScreen to the network change notification, 47 // Subscribes NetworkScreen to the network change notification,
44 // forces refresh of current network state. 48 // forces refresh of current network state.
45 virtual void Refresh(); 49 virtual void Refresh();
46 50
47 private: 51 private:
52 friend class NetworkScreenTest;
48 FRIEND_TEST_ALL_PREFIXES(NetworkScreenTest, Timeout); 53 FRIEND_TEST_ALL_PREFIXES(NetworkScreenTest, Timeout);
54 FRIEND_TEST_ALL_PREFIXES(NetworkScreenTest, CanConnect);
55
56 // Sets the NetworkStateHelper for use in tests. This
57 // class will take ownership of the pointed object.
58 void SetNetworkStateHelperForTest(login::NetworkStateHelper* helper);
49 59
50 // Subscribes to network change notifications. 60 // Subscribes to network change notifications.
51 void SubscribeNetworkNotification(); 61 void SubscribeNetworkNotification();
52 62
53 // Unsubscribes from network change notifications. 63 // Unsubscribes from network change notifications.
54 void UnsubscribeNetworkNotification(); 64 void UnsubscribeNetworkNotification();
55 65
56 // Notifies wizard on successful connection. 66 // Notifies wizard on successful connection.
57 void NotifyOnConnection(); 67 void NotifyOnConnection();
58 68
(...skipping 16 matching lines...) Expand all
75 string16 network_id_; 85 string16 network_id_;
76 86
77 // True if user pressed continue button so we should proceed with OOBE 87 // True if user pressed continue button so we should proceed with OOBE
78 // as soon as we are connected. 88 // as soon as we are connected.
79 bool continue_pressed_; 89 bool continue_pressed_;
80 90
81 // Timer for connection timeout. 91 // Timer for connection timeout.
82 base::OneShotTimer<NetworkScreen> connection_timer_; 92 base::OneShotTimer<NetworkScreen> connection_timer_;
83 93
84 NetworkScreenActor* actor_; 94 NetworkScreenActor* actor_;
95 scoped_ptr<login::NetworkStateHelper> network_state_helper_;
85 96
86 DISALLOW_COPY_AND_ASSIGN(NetworkScreen); 97 DISALLOW_COPY_AND_ASSIGN(NetworkScreen);
87 }; 98 };
88 99
89 } // namespace chromeos 100 } // namespace chromeos
90 101
91 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_NETWORK_SCREEN_H_ 102 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_NETWORK_SCREEN_H_
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/oauth2_token_fetcher.cc ('k') | chrome/browser/chromeos/login/screens/network_screen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698