| 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 "components/guest_view/browser/guest_view.h" | 9 #include "components/guest_view/browser/guest_view.h" |
| 10 #include "extensions/browser/extension_function_dispatcher.h" | |
| 11 | 10 |
| 12 namespace content { | 11 namespace content { |
| 13 class WebContents; | 12 class WebContents; |
| 14 struct ContextMenuParams; | 13 struct ContextMenuParams; |
| 15 struct StreamInfo; | 14 struct StreamInfo; |
| 16 } // namespace content | 15 } // namespace content |
| 17 | 16 |
| 18 namespace extensions { | 17 namespace extensions { |
| 19 class MimeHandlerViewGuestDelegate; | 18 class MimeHandlerViewGuestDelegate; |
| 20 | 19 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 43 private: | 42 private: |
| 44 const scoped_ptr<content::StreamInfo> stream_; | 43 const scoped_ptr<content::StreamInfo> stream_; |
| 45 const bool embedded_; | 44 const bool embedded_; |
| 46 const int tab_id_; | 45 const int tab_id_; |
| 47 const GURL handler_url_; | 46 const GURL handler_url_; |
| 48 const std::string extension_id_; | 47 const std::string extension_id_; |
| 49 | 48 |
| 50 base::WeakPtrFactory<StreamContainer> weak_factory_; | 49 base::WeakPtrFactory<StreamContainer> weak_factory_; |
| 51 }; | 50 }; |
| 52 | 51 |
| 53 class MimeHandlerViewGuest : public guest_view::GuestView<MimeHandlerViewGuest>, | 52 class MimeHandlerViewGuest : |
| 54 public ExtensionFunctionDispatcher::Delegate { | 53 public guest_view::GuestView<MimeHandlerViewGuest> { |
| 55 public: | 54 public: |
| 56 static guest_view::GuestViewBase* Create( | 55 static guest_view::GuestViewBase* Create( |
| 57 content::WebContents* owner_web_contents); | 56 content::WebContents* owner_web_contents); |
| 58 | 57 |
| 59 static const char Type[]; | 58 static const char Type[]; |
| 60 | 59 |
| 61 // ExtensionFunctionDispatcher::Delegate implementation. | |
| 62 WindowController* GetExtensionWindowController() const override; | |
| 63 content::WebContents* GetAssociatedWebContents() const override; | |
| 64 | |
| 65 // GuestViewBase implementation. | 60 // GuestViewBase implementation. |
| 66 const char* GetAPINamespace() const override; | 61 const char* GetAPINamespace() const override; |
| 67 int GetTaskPrefix() const override; | 62 int GetTaskPrefix() const override; |
| 68 void CreateWebContents(const base::DictionaryValue& create_params, | 63 void CreateWebContents(const base::DictionaryValue& create_params, |
| 69 const WebContentsCreatedCallback& callback) override; | 64 const WebContentsCreatedCallback& callback) override; |
| 70 void DidAttachToEmbedder() override; | 65 void DidAttachToEmbedder() override; |
| 71 void DidInitialize(const base::DictionaryValue& create_params) override; | 66 void DidInitialize(const base::DictionaryValue& create_params) override; |
| 72 bool ZoomPropagatesFromEmbedderToGuest() const override; | 67 bool ZoomPropagatesFromEmbedderToGuest() const override; |
| 73 | 68 |
| 74 // content::BrowserPluginGuestDelegate implementation | 69 // content::BrowserPluginGuestDelegate implementation |
| (...skipping 14 matching lines...) Expand all Loading... |
| 89 void FindReply(content::WebContents* web_contents, | 84 void FindReply(content::WebContents* web_contents, |
| 90 int request_id, | 85 int request_id, |
| 91 int number_of_matches, | 86 int number_of_matches, |
| 92 const gfx::Rect& selection_rect, | 87 const gfx::Rect& selection_rect, |
| 93 int active_match_ordinal, | 88 int active_match_ordinal, |
| 94 bool final_update) override; | 89 bool final_update) override; |
| 95 bool SaveFrame(const GURL& url, const content::Referrer& referrer) override; | 90 bool SaveFrame(const GURL& url, const content::Referrer& referrer) override; |
| 96 | 91 |
| 97 // content::WebContentsObserver implementation. | 92 // content::WebContentsObserver implementation. |
| 98 void DocumentOnLoadCompletedInMainFrame() override; | 93 void DocumentOnLoadCompletedInMainFrame() override; |
| 99 bool OnMessageReceived(const IPC::Message& message) override; | |
| 100 | 94 |
| 101 std::string view_id() const { return view_id_; } | 95 std::string view_id() const { return view_id_; } |
| 102 base::WeakPtr<StreamContainer> GetStream() const; | 96 base::WeakPtr<StreamContainer> GetStream() const; |
| 103 | 97 |
| 104 protected: | 98 protected: |
| 105 explicit MimeHandlerViewGuest(content::WebContents* owner_web_contents); | 99 explicit MimeHandlerViewGuest(content::WebContents* owner_web_contents); |
| 106 ~MimeHandlerViewGuest() override; | 100 ~MimeHandlerViewGuest() override; |
| 107 | 101 |
| 108 private: | 102 private: |
| 109 void OnRequest(const ExtensionHostMsg_Request_Params& params); | |
| 110 | |
| 111 scoped_ptr<MimeHandlerViewGuestDelegate> delegate_; | 103 scoped_ptr<MimeHandlerViewGuestDelegate> delegate_; |
| 112 scoped_ptr<ExtensionFunctionDispatcher> extension_function_dispatcher_; | |
| 113 scoped_ptr<StreamContainer> stream_; | 104 scoped_ptr<StreamContainer> stream_; |
| 114 std::string view_id_; | 105 std::string view_id_; |
| 115 | 106 |
| 116 DISALLOW_COPY_AND_ASSIGN(MimeHandlerViewGuest); | 107 DISALLOW_COPY_AND_ASSIGN(MimeHandlerViewGuest); |
| 117 }; | 108 }; |
| 118 | 109 |
| 119 } // namespace extensions | 110 } // namespace extensions |
| 120 | 111 |
| 121 #endif // EXTENSIONS_BROWSER_GUEST_VIEW_MIME_HANDLER_VIEW_MIME_HANDLER_VIEW_GUE
ST_H_ | 112 #endif // EXTENSIONS_BROWSER_GUEST_VIEW_MIME_HANDLER_VIEW_MIME_HANDLER_VIEW_GUE
ST_H_ |
| OLD | NEW |