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

Side by Side Diff: ui/chromeos/network/network_state_notifier.h

Issue 686503002: Move network_connect code to ui/chromeos/network (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 years, 1 month 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 | « ui/chromeos/network/network_connect.cc ('k') | ui/chromeos/network/network_state_notifier.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 ASH_SYSTEM_CHROMEOS_NETWORK_NETWORK_STATE_NOTIFIER_H_ 5 #ifndef UI_CHROMEOS_NETWORK_NETWORK_STATE_NOTIFIER_H_
6 #define ASH_SYSTEM_CHROMEOS_NETWORK_NETWORK_STATE_NOTIFIER_H_ 6 #define UI_CHROMEOS_NETWORK_NETWORK_STATE_NOTIFIER_H_
7 7
8 #include <set> 8 #include <set>
9 9
10 #include "ash/ash_export.h"
11 #include "base/basictypes.h" 10 #include "base/basictypes.h"
12 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
13 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
14 #include "base/memory/weak_ptr.h" 13 #include "base/memory/weak_ptr.h"
15 #include "base/time/time.h" 14 #include "base/time/time.h"
16 #include "chromeos/network/network_state_handler_observer.h" 15 #include "chromeos/network/network_state_handler_observer.h"
16 #include "ui/chromeos/ui_chromeos_export.h"
17 17
18 namespace base { 18 namespace base {
19 class DictionaryValue; 19 class DictionaryValue;
20 } 20 }
21 21
22 namespace chromeos { 22 namespace chromeos {
23 class NetworkState; 23 class NetworkState;
24 } 24 }
25 25
26 namespace ash { 26 namespace ui {
27 27
28 class NetworkConnect; 28 class NetworkConnect;
29 29
30 // This class has two purposes: 30 // This class has two purposes:
31 // 1. ShowNetworkConnectError() gets called after any user initiated connect 31 // 1. ShowNetworkConnectError() gets called after any user initiated connect
32 // failure. This will handle displaying an error notification. 32 // failure. This will handle displaying an error notification.
33 // TODO(stevenjb): convert this class to use the new MessageCenter 33 // TODO(stevenjb): convert this class to use the new MessageCenter
34 // notification system. 34 // notification system.
35 // 2. It observes NetworkState changes to generate notifications when a 35 // 2. It observes NetworkState changes to generate notifications when a
36 // Cellular network is out of credits. 36 // Cellular network is out of credits.
37 class ASH_EXPORT NetworkStateNotifier : 37 class UI_CHROMEOS_EXPORT NetworkStateNotifier :
38 public chromeos::NetworkStateHandlerObserver { 38 public chromeos::NetworkStateHandlerObserver {
39 public: 39 public:
40 explicit NetworkStateNotifier(NetworkConnect* network_connect); 40 explicit NetworkStateNotifier(NetworkConnect* network_connect);
41 virtual ~NetworkStateNotifier(); 41 virtual ~NetworkStateNotifier();
42 42
43 // NetworkStateHandlerObserver 43 // NetworkStateHandlerObserver
44 virtual void DefaultNetworkChanged( 44 virtual void DefaultNetworkChanged(
45 const chromeos::NetworkState* network) override; 45 const chromeos::NetworkState* network) override;
46 virtual void NetworkPropertiesUpdated( 46 virtual void NetworkPropertiesUpdated(
47 const chromeos::NetworkState* network) override; 47 const chromeos::NetworkState* network) override;
48 48
49 // Show a connection error notification. If |error_name| matches an error 49 // Show a connection error notification. If |error_name| matches an error
50 // defined in NetworkConnectionHandler for connect, configure, or activation 50 // defined in NetworkConnectionHandler for connect, configure, or activation
51 // failed, then the associated message is shown; otherwise use the last_error 51 // failed, then the associated message is shown; otherwise use the last_error
52 // value for the network or a Shill property if available. 52 // value for the network or a Shill property if available.
53 void ShowNetworkConnectError(const std::string& error_name, 53 void ShowNetworkConnectError(const std::string& error_name,
54 const std::string& service_path); 54 const std::string& service_path);
55 55
56 // Show a mobile activation error notification. 56 // Show a mobile activation error notification.
57 void ShowMobileActivationError(const std::string& service_path); 57 void ShowMobileActivationError(const std::string& service_path);
58 58
59 // Removes any existing connect notifications. 59 // Removes any existing connect notifications.
60 void RemoveConnectNotification(); 60 void RemoveConnectNotification();
61 61
62 static const char kNotifierNetwork[];
63 static const char kNotifierNetworkError[];
62 static const char kNetworkConnectNotificationId[]; 64 static const char kNetworkConnectNotificationId[];
63 static const char kNetworkActivateNotificationId[]; 65 static const char kNetworkActivateNotificationId[];
64 static const char kNetworkOutOfCreditsNotificationId[]; 66 static const char kNetworkOutOfCreditsNotificationId[];
65 67
66 private: 68 private:
67 void ConnectErrorPropertiesSucceeded( 69 void ConnectErrorPropertiesSucceeded(
68 const std::string& error_name, 70 const std::string& error_name,
69 const std::string& service_path, 71 const std::string& service_path,
70 const base::DictionaryValue& shill_properties); 72 const base::DictionaryValue& shill_properties);
71 void ConnectErrorPropertiesFailed( 73 void ConnectErrorPropertiesFailed(
(...skipping 19 matching lines...) Expand all
91 NetworkConnect* network_connect_; // unowned 93 NetworkConnect* network_connect_; // unowned
92 std::string last_default_network_; 94 std::string last_default_network_;
93 bool did_show_out_of_credits_; 95 bool did_show_out_of_credits_;
94 base::Time out_of_credits_notify_time_; 96 base::Time out_of_credits_notify_time_;
95 std::set<std::string> cellular_activating_; 97 std::set<std::string> cellular_activating_;
96 base::WeakPtrFactory<NetworkStateNotifier> weak_ptr_factory_; 98 base::WeakPtrFactory<NetworkStateNotifier> weak_ptr_factory_;
97 99
98 DISALLOW_COPY_AND_ASSIGN(NetworkStateNotifier); 100 DISALLOW_COPY_AND_ASSIGN(NetworkStateNotifier);
99 }; 101 };
100 102
101 } // namespace ash 103 } // namespace ui
102 104
103 #endif // ASH_SYSTEM_CHROMEOS_NETWORK_NETWORK_STATE_NOTIFIER_H_ 105 #endif // UI_CHROMEOS_NETWORK_NETWORK_STATE_NOTIFIER_H_
OLDNEW
« no previous file with comments | « ui/chromeos/network/network_connect.cc ('k') | ui/chromeos/network/network_state_notifier.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698