| 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/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
| 10 #include "components/guest_view/browser/guest_view.h" | 10 #include "components/guest_view/browser/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(std::unique_ptr<content::StreamInfo> stream, |
| 26 int tab_id, | 26 int tab_id, |
| 27 bool embedded, | 27 bool embedded, |
| 28 const GURL& handler_url, | 28 const GURL& handler_url, |
| 29 const std::string& extension_id); | 29 const std::string& extension_id); |
| 30 ~StreamContainer(); | 30 ~StreamContainer(); |
| 31 | 31 |
| 32 // Aborts the stream. | 32 // Aborts the stream. |
| 33 void Abort(const base::Closure& callback); | 33 void Abort(const base::Closure& callback); |
| 34 | 34 |
| 35 base::WeakPtr<StreamContainer> GetWeakPtr(); | 35 base::WeakPtr<StreamContainer> GetWeakPtr(); |
| 36 | 36 |
| 37 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_; } | 38 bool embedded() const { return embedded_; } |
| 39 int tab_id() const { return tab_id_; } | 39 int tab_id() const { return tab_id_; } |
| 40 GURL handler_url() const { return handler_url_; } | 40 GURL handler_url() const { return handler_url_; } |
| 41 std::string extension_id() const { return extension_id_; } | 41 std::string extension_id() const { return extension_id_; } |
| 42 | 42 |
| 43 private: | 43 private: |
| 44 const scoped_ptr<content::StreamInfo> stream_; | 44 const std::unique_ptr<content::StreamInfo> stream_; |
| 45 const bool embedded_; | 45 const bool embedded_; |
| 46 const int tab_id_; | 46 const int tab_id_; |
| 47 const GURL handler_url_; | 47 const GURL handler_url_; |
| 48 const std::string extension_id_; | 48 const std::string extension_id_; |
| 49 | 49 |
| 50 base::WeakPtrFactory<StreamContainer> weak_factory_; | 50 base::WeakPtrFactory<StreamContainer> weak_factory_; |
| 51 }; | 51 }; |
| 52 | 52 |
| 53 class MimeHandlerViewGuest : | 53 class MimeHandlerViewGuest : |
| 54 public guest_view::GuestView<MimeHandlerViewGuest> { | 54 public guest_view::GuestView<MimeHandlerViewGuest> { |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 content::JavaScriptDialogManager* GetJavaScriptDialogManager( | 87 content::JavaScriptDialogManager* GetJavaScriptDialogManager( |
| 88 content::WebContents* source) final; | 88 content::WebContents* source) final; |
| 89 bool SaveFrame(const GURL& url, const content::Referrer& referrer) final; | 89 bool SaveFrame(const GURL& url, const content::Referrer& referrer) final; |
| 90 | 90 |
| 91 // content::WebContentsObserver implementation. | 91 // content::WebContentsObserver implementation. |
| 92 void DocumentOnLoadCompletedInMainFrame() final; | 92 void DocumentOnLoadCompletedInMainFrame() final; |
| 93 | 93 |
| 94 std::string view_id() const { return view_id_; } | 94 std::string view_id() const { return view_id_; } |
| 95 base::WeakPtr<StreamContainer> GetStream() const; | 95 base::WeakPtr<StreamContainer> GetStream() const; |
| 96 | 96 |
| 97 scoped_ptr<MimeHandlerViewGuestDelegate> delegate_; | 97 std::unique_ptr<MimeHandlerViewGuestDelegate> delegate_; |
| 98 scoped_ptr<StreamContainer> stream_; | 98 std::unique_ptr<StreamContainer> stream_; |
| 99 std::string view_id_; | 99 std::string view_id_; |
| 100 | 100 |
| 101 DISALLOW_COPY_AND_ASSIGN(MimeHandlerViewGuest); | 101 DISALLOW_COPY_AND_ASSIGN(MimeHandlerViewGuest); |
| 102 }; | 102 }; |
| 103 | 103 |
| 104 } // namespace extensions | 104 } // namespace extensions |
| 105 | 105 |
| 106 #endif // EXTENSIONS_BROWSER_GUEST_VIEW_MIME_HANDLER_VIEW_MIME_HANDLER_VIEW_GUE
ST_H_ | 106 #endif // EXTENSIONS_BROWSER_GUEST_VIEW_MIME_HANDLER_VIEW_MIME_HANDLER_VIEW_GUE
ST_H_ |
| OLD | NEW |