OLD | NEW |
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 <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <map> | 10 #include <map> |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 | 55 |
56 void AbortStream(const std::string& extension_id, | 56 void AbortStream(const std::string& extension_id, |
57 const GURL& stream_url, | 57 const GURL& stream_url, |
58 const base::Closure& callback); | 58 const base::Closure& callback); |
59 | 59 |
60 // BrowserContextKeyedAPI implementation. | 60 // BrowserContextKeyedAPI implementation. |
61 static BrowserContextKeyedAPIFactory<StreamsPrivateAPI>* GetFactoryInstance(); | 61 static BrowserContextKeyedAPIFactory<StreamsPrivateAPI>* GetFactoryInstance(); |
62 | 62 |
63 private: | 63 private: |
64 friend class BrowserContextKeyedAPIFactory<StreamsPrivateAPI>; | 64 friend class BrowserContextKeyedAPIFactory<StreamsPrivateAPI>; |
65 typedef std::map<std::string, | |
66 std::map<GURL, | |
67 linked_ptr<content::StreamHandle> > > StreamMap; | |
68 | 65 |
69 // ExtensionRegistryObserver implementation. | 66 // ExtensionRegistryObserver implementation. |
70 void OnExtensionUnloaded(content::BrowserContext* browser_context, | 67 void OnExtensionUnloaded(content::BrowserContext* browser_context, |
71 const Extension* extension, | 68 const Extension* extension, |
72 UnloadedExtensionInfo::Reason reason) override; | 69 UnloadedExtensionInfo::Reason reason) override; |
73 | 70 |
74 // BrowserContextKeyedAPI implementation. | 71 // BrowserContextKeyedAPI implementation. |
75 static const char* service_name() { | 72 static const char* service_name() { |
76 return "StreamsPrivateAPI"; | 73 return "StreamsPrivateAPI"; |
77 } | 74 } |
78 static const bool kServiceIsNULLWhileTesting = true; | 75 static const bool kServiceIsNULLWhileTesting = true; |
79 static const bool kServiceRedirectedInIncognito = true; | 76 static const bool kServiceRedirectedInIncognito = true; |
80 | 77 |
81 content::BrowserContext* const browser_context_; | 78 content::BrowserContext* const browser_context_; |
| 79 using StreamMap = |
| 80 std::map<std::string, |
| 81 std::map<GURL, std::unique_ptr<content::StreamHandle>>>; |
82 StreamMap streams_; | 82 StreamMap streams_; |
83 | 83 |
84 // Listen to extension unloaded notifications. | 84 // Listen to extension unloaded notifications. |
85 ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver> | 85 ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver> |
86 extension_registry_observer_; | 86 extension_registry_observer_; |
87 | 87 |
88 base::WeakPtrFactory<StreamsPrivateAPI> weak_ptr_factory_; | 88 base::WeakPtrFactory<StreamsPrivateAPI> weak_ptr_factory_; |
89 | 89 |
90 }; | 90 }; |
91 | 91 |
(...skipping 10 matching lines...) Expand all Loading... |
102 | 102 |
103 private: | 103 private: |
104 void OnClose(); | 104 void OnClose(); |
105 | 105 |
106 std::string stream_url_; | 106 std::string stream_url_; |
107 }; | 107 }; |
108 | 108 |
109 } // namespace extensions | 109 } // namespace extensions |
110 | 110 |
111 #endif // CHROME_BROWSER_EXTENSIONS_API_STREAMS_PRIVATE_STREAMS_PRIVATE_API_H_ | 111 #endif // CHROME_BROWSER_EXTENSIONS_API_STREAMS_PRIVATE_STREAMS_PRIVATE_API_H_ |
OLD | NEW |