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

Side by Side Diff: chrome/browser/extensions/api/streams_private/streams_private_api.h

Issue 178193030: Rename ProfileKeyedAPI to BrowserContextKeyedAPI and GetProfile to Get. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: nits Created 6 years, 9 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_STREAMS_PRIVATE_STREAMS_PRIVATE_API_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_STREAMS_PRIVATE_STREAMS_PRIVATE_API_H_
6 #define CHROME_BROWSER_EXTENSIONS_API_STREAMS_PRIVATE_STREAMS_PRIVATE_API_H_ 6 #define CHROME_BROWSER_EXTENSIONS_API_STREAMS_PRIVATE_STREAMS_PRIVATE_API_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/values.h" 12 #include "base/values.h"
13 #include "chrome/browser/extensions/api/profile_keyed_api_factory.h"
14 #include "components/browser_context_keyed_service/browser_context_keyed_service .h" 13 #include "components/browser_context_keyed_service/browser_context_keyed_service .h"
15 #include "content/public/browser/notification_observer.h" 14 #include "content/public/browser/notification_observer.h"
16 #include "content/public/browser/notification_registrar.h" 15 #include "content/public/browser/notification_registrar.h"
16 #include "extensions/browser/browser_context_keyed_api_factory.h"
17 #include "extensions/browser/extension_function.h" 17 #include "extensions/browser/extension_function.h"
18 #include "extensions/common/extension.h" 18 #include "extensions/common/extension.h"
19 19
20 class Profile; 20 class Profile;
21 21
22 namespace content { 22 namespace content {
23 class BrowserContext; 23 class BrowserContext;
24 class StreamHandle; 24 class StreamHandle;
25 } 25 }
26 26
27 namespace extensions { 27 namespace extensions {
28 28
29 class StreamsPrivateAPI : public ProfileKeyedAPI, 29 class StreamsPrivateAPI : public BrowserContextKeyedAPI,
30 public content::NotificationObserver { 30 public content::NotificationObserver {
31 public: 31 public:
32 // Convenience method to get the StreamsPrivateAPI for a profile. 32 // Convenience method to get the StreamsPrivateAPI for a profile.
33 static StreamsPrivateAPI* Get(content::BrowserContext* context); 33 static StreamsPrivateAPI* Get(content::BrowserContext* context);
34 34
35 explicit StreamsPrivateAPI(content::BrowserContext* context); 35 explicit StreamsPrivateAPI(content::BrowserContext* context);
36 virtual ~StreamsPrivateAPI(); 36 virtual ~StreamsPrivateAPI();
37 37
38 void ExecuteMimeTypeHandler(const std::string& extension_id, 38 void ExecuteMimeTypeHandler(const std::string& extension_id,
39 const content::WebContents* web_contents, 39 const content::WebContents* web_contents,
40 scoped_ptr<content::StreamHandle> stream, 40 scoped_ptr<content::StreamHandle> stream,
41 int64 expected_content_size); 41 int64 expected_content_size);
42 42
43 // ProfileKeyedAPI implementation. 43 // BrowserContextKeyedAPI implementation.
44 static ProfileKeyedAPIFactory<StreamsPrivateAPI>* GetFactoryInstance(); 44 static BrowserContextKeyedAPIFactory<StreamsPrivateAPI>* GetFactoryInstance();
45 45
46 // content::NotificationObserver implementation. 46 // content::NotificationObserver implementation.
47 virtual void Observe(int type, 47 virtual void Observe(int type,
48 const content::NotificationSource& source, 48 const content::NotificationSource& source,
49 const content::NotificationDetails& details) OVERRIDE; 49 const content::NotificationDetails& details) OVERRIDE;
50 50
51 private: 51 private:
52 friend class ProfileKeyedAPIFactory<StreamsPrivateAPI>; 52 friend class BrowserContextKeyedAPIFactory<StreamsPrivateAPI>;
53 typedef std::map<std::string, 53 typedef std::map<std::string,
54 std::map<GURL, 54 std::map<GURL,
55 linked_ptr<content::StreamHandle> > > StreamMap; 55 linked_ptr<content::StreamHandle> > > StreamMap;
56 56
57 // ProfileKeyedAPI implementation. 57 // BrowserContextKeyedAPI implementation.
58 static const char* service_name() { 58 static const char* service_name() {
59 return "StreamsPrivateAPI"; 59 return "StreamsPrivateAPI";
60 } 60 }
61 static const bool kServiceIsNULLWhileTesting = true; 61 static const bool kServiceIsNULLWhileTesting = true;
62 static const bool kServiceRedirectedInIncognito = true; 62 static const bool kServiceRedirectedInIncognito = true;
63 63
64 Profile* const profile_; 64 Profile* const profile_;
65 content::NotificationRegistrar registrar_; 65 content::NotificationRegistrar registrar_;
66 StreamMap streams_; 66 StreamMap streams_;
67 base::WeakPtrFactory<StreamsPrivateAPI> weak_ptr_factory_; 67 base::WeakPtrFactory<StreamsPrivateAPI> weak_ptr_factory_;
68 }; 68 };
69 69
70 } // namespace extensions 70 } // namespace extensions
71 71
72 #endif // CHROME_BROWSER_EXTENSIONS_API_STREAMS_PRIVATE_STREAMS_PRIVATE_API_H_ 72 #endif // CHROME_BROWSER_EXTENSIONS_API_STREAMS_PRIVATE_STREAMS_PRIVATE_API_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698