OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/extensions/api/networking_private/networking_private_ev
ent_router.h" | 5 #include "chrome/browser/extensions/api/networking_private/networking_private_ev
ent_router.h" |
6 | 6 |
7 #include "base/json/json_writer.h" | 7 #include "base/json/json_writer.h" |
8 #include "chrome/browser/browser_process.h" | 8 #include "chrome/browser/browser_process.h" |
9 #include "chrome/browser/extensions/api/networking_private/networking_private_ap
i.h" | 9 #include "chrome/browser/extensions/api/networking_private/networking_private_ap
i.h" |
10 #include "chrome/browser/extensions/event_router_forwarder.h" | 10 #include "chrome/browser/extensions/event_router_forwarder.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 class NetworkingPrivateEventRouterImpl | 32 class NetworkingPrivateEventRouterImpl |
33 : public NetworkingPrivateEventRouter, | 33 : public NetworkingPrivateEventRouter, |
34 public chromeos::NetworkStateHandlerObserver, | 34 public chromeos::NetworkStateHandlerObserver, |
35 public NetworkPortalDetector::Observer { | 35 public NetworkPortalDetector::Observer { |
36 public: | 36 public: |
37 explicit NetworkingPrivateEventRouterImpl(Profile* profile); | 37 explicit NetworkingPrivateEventRouterImpl(Profile* profile); |
38 virtual ~NetworkingPrivateEventRouterImpl(); | 38 virtual ~NetworkingPrivateEventRouterImpl(); |
39 | 39 |
40 protected: | 40 protected: |
41 // KeyedService overrides: | 41 // KeyedService overrides: |
42 virtual void Shutdown() OVERRIDE; | 42 virtual void Shutdown() override; |
43 | 43 |
44 // EventRouter::Observer overrides: | 44 // EventRouter::Observer overrides: |
45 virtual void OnListenerAdded(const EventListenerInfo& details) OVERRIDE; | 45 virtual void OnListenerAdded(const EventListenerInfo& details) override; |
46 virtual void OnListenerRemoved(const EventListenerInfo& details) OVERRIDE; | 46 virtual void OnListenerRemoved(const EventListenerInfo& details) override; |
47 | 47 |
48 // NetworkStateHandlerObserver overrides: | 48 // NetworkStateHandlerObserver overrides: |
49 virtual void NetworkListChanged() OVERRIDE; | 49 virtual void NetworkListChanged() override; |
50 virtual void NetworkPropertiesUpdated(const NetworkState* network) OVERRIDE; | 50 virtual void NetworkPropertiesUpdated(const NetworkState* network) override; |
51 | 51 |
52 // NetworkPortalDetector::Observer overrides: | 52 // NetworkPortalDetector::Observer overrides: |
53 virtual void OnPortalDetectionCompleted( | 53 virtual void OnPortalDetectionCompleted( |
54 const NetworkState* network, | 54 const NetworkState* network, |
55 const NetworkPortalDetector::CaptivePortalState& state) OVERRIDE; | 55 const NetworkPortalDetector::CaptivePortalState& state) override; |
56 | 56 |
57 private: | 57 private: |
58 // Decide if we should listen for network changes or not. If there are any | 58 // Decide if we should listen for network changes or not. If there are any |
59 // JavaScript listeners registered for the onNetworkChanged event, then we | 59 // JavaScript listeners registered for the onNetworkChanged event, then we |
60 // want to register for change notification from the network state handler. | 60 // want to register for change notification from the network state handler. |
61 // Otherwise, we want to unregister and not be listening to network changes. | 61 // Otherwise, we want to unregister and not be listening to network changes. |
62 void StartOrStopListeningForNetworkChanges(); | 62 void StartOrStopListeningForNetworkChanges(); |
63 | 63 |
64 Profile* profile_; | 64 Profile* profile_; |
65 bool listening_; | 65 bool listening_; |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 args.Pass())); | 235 args.Pass())); |
236 event_router->BroadcastEvent(extension_event.Pass()); | 236 event_router->BroadcastEvent(extension_event.Pass()); |
237 } | 237 } |
238 | 238 |
239 NetworkingPrivateEventRouter* NetworkingPrivateEventRouter::Create( | 239 NetworkingPrivateEventRouter* NetworkingPrivateEventRouter::Create( |
240 Profile* profile) { | 240 Profile* profile) { |
241 return new NetworkingPrivateEventRouterImpl(profile); | 241 return new NetworkingPrivateEventRouterImpl(profile); |
242 } | 242 } |
243 | 243 |
244 } // namespace extensions | 244 } // namespace extensions |
OLD | NEW |