| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 EXTENSIONS_BROWSER_GUEST_VIEW_MIME_HANDLER_VIEW_MIME_HANDLER_STREAM_MANA
GER_H_ | 5 #ifndef EXTENSIONS_BROWSER_GUEST_VIEW_MIME_HANDLER_VIEW_MIME_HANDLER_STREAM_MANA
GER_H_ |
| 6 #define EXTENSIONS_BROWSER_GUEST_VIEW_MIME_HANDLER_VIEW_MIME_HANDLER_STREAM_MANA
GER_H_ | 6 #define EXTENSIONS_BROWSER_GUEST_VIEW_MIME_HANDLER_VIEW_MIME_HANDLER_STREAM_MANA
GER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 // BrowserContext-keyed because mime handlers are extensions, which are | 29 // BrowserContext-keyed because mime handlers are extensions, which are |
| 30 // per-BrowserContext. | 30 // per-BrowserContext. |
| 31 class MimeHandlerStreamManager : public KeyedService, | 31 class MimeHandlerStreamManager : public KeyedService, |
| 32 public ExtensionRegistryObserver { | 32 public ExtensionRegistryObserver { |
| 33 public: | 33 public: |
| 34 MimeHandlerStreamManager(); | 34 MimeHandlerStreamManager(); |
| 35 ~MimeHandlerStreamManager() override; | 35 ~MimeHandlerStreamManager() override; |
| 36 static MimeHandlerStreamManager* Get(content::BrowserContext* context); | 36 static MimeHandlerStreamManager* Get(content::BrowserContext* context); |
| 37 | 37 |
| 38 void AddStream(const std::string& view_id, | 38 void AddStream(const std::string& view_id, |
| 39 scoped_ptr<StreamContainer> stream, | 39 std::unique_ptr<StreamContainer> stream, |
| 40 int render_process_id, | 40 int render_process_id, |
| 41 int render_frame_id); | 41 int render_frame_id); |
| 42 | 42 |
| 43 scoped_ptr<StreamContainer> ReleaseStream(const std::string& view_id); | 43 std::unique_ptr<StreamContainer> ReleaseStream(const std::string& view_id); |
| 44 | 44 |
| 45 // ExtensionRegistryObserver override. | 45 // ExtensionRegistryObserver override. |
| 46 void OnExtensionUnloaded(content::BrowserContext* browser_context, | 46 void OnExtensionUnloaded(content::BrowserContext* browser_context, |
| 47 const Extension* extension, | 47 const Extension* extension, |
| 48 UnloadedExtensionInfo::Reason reason) override; | 48 UnloadedExtensionInfo::Reason reason) override; |
| 49 | 49 |
| 50 private: | 50 private: |
| 51 class EmbedderObserver; | 51 class EmbedderObserver; |
| 52 | 52 |
| 53 // Maps view id->StreamContainer to maintain their lifetime until they are | 53 // Maps view id->StreamContainer to maintain their lifetime until they are |
| 54 // used or removed. | 54 // used or removed. |
| 55 std::map<std::string, linked_ptr<StreamContainer>> streams_; | 55 std::map<std::string, linked_ptr<StreamContainer>> streams_; |
| 56 | 56 |
| 57 // Maps extension id->view id for removing the associated streams when an | 57 // Maps extension id->view id for removing the associated streams when an |
| 58 // extension is unloaded. | 58 // extension is unloaded. |
| 59 std::map<std::string, std::set<std::string>> streams_by_extension_id_; | 59 std::map<std::string, std::set<std::string>> streams_by_extension_id_; |
| 60 | 60 |
| 61 // Maps view id->EmbedderObserver for maintaining the lifetime of the | 61 // Maps view id->EmbedderObserver for maintaining the lifetime of the |
| 62 // EmbedderObserver until it is removed. | 62 // EmbedderObserver until it is removed. |
| 63 std::map<std::string, linked_ptr<EmbedderObserver>> embedder_observers_; | 63 std::map<std::string, linked_ptr<EmbedderObserver>> embedder_observers_; |
| 64 | 64 |
| 65 ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver> | 65 ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver> |
| 66 extension_registry_observer_; | 66 extension_registry_observer_; |
| 67 }; | 67 }; |
| 68 | 68 |
| 69 } // namespace extensions | 69 } // namespace extensions |
| 70 | 70 |
| 71 #endif // EXTENSIONS_BROWSER_GUEST_VIEW_MIME_HANDLER_VIEW_MIME_HANDLER_STREAM_M
ANAGER_H_ | 71 #endif // EXTENSIONS_BROWSER_GUEST_VIEW_MIME_HANDLER_VIEW_MIME_HANDLER_STREAM_M
ANAGER_H_ |
| OLD | NEW |