OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_VIEW_GUEST_ H_ | 5 #ifndef EXTENSIONS_BROWSER_GUEST_VIEW_MIME_HANDLER_VIEW_MIME_HANDLER_VIEW_GUEST_ H_ |
6 #define EXTENSIONS_BROWSER_GUEST_VIEW_MIME_HANDLER_VIEW_MIME_HANDLER_VIEW_GUEST_ H_ | 6 #define EXTENSIONS_BROWSER_GUEST_VIEW_MIME_HANDLER_VIEW_MIME_HANDLER_VIEW_GUEST_ H_ |
7 | 7 |
8 #include "base/memory/weak_ptr.h" | 8 #include "base/memory/weak_ptr.h" |
9 #include "extensions/browser/extension_function_dispatcher.h" | 9 #include "extensions/browser/extension_function_dispatcher.h" |
10 #include "extensions/browser/guest_view/guest_view.h" | 10 #include "extensions/browser/guest_view/guest_view.h" |
11 | 11 |
12 namespace content { | 12 namespace content { |
13 class WebContents; | 13 class WebContents; |
14 struct ContextMenuParams; | 14 struct ContextMenuParams; |
15 struct StreamInfo; | 15 struct StreamInfo; |
16 } // namespace content | 16 } // namespace content |
17 | 17 |
18 namespace extensions { | 18 namespace extensions { |
19 class MimeHandlerViewGuestDelegate; | 19 class MimeHandlerViewGuestDelegate; |
20 | 20 |
21 // A container for a StreamHandle and any other information necessary for a | 21 // A container for a StreamHandle and any other information necessary for a |
22 // MimeHandler to handle a resource stream. | 22 // MimeHandler to handle a resource stream. |
23 class StreamContainer { | 23 class StreamContainer { |
24 public: | 24 public: |
25 StreamContainer(scoped_ptr<content::StreamInfo> stream, | 25 StreamContainer(scoped_ptr<content::StreamInfo> stream, |
26 int tab_id, | |
27 int64_t expected_content_size, | |
raymes
2015/01/12 05:26:04
I'm tempted to remove content size because I don't
Sam McNally
2015/01/12 07:13:35
Done.
| |
28 bool embedded, | |
26 const GURL& handler_url, | 29 const GURL& handler_url, |
27 const std::string& extension_id); | 30 const std::string& extension_id); |
28 ~StreamContainer(); | 31 ~StreamContainer(); |
29 | 32 |
30 // Aborts the stream. | 33 // Aborts the stream. |
31 void Abort(); | 34 void Abort(); |
32 | 35 |
33 base::WeakPtr<StreamContainer> GetWeakPtr(); | 36 base::WeakPtr<StreamContainer> GetWeakPtr(); |
34 | 37 |
35 const content::StreamInfo* stream_info() { return stream_.get(); } | 38 const content::StreamInfo* stream_info() { return stream_.get(); } |
39 bool embedded() { return embedded_; } | |
40 int64_t expected_content_size() { return expected_content_size_; } | |
41 int tab_id() { return tab_id_; } | |
36 GURL handler_url() { return handler_url_; } | 42 GURL handler_url() { return handler_url_; } |
37 std::string extension_id() { return extension_id_; } | 43 std::string extension_id() { return extension_id_; } |
38 | 44 |
39 private: | 45 private: |
40 const scoped_ptr<content::StreamInfo> stream_; | 46 const scoped_ptr<content::StreamInfo> stream_; |
47 const bool embedded_; | |
48 const int64_t expected_content_size_; | |
49 const int tab_id_; | |
41 const GURL handler_url_; | 50 const GURL handler_url_; |
42 const std::string extension_id_; | 51 const std::string extension_id_; |
43 | 52 |
44 base::WeakPtrFactory<StreamContainer> weak_factory_; | 53 base::WeakPtrFactory<StreamContainer> weak_factory_; |
45 }; | 54 }; |
46 | 55 |
47 class MimeHandlerViewGuest : public GuestView<MimeHandlerViewGuest>, | 56 class MimeHandlerViewGuest : public GuestView<MimeHandlerViewGuest>, |
48 public ExtensionFunctionDispatcher::Delegate { | 57 public ExtensionFunctionDispatcher::Delegate { |
49 public: | 58 public: |
50 static GuestViewBase* Create(content::BrowserContext* browser_context, | 59 static GuestViewBase* Create(content::BrowserContext* browser_context, |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
107 scoped_ptr<ExtensionFunctionDispatcher> extension_function_dispatcher_; | 116 scoped_ptr<ExtensionFunctionDispatcher> extension_function_dispatcher_; |
108 scoped_ptr<StreamContainer> stream_; | 117 scoped_ptr<StreamContainer> stream_; |
109 std::string view_id_; | 118 std::string view_id_; |
110 | 119 |
111 DISALLOW_COPY_AND_ASSIGN(MimeHandlerViewGuest); | 120 DISALLOW_COPY_AND_ASSIGN(MimeHandlerViewGuest); |
112 }; | 121 }; |
113 | 122 |
114 } // namespace extensions | 123 } // namespace extensions |
115 | 124 |
116 #endif // EXTENSIONS_BROWSER_GUEST_VIEW_MIME_HANDLER_VIEW_MIME_HANDLER_VIEW_GUE ST_H_ | 125 #endif // EXTENSIONS_BROWSER_GUEST_VIEW_MIME_HANDLER_VIEW_MIME_HANDLER_VIEW_GUE ST_H_ |
OLD | NEW |