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 |
37 void AddStream(const std::string& view_id, | 38 void AddStream(const std::string& view_id, |
38 std::unique_ptr<StreamContainer> stream, | 39 std::unique_ptr<StreamContainer> stream, |
40 content::WebContents* web_contents, | |
jam
2016/09/14 22:49:52
why are we passing both WC & RF IDs? it seems we s
ananta
2016/09/15 01:49:17
Done. As per our discussion, I changed the Embedde
| |
39 int render_process_id, | 41 int render_process_id, |
40 int render_frame_id); | 42 int render_frame_id); |
41 | 43 |
42 std::unique_ptr<StreamContainer> ReleaseStream(const std::string& view_id); | 44 std::unique_ptr<StreamContainer> ReleaseStream(const std::string& view_id); |
43 | 45 |
44 // ExtensionRegistryObserver override. | 46 // ExtensionRegistryObserver override. |
45 void OnExtensionUnloaded(content::BrowserContext* browser_context, | 47 void OnExtensionUnloaded(content::BrowserContext* browser_context, |
46 const Extension* extension, | 48 const Extension* extension, |
47 UnloadedExtensionInfo::Reason reason) override; | 49 UnloadedExtensionInfo::Reason reason) override; |
48 | 50 |
(...skipping 12 matching lines...) Expand all Loading... | |
61 // EmbedderObserver until it is removed. | 63 // EmbedderObserver until it is removed. |
62 std::map<std::string, std::unique_ptr<EmbedderObserver>> embedder_observers_; | 64 std::map<std::string, std::unique_ptr<EmbedderObserver>> embedder_observers_; |
63 | 65 |
64 ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver> | 66 ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver> |
65 extension_registry_observer_; | 67 extension_registry_observer_; |
66 }; | 68 }; |
67 | 69 |
68 } // namespace extensions | 70 } // namespace extensions |
69 | 71 |
70 #endif // EXTENSIONS_BROWSER_GUEST_VIEW_MIME_HANDLER_VIEW_MIME_HANDLER_STREAM_M ANAGER_H_ | 72 #endif // EXTENSIONS_BROWSER_GUEST_VIEW_MIME_HANDLER_VIEW_MIME_HANDLER_STREAM_M ANAGER_H_ |
OLD | NEW |