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 CHROME_BROWSER_GUEST_VIEW_WEB_VIEW_WEB_VIEW_GUEST_H_ | 5 #ifndef CHROME_BROWSER_GUEST_VIEW_WEB_VIEW_WEB_VIEW_GUEST_H_ |
6 #define CHROME_BROWSER_GUEST_VIEW_WEB_VIEW_WEB_VIEW_GUEST_H_ | 6 #define CHROME_BROWSER_GUEST_VIEW_WEB_VIEW_WEB_VIEW_GUEST_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/observer_list.h" | 10 #include "base/observer_list.h" |
11 #include "chrome/browser/extensions/tab_helper.h" | 11 #include "chrome/browser/extensions/tab_helper.h" |
12 #include "chrome/browser/guest_view/guest_view.h" | 12 #include "chrome/browser/guest_view/guest_view.h" |
13 #include "chrome/browser/guest_view/web_view/javascript_dialog_helper.h" | 13 #include "chrome/browser/guest_view/web_view/javascript_dialog_helper.h" |
14 #include "chrome/browser/guest_view/web_view/web_view_find_helper.h" | 14 #include "chrome/browser/guest_view/web_view/web_view_find_helper.h" |
15 #include "chrome/browser/guest_view/web_view/web_view_permission_types.h" | 15 #include "chrome/browser/guest_view/web_view/web_view_permission_types.h" |
16 #include "chrome/common/extensions/api/webview.h" | 16 #include "chrome/common/extensions/api/webview.h" |
17 #include "content/public/browser/javascript_dialog_manager.h" | 17 #include "content/public/browser/javascript_dialog_manager.h" |
18 #include "content/public/browser/notification_registrar.h" | 18 #include "content/public/browser/notification_registrar.h" |
19 #include "content/public/browser/web_contents_observer.h" | |
20 #include "third_party/WebKit/public/web/WebFindOptions.h" | 19 #include "third_party/WebKit/public/web/WebFindOptions.h" |
21 | 20 |
22 #if defined(OS_CHROMEOS) | 21 #if defined(OS_CHROMEOS) |
23 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" | 22 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" |
24 #endif | 23 #endif |
25 | 24 |
26 namespace webview_api = extensions::api::webview; | 25 namespace webview_api = extensions::api::webview; |
27 | 26 |
28 class RenderViewContextMenu; | 27 class RenderViewContextMenu; |
29 | 28 |
30 namespace extensions { | 29 namespace extensions { |
31 class ScriptExecutor; | 30 class ScriptExecutor; |
32 class WebviewFindFunction; | 31 class WebviewFindFunction; |
33 } // namespace extensions | 32 } // namespace extensions |
34 | 33 |
35 namespace ui { | 34 namespace ui { |
36 class SimpleMenuModel; | 35 class SimpleMenuModel; |
37 } // namespace ui | 36 } // namespace ui |
38 | 37 |
39 // A WebViewGuest is a WebContentsObserver on the guest WebContents of a | 38 // A WebViewGuest is a WebContentsObserver on the guest WebContents of a |
lazyboy
2014/05/29 19:13:58
Need to update this, WVGuest is no longer a WCObse
Fady Samuel
2014/05/29 21:21:12
Done.
| |
40 // <webview> tag. It provides the browser-side implementation of the <webview> | 39 // <webview> tag. It provides the browser-side implementation of the <webview> |
41 // API and manages the lifetime of <webview> extension events. WebViewGuest is | 40 // API and manages the lifetime of <webview> extension events. WebViewGuest is |
42 // created on attachment. That is, when a guest WebContents is associated with | 41 // created on attachment. That is, when a guest WebContents is associated with |
43 // a particular embedder WebContents. This happens on either initial navigation | 42 // a particular embedder WebContents. This happens on either initial navigation |
44 // or through the use of the New Window API, when a new window is attached to | 43 // or through the use of the New Window API, when a new window is attached to |
45 // a particular <webview>. | 44 // a particular <webview>. |
46 class WebViewGuest : public GuestView<WebViewGuest>, | 45 class WebViewGuest : public GuestView<WebViewGuest>, |
47 public content::NotificationObserver, | 46 public content::NotificationObserver { |
48 public content::WebContentsObserver { | |
49 public: | 47 public: |
50 WebViewGuest(int guest_instance_id, | 48 WebViewGuest(int guest_instance_id, |
51 content::WebContents* guest_web_contents, | 49 content::WebContents* guest_web_contents, |
52 const std::string& embedder_extension_id); | 50 const std::string& embedder_extension_id); |
53 | 51 |
54 // Returns guestview::kInstanceIDNone if |contents| does not correspond to a | 52 // Returns guestview::kInstanceIDNone if |contents| does not correspond to a |
55 // WebViewGuest. | 53 // WebViewGuest. |
56 static int GetViewInstanceId(content::WebContents* contents); | 54 static int GetViewInstanceId(content::WebContents* contents); |
57 static const char Type[]; | 55 static const char Type[]; |
58 | 56 |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
121 content::WebContents* source, | 119 content::WebContents* source, |
122 const content::OpenURLParams& params) OVERRIDE; | 120 const content::OpenURLParams& params) OVERRIDE; |
123 virtual void WebContentsCreated(content::WebContents* source_contents, | 121 virtual void WebContentsCreated(content::WebContents* source_contents, |
124 int opener_render_frame_id, | 122 int opener_render_frame_id, |
125 const base::string16& frame_name, | 123 const base::string16& frame_name, |
126 const GURL& target_url, | 124 const GURL& target_url, |
127 content::WebContents* new_contents) OVERRIDE; | 125 content::WebContents* new_contents) OVERRIDE; |
128 | 126 |
129 // GuestDelegate implementation. | 127 // GuestDelegate implementation. |
130 virtual void DidAttach() OVERRIDE; | 128 virtual void DidAttach() OVERRIDE; |
131 virtual void EmbedderDestroyed() OVERRIDE; | 129 virtual void EmbedderDestroyed() OVERRIDE; |
lazyboy
2014/05/29 19:13:58
This is a GVBase override now, move it to separate
Fady Samuel
2014/05/29 21:21:12
Done.
| |
132 virtual bool IsDragAndDropEnabled() OVERRIDE; | 130 virtual bool IsDragAndDropEnabled() OVERRIDE; |
133 virtual void SizeChanged(const gfx::Size& old_size, const gfx::Size& new_size) | 131 virtual void SizeChanged(const gfx::Size& old_size, const gfx::Size& new_size) |
134 OVERRIDE; | 132 OVERRIDE; |
135 virtual void RequestPointerLockPermission( | 133 virtual void RequestPointerLockPermission( |
136 bool user_gesture, | 134 bool user_gesture, |
137 bool last_unlocked_by_target, | 135 bool last_unlocked_by_target, |
138 const base::Callback<void(bool)>& callback) OVERRIDE; | 136 const base::Callback<void(bool)>& callback) OVERRIDE; |
139 virtual void NavigateGuest(const std::string& src) OVERRIDE; | 137 virtual void NavigateGuest(const std::string& src) OVERRIDE; |
140 virtual void Destroy() OVERRIDE; | 138 virtual void Destroy() OVERRIDE; |
141 | 139 |
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
435 name(name) {} | 433 name(name) {} |
436 }; | 434 }; |
437 | 435 |
438 typedef std::map<WebViewGuest*, NewWindowInfo> PendingWindowMap; | 436 typedef std::map<WebViewGuest*, NewWindowInfo> PendingWindowMap; |
439 PendingWindowMap pending_new_windows_; | 437 PendingWindowMap pending_new_windows_; |
440 | 438 |
441 DISALLOW_COPY_AND_ASSIGN(WebViewGuest); | 439 DISALLOW_COPY_AND_ASSIGN(WebViewGuest); |
442 }; | 440 }; |
443 | 441 |
444 #endif // CHROME_BROWSER_GUEST_VIEW_WEB_VIEW_WEB_VIEW_GUEST_H_ | 442 #endif // CHROME_BROWSER_GUEST_VIEW_WEB_VIEW_WEB_VIEW_GUEST_H_ |
OLD | NEW |