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

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

Issue 244473002: Remove NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED from c/b/e/api (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 8 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
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>
11 10
12 #include "base/values.h" 11 #include "base/scoped_observer.h"
13 #include "components/keyed_service/core/keyed_service.h"
14 #include "content/public/browser/notification_observer.h"
15 #include "content/public/browser/notification_registrar.h"
16 #include "extensions/browser/browser_context_keyed_api_factory.h" 12 #include "extensions/browser/browser_context_keyed_api_factory.h"
17 #include "extensions/browser/extension_function.h" 13 #include "extensions/browser/extension_function.h"
18 #include "extensions/common/extension.h" 14 #include "extensions/browser/extension_registry_observer.h"
19
20 class Profile;
21 15
22 namespace content { 16 namespace content {
23 class BrowserContext; 17 class BrowserContext;
24 class StreamHandle; 18 class StreamHandle;
25 } 19 }
26 20
27 namespace extensions { 21 namespace extensions {
22 class ExtensionRegistry;
28 23
29 class StreamsPrivateAPI : public BrowserContextKeyedAPI, 24 class StreamsPrivateAPI : public BrowserContextKeyedAPI,
30 public content::NotificationObserver { 25 public ExtensionRegistryObserver {
31 public: 26 public:
32 // Convenience method to get the StreamsPrivateAPI for a profile. 27 // Convenience method to get the StreamsPrivateAPI for a BrowserContext.
33 static StreamsPrivateAPI* Get(content::BrowserContext* context); 28 static StreamsPrivateAPI* Get(content::BrowserContext* context);
34 29
35 explicit StreamsPrivateAPI(content::BrowserContext* context); 30 explicit StreamsPrivateAPI(content::BrowserContext* context);
36 virtual ~StreamsPrivateAPI(); 31 virtual ~StreamsPrivateAPI();
37 32
38 void ExecuteMimeTypeHandler(const std::string& extension_id, 33 void ExecuteMimeTypeHandler(const std::string& extension_id,
39 const content::WebContents* web_contents, 34 const content::WebContents* web_contents,
40 scoped_ptr<content::StreamHandle> stream, 35 scoped_ptr<content::StreamHandle> stream,
41 int64 expected_content_size); 36 int64 expected_content_size);
42 37
43 // BrowserContextKeyedAPI implementation. 38 // BrowserContextKeyedAPI implementation.
44 static BrowserContextKeyedAPIFactory<StreamsPrivateAPI>* GetFactoryInstance(); 39 static BrowserContextKeyedAPIFactory<StreamsPrivateAPI>* GetFactoryInstance();
45 40
46 // content::NotificationObserver implementation.
47 virtual void Observe(int type,
48 const content::NotificationSource& source,
49 const content::NotificationDetails& details) OVERRIDE;
50
51 private: 41 private:
52 friend class BrowserContextKeyedAPIFactory<StreamsPrivateAPI>; 42 friend class BrowserContextKeyedAPIFactory<StreamsPrivateAPI>;
53 typedef std::map<std::string, 43 typedef std::map<std::string,
54 std::map<GURL, 44 std::map<GURL,
55 linked_ptr<content::StreamHandle> > > StreamMap; 45 linked_ptr<content::StreamHandle> > > StreamMap;
56 46
47 // ExtensionRegistryObserver implementation.
48 virtual void OnExtensionUnloaded(
49 content::BrowserContext* browser_context,
50 const Extension* extension,
51 UnloadedExtensionInfo::Reason reason) OVERRIDE;
52
57 // BrowserContextKeyedAPI implementation. 53 // BrowserContextKeyedAPI implementation.
58 static const char* service_name() { 54 static const char* service_name() {
59 return "StreamsPrivateAPI"; 55 return "StreamsPrivateAPI";
60 } 56 }
61 static const bool kServiceIsNULLWhileTesting = true; 57 static const bool kServiceIsNULLWhileTesting = true;
62 static const bool kServiceRedirectedInIncognito = true; 58 static const bool kServiceRedirectedInIncognito = true;
63 59
64 Profile* const profile_; 60 content::BrowserContext* const browser_context_;
65 content::NotificationRegistrar registrar_;
66 StreamMap streams_; 61 StreamMap streams_;
67 base::WeakPtrFactory<StreamsPrivateAPI> weak_ptr_factory_; 62 base::WeakPtrFactory<StreamsPrivateAPI> weak_ptr_factory_;
63
64 // Listen to extension unloaded notifications.
65 ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver>
66 scoped_extension_registry_observer_;
68 }; 67 };
69 68
70 } // namespace extensions 69 } // namespace extensions
71 70
72 #endif // CHROME_BROWSER_EXTENSIONS_API_STREAMS_PRIVATE_STREAMS_PRIVATE_API_H_ 71 #endif // CHROME_BROWSER_EXTENSIONS_API_STREAMS_PRIVATE_STREAMS_PRIVATE_API_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698