| 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> |
| 11 | 11 |
| 12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 13 #include "base/scoped_observer.h" | 13 #include "base/scoped_observer.h" |
| 14 #include "components/keyed_service/core/keyed_service.h" | 14 #include "components/keyed_service/core/keyed_service.h" |
| 15 #include "extensions/browser/extension_registry_observer.h" | 15 #include "extensions/browser/extension_registry_observer.h" |
| 16 | 16 |
| 17 namespace content { | 17 namespace content { |
| 18 class BrowserContext; | 18 class BrowserContext; |
| 19 class WebContents; |
| 19 } | 20 } |
| 20 | 21 |
| 21 namespace extensions { | 22 namespace extensions { |
| 22 class Extension; | 23 class Extension; |
| 23 class StreamContainer; | 24 class StreamContainer; |
| 24 | 25 |
| 25 // A container for streams that have not yet been claimed by a | 26 // A container for streams that have not yet been claimed by a |
| 26 // MimeHandlerViewGuest. If the embedding RenderFrameHost is closed or navigates | 27 // MimeHandlerViewGuest. If the embedding RenderFrameHost is closed or navigates |
| 27 // away from the resource being streamed, the stream is aborted. This is | 28 // away from the resource being streamed, the stream is aborted. This is |
| 28 // BrowserContext-keyed because mime handlers are extensions, which are | 29 // BrowserContext-keyed because mime handlers are extensions, which are |
| 29 // per-BrowserContext. | 30 // per-BrowserContext. |
| 30 class MimeHandlerStreamManager : public KeyedService, | 31 class MimeHandlerStreamManager : public KeyedService, |
| 31 public ExtensionRegistryObserver { | 32 public ExtensionRegistryObserver { |
| 32 public: | 33 public: |
| 33 MimeHandlerStreamManager(); | 34 MimeHandlerStreamManager(); |
| 34 ~MimeHandlerStreamManager() override; | 35 ~MimeHandlerStreamManager() override; |
| 35 static MimeHandlerStreamManager* Get(content::BrowserContext* context); | 36 static MimeHandlerStreamManager* Get(content::BrowserContext* context); |
| 36 | 37 |
| 38 // The |frame_tree_node_id| parameter is used for PlzNavigate for the top |
| 39 // level plugins case. (PDF, etc). If this parameter has a valid value then |
| 40 // it overrides the |render_process_id| and |render_frame_id| parameters. |
| 41 // The |render_process_id| is the id of the renderer process. |
| 42 // The |render_frame_id| is the routing id of the RenderFrameHost. |
| 37 void AddStream(const std::string& view_id, | 43 void AddStream(const std::string& view_id, |
| 38 std::unique_ptr<StreamContainer> stream, | 44 std::unique_ptr<StreamContainer> stream, |
| 45 content::WebContents* web_contents, |
| 46 int frame_tree_node_id, |
| 39 int render_process_id, | 47 int render_process_id, |
| 40 int render_frame_id); | 48 int render_frame_id); |
| 41 | 49 |
| 42 std::unique_ptr<StreamContainer> ReleaseStream(const std::string& view_id); | 50 std::unique_ptr<StreamContainer> ReleaseStream(const std::string& view_id); |
| 43 | 51 |
| 44 // ExtensionRegistryObserver override. | 52 // ExtensionRegistryObserver override. |
| 45 void OnExtensionUnloaded(content::BrowserContext* browser_context, | 53 void OnExtensionUnloaded(content::BrowserContext* browser_context, |
| 46 const Extension* extension, | 54 const Extension* extension, |
| 47 UnloadedExtensionInfo::Reason reason) override; | 55 UnloadedExtensionInfo::Reason reason) override; |
| 48 | 56 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 61 // EmbedderObserver until it is removed. | 69 // EmbedderObserver until it is removed. |
| 62 std::map<std::string, std::unique_ptr<EmbedderObserver>> embedder_observers_; | 70 std::map<std::string, std::unique_ptr<EmbedderObserver>> embedder_observers_; |
| 63 | 71 |
| 64 ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver> | 72 ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver> |
| 65 extension_registry_observer_; | 73 extension_registry_observer_; |
| 66 }; | 74 }; |
| 67 | 75 |
| 68 } // namespace extensions | 76 } // namespace extensions |
| 69 | 77 |
| 70 #endif // EXTENSIONS_BROWSER_GUEST_VIEW_MIME_HANDLER_VIEW_MIME_HANDLER_STREAM_M
ANAGER_H_ | 78 #endif // EXTENSIONS_BROWSER_GUEST_VIEW_MIME_HANDLER_VIEW_MIME_HANDLER_STREAM_M
ANAGER_H_ |
| OLD | NEW |