| 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 bool embedded, |
| 26 const GURL& handler_url, | 28 const GURL& handler_url, |
| 27 const std::string& extension_id); | 29 const std::string& extension_id); |
| 28 ~StreamContainer(); | 30 ~StreamContainer(); |
| 29 | 31 |
| 30 // Aborts the stream. | 32 // Aborts the stream. |
| 31 void Abort(); | 33 void Abort(const base::Closure& callback); |
| 32 | 34 |
| 33 base::WeakPtr<StreamContainer> GetWeakPtr(); | 35 base::WeakPtr<StreamContainer> GetWeakPtr(); |
| 34 | 36 |
| 35 const content::StreamInfo* stream_info() const { return stream_.get(); } | 37 const content::StreamInfo* stream_info() const { return stream_.get(); } |
| 38 bool embedded() const { return embedded_; } |
| 39 int tab_id() const { return tab_id_; } |
| 36 GURL handler_url() const { return handler_url_; } | 40 GURL handler_url() const { return handler_url_; } |
| 37 std::string extension_id() const { return extension_id_; } | 41 std::string extension_id() const { return extension_id_; } |
| 38 | 42 |
| 39 private: | 43 private: |
| 40 const scoped_ptr<content::StreamInfo> stream_; | 44 const scoped_ptr<content::StreamInfo> stream_; |
| 45 const bool embedded_; |
| 46 const int tab_id_; |
| 41 const GURL handler_url_; | 47 const GURL handler_url_; |
| 42 const std::string extension_id_; | 48 const std::string extension_id_; |
| 43 | 49 |
| 44 base::WeakPtrFactory<StreamContainer> weak_factory_; | 50 base::WeakPtrFactory<StreamContainer> weak_factory_; |
| 45 }; | 51 }; |
| 46 | 52 |
| 47 class MimeHandlerViewGuest : public GuestView<MimeHandlerViewGuest>, | 53 class MimeHandlerViewGuest : public GuestView<MimeHandlerViewGuest>, |
| 48 public ExtensionFunctionDispatcher::Delegate { | 54 public ExtensionFunctionDispatcher::Delegate { |
| 49 public: | 55 public: |
| 50 static GuestViewBase* Create(content::BrowserContext* browser_context, | 56 static GuestViewBase* Create(content::BrowserContext* browser_context, |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 scoped_ptr<ExtensionFunctionDispatcher> extension_function_dispatcher_; | 112 scoped_ptr<ExtensionFunctionDispatcher> extension_function_dispatcher_; |
| 107 scoped_ptr<StreamContainer> stream_; | 113 scoped_ptr<StreamContainer> stream_; |
| 108 std::string view_id_; | 114 std::string view_id_; |
| 109 | 115 |
| 110 DISALLOW_COPY_AND_ASSIGN(MimeHandlerViewGuest); | 116 DISALLOW_COPY_AND_ASSIGN(MimeHandlerViewGuest); |
| 111 }; | 117 }; |
| 112 | 118 |
| 113 } // namespace extensions | 119 } // namespace extensions |
| 114 | 120 |
| 115 #endif // EXTENSIONS_BROWSER_GUEST_VIEW_MIME_HANDLER_VIEW_MIME_HANDLER_VIEW_GUE
ST_H_ | 121 #endif // EXTENSIONS_BROWSER_GUEST_VIEW_MIME_HANDLER_VIEW_MIME_HANDLER_VIEW_GUE
ST_H_ |
| OLD | NEW |