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_EXTENSION_VIEW_EXTENSION_VIEW_GUEST_H_ | 5 #ifndef EXTENSIONS_BROWSER_GUEST_VIEW_EXTENSION_VIEW_EXTENSION_VIEW_GUEST_H_ |
6 #define EXTENSIONS_BROWSER_GUEST_VIEW_EXTENSION_VIEW_EXTENSION_VIEW_GUEST_H_ | 6 #define EXTENSIONS_BROWSER_GUEST_VIEW_EXTENSION_VIEW_EXTENSION_VIEW_GUEST_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.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" | 10 #include "extensions/browser/extension_function_dispatcher.h" |
11 #include "extensions/browser/guest_view/extension_view/extension_view_guest_dele
gate.h" | |
12 #include "url/gurl.h" | 11 #include "url/gurl.h" |
13 | 12 |
14 namespace content { | 13 namespace content { |
15 class BrowserContext; | 14 class BrowserContext; |
16 } | 15 } |
17 | 16 |
18 namespace extensions { | 17 namespace extensions { |
19 | 18 |
20 class ExtensionViewGuest | 19 class ExtensionViewGuest |
21 : public guest_view::GuestView<ExtensionViewGuest>, | 20 : public guest_view::GuestView<ExtensionViewGuest> { |
22 public ExtensionFunctionDispatcher::Delegate { | |
23 public: | 21 public: |
24 static const char Type[]; | 22 static const char Type[]; |
25 static guest_view::GuestViewBase* Create( | 23 static guest_view::GuestViewBase* Create( |
26 content::WebContents* owner_web_contents); | 24 content::WebContents* owner_web_contents); |
27 | 25 |
28 // Request navigating the guest to the provided |src| URL. | 26 // Request navigating the guest to the provided |src| URL. |
29 void NavigateGuest(const std::string& src, bool force_navigation); | 27 void NavigateGuest(const std::string& src, bool force_navigation); |
30 | 28 |
31 // GuestViewBase implementation. | 29 // GuestViewBase implementation. |
32 bool CanRunInDetachedState() const override; | 30 bool CanRunInDetachedState() const override; |
33 void CreateWebContents(const base::DictionaryValue& create_params, | 31 void CreateWebContents(const base::DictionaryValue& create_params, |
34 const WebContentsCreatedCallback& callback) override; | 32 const WebContentsCreatedCallback& callback) override; |
35 void DidInitialize(const base::DictionaryValue& create_params) override; | 33 void DidInitialize(const base::DictionaryValue& create_params) override; |
36 void DidAttachToEmbedder() override; | 34 void DidAttachToEmbedder() override; |
37 const char* GetAPINamespace() const override; | 35 const char* GetAPINamespace() const override; |
38 int GetTaskPrefix() const override; | 36 int GetTaskPrefix() const override; |
39 | 37 |
40 // content::WebContentsObserver implementation. | 38 // content::WebContentsObserver implementation. |
41 void DidCommitProvisionalLoadForFrame( | 39 void DidCommitProvisionalLoadForFrame( |
42 content::RenderFrameHost* render_frame_host, | 40 content::RenderFrameHost* render_frame_host, |
43 const GURL& url, | 41 const GURL& url, |
44 ui::PageTransition transition_type) override; | 42 ui::PageTransition transition_type) override; |
45 void DidNavigateMainFrame( | 43 void DidNavigateMainFrame( |
46 const content::LoadCommittedDetails& details, | 44 const content::LoadCommittedDetails& details, |
47 const content::FrameNavigateParams& params) override; | 45 const content::FrameNavigateParams& params) override; |
48 bool OnMessageReceived(const IPC::Message& message) override; | |
49 | 46 |
50 private: | 47 private: |
51 ExtensionViewGuest(content::WebContents* owner_web_contents); | 48 ExtensionViewGuest(content::WebContents* owner_web_contents); |
52 ~ExtensionViewGuest() override; | 49 ~ExtensionViewGuest() override; |
53 void OnRequest(const ExtensionHostMsg_Request_Params& params); | |
54 | 50 |
55 // Applies attributes to the extensionview. | 51 // Applies attributes to the extensionview. |
56 void ApplyAttributes(const base::DictionaryValue& params); | 52 void ApplyAttributes(const base::DictionaryValue& params); |
57 | 53 |
58 scoped_ptr<extensions::ExtensionFunctionDispatcher> | |
59 extension_function_dispatcher_; | |
60 scoped_ptr<extensions::ExtensionViewGuestDelegate> | |
61 extension_view_guest_delegate_; | |
62 GURL view_page_; | 54 GURL view_page_; |
63 GURL extension_url_; | 55 GURL extension_url_; |
64 | 56 |
65 DISALLOW_COPY_AND_ASSIGN(ExtensionViewGuest); | 57 DISALLOW_COPY_AND_ASSIGN(ExtensionViewGuest); |
66 }; | 58 }; |
67 | 59 |
68 } // namespace extensions | 60 } // namespace extensions |
69 | 61 |
70 #endif // EXTENSIONS_BROWSER_GUEST_VIEW_EXTENSION_VIEW_EXTENSION_VIEW_GUEST_H_ | 62 #endif // EXTENSIONS_BROWSER_GUEST_VIEW_EXTENSION_VIEW_EXTENSION_VIEW_GUEST_H_ |
OLD | NEW |