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

Side by Side Diff: chrome/browser/chromeos/extensions/networking_private_event_router.h

Issue 15517005: Remove references to Profile from browser_context_keyed_service. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase & style Created 7 years, 7 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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 #ifndef CHROME_BROWSER_CHROMEOS_EXTENSIONS_NETWORKING_PRIVATE_EVENT_ROUTER_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_EXTENSIONS_NETWORKING_PRIVATE_EVENT_ROUTER_H_
6 #define CHROME_BROWSER_CHROMEOS_EXTENSIONS_NETWORKING_PRIVATE_EVENT_ROUTER_H_ 6 #define CHROME_BROWSER_CHROMEOS_EXTENSIONS_NETWORKING_PRIVATE_EVENT_ROUTER_H_
7 7
8 #include "chrome/browser/extensions/event_router.h" 8 #include "chrome/browser/extensions/event_router.h"
9 #include "chromeos/network/network_state_handler_observer.h" 9 #include "chromeos/network/network_state_handler_observer.h"
10 #include "components/browser_context_keyed_service/browser_context_keyed_service .h" 10 #include "components/browser_context_keyed_service/browser_context_keyed_service .h"
11 11
12 class Profile; 12 class Profile;
13 13
14 namespace chromeos { 14 namespace chromeos {
15 15
16 // This is a factory class used by the ProfileDependencyManager to instantiate 16 // This is a factory class used by the BrowserContextDependencyManager
17 // the event router that will forward events from the NetworkStateHandler to the 17 // to instantiate the event router that will forward events
18 // JavaScript Networking API. 18 // from the NetworkStateHandler to the JavaScript Networking API.
19 class NetworkingPrivateEventRouter : public ProfileKeyedService, 19 class NetworkingPrivateEventRouter : public BrowserContextKeyedService,
20 public extensions::EventRouter::Observer, 20 public extensions::EventRouter::Observer,
21 public NetworkStateHandlerObserver { 21 public NetworkStateHandlerObserver {
22 public: 22 public:
23 explicit NetworkingPrivateEventRouter(Profile* profile); 23 explicit NetworkingPrivateEventRouter(Profile* profile);
24 virtual ~NetworkingPrivateEventRouter(); 24 virtual ~NetworkingPrivateEventRouter();
25 25
26 protected: 26 protected:
27 // ProfileKeyedService overrides: 27 // BrowserContextKeyedService overrides:
28 virtual void Shutdown() OVERRIDE; 28 virtual void Shutdown() OVERRIDE;
29 29
30 // EventRouter::Observer overrides: 30 // EventRouter::Observer overrides:
31 virtual void OnListenerAdded( 31 virtual void OnListenerAdded(
32 const extensions::EventListenerInfo& details) OVERRIDE; 32 const extensions::EventListenerInfo& details) OVERRIDE;
33 virtual void OnListenerRemoved( 33 virtual void OnListenerRemoved(
34 const extensions::EventListenerInfo& details) OVERRIDE; 34 const extensions::EventListenerInfo& details) OVERRIDE;
35 35
36 // NetworkStateHandlerObserver overrides: 36 // NetworkStateHandlerObserver overrides:
37 virtual void NetworkListChanged() OVERRIDE; 37 virtual void NetworkListChanged() OVERRIDE;
38 virtual void NetworkPropertiesUpdated(const NetworkState* network) OVERRIDE; 38 virtual void NetworkPropertiesUpdated(const NetworkState* network) OVERRIDE;
39 39
40 private: 40 private:
41 // Decide if we should listen for network changes or not. If there are any 41 // Decide if we should listen for network changes or not. If there are any
42 // JavaScript listeners registered for the onNetworkChanged event, then we 42 // JavaScript listeners registered for the onNetworkChanged event, then we
43 // want to register for change notification from the network state handler. 43 // want to register for change notification from the network state handler.
44 // Otherwise, we want to unregister and not be listening to network changes. 44 // Otherwise, we want to unregister and not be listening to network changes.
45 void StartOrStopListeningForNetworkChanges(); 45 void StartOrStopListeningForNetworkChanges();
46 46
47 Profile* profile_; 47 Profile* profile_;
48 bool listening_; 48 bool listening_;
49 49
50 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateEventRouter); 50 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateEventRouter);
51 }; 51 };
52 52
53 } // namespace chromeos 53 } // namespace chromeos
54 54
55 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_NETWORKING_PRIVATE_EVENT_ROUTER_H_ 55 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_NETWORKING_PRIVATE_EVENT_ROUTER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698