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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 // BrowserContextKeyedAPI implementation. | 67 // BrowserContextKeyedAPI implementation. |
68 static const char* service_name() { | 68 static const char* service_name() { |
69 return "StreamsPrivateAPI"; | 69 return "StreamsPrivateAPI"; |
70 } | 70 } |
71 static const bool kServiceIsNULLWhileTesting = true; | 71 static const bool kServiceIsNULLWhileTesting = true; |
72 static const bool kServiceRedirectedInIncognito = true; | 72 static const bool kServiceRedirectedInIncognito = true; |
73 | 73 |
74 content::BrowserContext* const browser_context_; | 74 content::BrowserContext* const browser_context_; |
75 StreamMap streams_; | 75 StreamMap streams_; |
76 | 76 |
77 // The streams whose lifetimes are managed by MimeHandlerViewGuest. | |
78 std::map<std::string, | |
79 std::map<GURL, std::pair<content::WebContents*, std::string>>> | |
80 mime_handler_streams_; | |
81 | |
82 // Listen to extension unloaded notifications. | 77 // Listen to extension unloaded notifications. |
83 ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver> | 78 ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver> |
84 extension_registry_observer_; | 79 extension_registry_observer_; |
85 | 80 |
86 base::WeakPtrFactory<StreamsPrivateAPI> weak_ptr_factory_; | 81 base::WeakPtrFactory<StreamsPrivateAPI> weak_ptr_factory_; |
87 | 82 |
88 }; | 83 }; |
89 | 84 |
90 class StreamsPrivateAbortFunction : public UIThreadExtensionFunction { | 85 class StreamsPrivateAbortFunction : public UIThreadExtensionFunction { |
91 public: | 86 public: |
92 StreamsPrivateAbortFunction(); | 87 StreamsPrivateAbortFunction(); |
93 DECLARE_EXTENSION_FUNCTION("streamsPrivate.abort", STREAMSPRIVATE_ABORT) | 88 DECLARE_EXTENSION_FUNCTION("streamsPrivate.abort", STREAMSPRIVATE_ABORT) |
94 | 89 |
95 protected: | 90 protected: |
96 ~StreamsPrivateAbortFunction() override {} | 91 ~StreamsPrivateAbortFunction() override {} |
97 | 92 |
98 // ExtensionFunction: | 93 // ExtensionFunction: |
99 ExtensionFunction::ResponseAction Run() override; | 94 ExtensionFunction::ResponseAction Run() override; |
100 | 95 |
101 private: | 96 private: |
102 void OnClose(); | 97 void OnClose(); |
103 | 98 |
104 std::string stream_url_; | 99 std::string stream_url_; |
105 }; | 100 }; |
106 | 101 |
107 } // namespace extensions | 102 } // namespace extensions |
108 | 103 |
109 #endif // CHROME_BROWSER_EXTENSIONS_API_STREAMS_PRIVATE_STREAMS_PRIVATE_API_H_ | 104 #endif // CHROME_BROWSER_EXTENSIONS_API_STREAMS_PRIVATE_STREAMS_PRIVATE_API_H_ |
OLD | NEW |