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

Side by Side Diff: chrome/browser/extensions/api/dial/dial_api.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) 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_EXTENSIONS_API_DIAL_DIAL_API_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_DIAL_DIAL_API_H_
6 #define CHROME_BROWSER_EXTENSIONS_API_DIAL_DIAL_API_H_ 6 #define CHROME_BROWSER_EXTENSIONS_API_DIAL_DIAL_API_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "chrome/browser/extensions/api/api_function.h" 10 #include "chrome/browser/extensions/api/api_function.h"
11 #include "chrome/browser/extensions/api/dial/dial_device_data.h" 11 #include "chrome/browser/extensions/api/dial/dial_device_data.h"
12 #include "chrome/browser/extensions/api/dial/dial_registry.h" 12 #include "chrome/browser/extensions/api/dial/dial_registry.h"
13 #include "chrome/browser/extensions/event_router.h" 13 #include "chrome/browser/extensions/event_router.h"
14 #include "components/browser_context_keyed_service/refcounted_browser_context_ke yed_service.h" 14 #include "components/browser_context_keyed_service/refcounted_browser_context_ke yed_service.h"
15 15
16 namespace extensions { 16 namespace extensions {
17 17
18 class DialRegistry; 18 class DialRegistry;
19 19
20 // Dial API which is a ref-counted ProfileKeyedService that manages the DIAL 20 // Dial API which is a ref-counted BrowserContextKeyedService that manages
21 // registry. It takes care of creating the registry on the IO thread and 21 // the DIAL registry. It takes care of creating the registry on the IO thread
22 // is an observer of the registry. It makes sure devices events are sent out 22 // and is an observer of the registry. It makes sure devices events are sent out
23 // to extension listeners on the right thread. 23 // to extension listeners on the right thread.
24 class DialAPI : public RefcountedProfileKeyedService, 24 class DialAPI : public RefcountedBrowserContextKeyedService,
25 public EventRouter::Observer, 25 public EventRouter::Observer,
26 public DialRegistry::Observer { 26 public DialRegistry::Observer {
27 public: 27 public:
28 explicit DialAPI(Profile* profile); 28 explicit DialAPI(Profile* profile);
29 29
30 // The DialRegistry for the API. This must always be used only from the IO 30 // The DialRegistry for the API. This must always be used only from the IO
31 // thread. 31 // thread.
32 DialRegistry* dial_registry(); 32 DialRegistry* dial_registry();
33 33
34 // Called by the DialRegistry on the IO thread so that the DialAPI dispatches 34 // Called by the DialRegistry on the IO thread so that the DialAPI dispatches
35 // the event to listeners on the UI thread. 35 // the event to listeners on the UI thread.
36 void SendEventOnUIThread(const DialRegistry::DeviceList& devices); 36 void SendEventOnUIThread(const DialRegistry::DeviceList& devices);
37 void SendErrorOnUIThread(const DialRegistry::DialErrorCode type); 37 void SendErrorOnUIThread(const DialRegistry::DialErrorCode type);
38 38
39 private: 39 private:
40 virtual ~DialAPI(); 40 virtual ~DialAPI();
41 41
42 // RefcountedProfileKeyedService: 42 // RefcountedBrowserContextKeyedService:
43 virtual void ShutdownOnUIThread() OVERRIDE; 43 virtual void ShutdownOnUIThread() OVERRIDE;
44 44
45 // EventRouter::Observer: 45 // EventRouter::Observer:
46 virtual void OnListenerAdded(const EventListenerInfo& details) OVERRIDE; 46 virtual void OnListenerAdded(const EventListenerInfo& details) OVERRIDE;
47 virtual void OnListenerRemoved(const EventListenerInfo& details) OVERRIDE; 47 virtual void OnListenerRemoved(const EventListenerInfo& details) OVERRIDE;
48 48
49 // DialRegistry::Observer: 49 // DialRegistry::Observer:
50 virtual void OnDialDeviceEvent( 50 virtual void OnDialDeviceEvent(
51 const DialRegistry::DeviceList& devices) OVERRIDE; 51 const DialRegistry::DeviceList& devices) OVERRIDE;
52 virtual void OnDialError(DialRegistry::DialErrorCode type) OVERRIDE; 52 virtual void OnDialError(DialRegistry::DialErrorCode type) OVERRIDE;
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 bool result_; 94 bool result_;
95 95
96 DISALLOW_COPY_AND_ASSIGN(DialDiscoverNowFunction); 96 DISALLOW_COPY_AND_ASSIGN(DialDiscoverNowFunction);
97 }; 97 };
98 98
99 } // namespace api 99 } // namespace api
100 100
101 } // namespace extensions 101 } // namespace extensions
102 102
103 #endif // CHROME_BROWSER_EXTENSIONS_API_DIAL_DIAL_API_H_ 103 #endif // CHROME_BROWSER_EXTENSIONS_API_DIAL_DIAL_API_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698