| 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 <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 private: | 51 private: |
| 52 friend class BrowserContextKeyedAPIFactory<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 // ExtensionRegistryObserver implementation. | 57 // ExtensionRegistryObserver implementation. |
| 58 virtual void OnExtensionUnloaded( | 58 virtual void OnExtensionUnloaded( |
| 59 content::BrowserContext* browser_context, | 59 content::BrowserContext* browser_context, |
| 60 const Extension* extension, | 60 const Extension* extension, |
| 61 UnloadedExtensionInfo::Reason reason) OVERRIDE; | 61 UnloadedExtensionInfo::Reason reason) override; |
| 62 | 62 |
| 63 // BrowserContextKeyedAPI implementation. | 63 // BrowserContextKeyedAPI implementation. |
| 64 static const char* service_name() { | 64 static const char* service_name() { |
| 65 return "StreamsPrivateAPI"; | 65 return "StreamsPrivateAPI"; |
| 66 } | 66 } |
| 67 static const bool kServiceIsNULLWhileTesting = true; | 67 static const bool kServiceIsNULLWhileTesting = true; |
| 68 static const bool kServiceRedirectedInIncognito = true; | 68 static const bool kServiceRedirectedInIncognito = true; |
| 69 | 69 |
| 70 content::BrowserContext* const browser_context_; | 70 content::BrowserContext* const browser_context_; |
| 71 StreamMap streams_; | 71 StreamMap streams_; |
| 72 | 72 |
| 73 // Listen to extension unloaded notifications. | 73 // Listen to extension unloaded notifications. |
| 74 ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver> | 74 ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver> |
| 75 extension_registry_observer_; | 75 extension_registry_observer_; |
| 76 | 76 |
| 77 base::WeakPtrFactory<StreamsPrivateAPI> weak_ptr_factory_; | 77 base::WeakPtrFactory<StreamsPrivateAPI> weak_ptr_factory_; |
| 78 | 78 |
| 79 }; | 79 }; |
| 80 | 80 |
| 81 class StreamsPrivateAbortFunction : public UIThreadExtensionFunction { | 81 class StreamsPrivateAbortFunction : public UIThreadExtensionFunction { |
| 82 public: | 82 public: |
| 83 StreamsPrivateAbortFunction(); | 83 StreamsPrivateAbortFunction(); |
| 84 DECLARE_EXTENSION_FUNCTION("streamsPrivate.abort", STREAMSPRIVATE_ABORT) | 84 DECLARE_EXTENSION_FUNCTION("streamsPrivate.abort", STREAMSPRIVATE_ABORT) |
| 85 | 85 |
| 86 protected: | 86 protected: |
| 87 virtual ~StreamsPrivateAbortFunction() {} | 87 virtual ~StreamsPrivateAbortFunction() {} |
| 88 | 88 |
| 89 // ExtensionFunction: | 89 // ExtensionFunction: |
| 90 virtual ExtensionFunction::ResponseAction Run() OVERRIDE; | 90 virtual ExtensionFunction::ResponseAction Run() override; |
| 91 | 91 |
| 92 private: | 92 private: |
| 93 void OnClose(); | 93 void OnClose(); |
| 94 | 94 |
| 95 std::string stream_url_; | 95 std::string stream_url_; |
| 96 }; | 96 }; |
| 97 | 97 |
| 98 } // namespace extensions | 98 } // namespace extensions |
| 99 | 99 |
| 100 #endif // CHROME_BROWSER_EXTENSIONS_API_STREAMS_PRIVATE_STREAMS_PRIVATE_API_H_ | 100 #endif // CHROME_BROWSER_EXTENSIONS_API_STREAMS_PRIVATE_STREAMS_PRIVATE_API_H_ |
| OLD | NEW |