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" |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 public: | 49 public: |
50 WebViewGuest(int guest_instance_id, | 50 WebViewGuest(int guest_instance_id, |
51 content::WebContents* guest_web_contents, | 51 content::WebContents* guest_web_contents, |
52 const std::string& embedder_extension_id); | 52 const std::string& embedder_extension_id); |
53 | 53 |
54 // Returns guestview::kInstanceIDNone if |contents| does not correspond to a | 54 // Returns guestview::kInstanceIDNone if |contents| does not correspond to a |
55 // WebViewGuest. | 55 // WebViewGuest. |
56 static int GetViewInstanceId(content::WebContents* contents); | 56 static int GetViewInstanceId(content::WebContents* contents); |
57 static const char Type[]; | 57 static const char Type[]; |
58 | 58 |
| 59 // Request navigating the guest to the provided |src| URL. |
| 60 void NavigateGuest(const std::string& src); |
| 61 |
59 typedef std::vector<linked_ptr<webview_api::ContextMenuItem> > MenuItemVector; | 62 typedef std::vector<linked_ptr<webview_api::ContextMenuItem> > MenuItemVector; |
60 // Shows the context menu for the guest. | 63 // Shows the context menu for the guest. |
61 // |items| acts as a filter. This restricts the current context's default | 64 // |items| acts as a filter. This restricts the current context's default |
62 // menu items to contain only the items from |items|. | 65 // menu items to contain only the items from |items|. |
63 // |items| == NULL means no filtering will be applied. | 66 // |items| == NULL means no filtering will be applied. |
64 void ShowContextMenu(int request_id, const MenuItemVector* items); | 67 void ShowContextMenu(int request_id, const MenuItemVector* items); |
65 | 68 |
66 // Sets the frame name of the guest. | 69 // Sets the frame name of the guest. |
67 void SetName(const std::string& name); | 70 void SetName(const std::string& name); |
68 | 71 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 virtual content::WebContents* OpenURLFromTab( | 123 virtual content::WebContents* OpenURLFromTab( |
121 content::WebContents* source, | 124 content::WebContents* source, |
122 const content::OpenURLParams& params) OVERRIDE; | 125 const content::OpenURLParams& params) OVERRIDE; |
123 virtual void WebContentsCreated(content::WebContents* source_contents, | 126 virtual void WebContentsCreated(content::WebContents* source_contents, |
124 int opener_render_frame_id, | 127 int opener_render_frame_id, |
125 const base::string16& frame_name, | 128 const base::string16& frame_name, |
126 const GURL& target_url, | 129 const GURL& target_url, |
127 content::WebContents* new_contents) OVERRIDE; | 130 content::WebContents* new_contents) OVERRIDE; |
128 | 131 |
129 // GuestDelegate implementation. | 132 // GuestDelegate implementation. |
130 virtual void DidAttach() OVERRIDE; | 133 virtual void DidAttach(const base::DictionaryValue& extra_params) OVERRIDE; |
131 virtual void EmbedderDestroyed() OVERRIDE; | 134 virtual void EmbedderDestroyed() OVERRIDE; |
132 virtual bool IsDragAndDropEnabled() OVERRIDE; | 135 virtual bool IsDragAndDropEnabled() OVERRIDE; |
133 virtual void SizeChanged(const gfx::Size& old_size, const gfx::Size& new_size) | 136 virtual void SizeChanged(const gfx::Size& old_size, const gfx::Size& new_size) |
134 OVERRIDE; | 137 OVERRIDE; |
135 virtual void RequestPointerLockPermission( | 138 virtual void RequestPointerLockPermission( |
136 bool user_gesture, | 139 bool user_gesture, |
137 bool last_unlocked_by_target, | 140 bool last_unlocked_by_target, |
138 const base::Callback<void(bool)>& callback) OVERRIDE; | 141 const base::Callback<void(bool)>& callback) OVERRIDE; |
139 virtual void NavigateGuest(const std::string& src) OVERRIDE; | |
140 virtual void Destroy() OVERRIDE; | 142 virtual void Destroy() OVERRIDE; |
141 | 143 |
142 // NotificationObserver implementation. | 144 // NotificationObserver implementation. |
143 virtual void Observe(int type, | 145 virtual void Observe(int type, |
144 const content::NotificationSource& source, | 146 const content::NotificationSource& source, |
145 const content::NotificationDetails& details) OVERRIDE; | 147 const content::NotificationDetails& details) OVERRIDE; |
146 | 148 |
147 // Set the zoom factor. | 149 // Set the zoom factor. |
148 virtual void SetZoom(double zoom_factor) OVERRIDE; | 150 virtual void SetZoom(double zoom_factor) OVERRIDE; |
149 | 151 |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
435 name(name) {} | 437 name(name) {} |
436 }; | 438 }; |
437 | 439 |
438 typedef std::map<WebViewGuest*, NewWindowInfo> PendingWindowMap; | 440 typedef std::map<WebViewGuest*, NewWindowInfo> PendingWindowMap; |
439 PendingWindowMap pending_new_windows_; | 441 PendingWindowMap pending_new_windows_; |
440 | 442 |
441 DISALLOW_COPY_AND_ASSIGN(WebViewGuest); | 443 DISALLOW_COPY_AND_ASSIGN(WebViewGuest); |
442 }; | 444 }; |
443 | 445 |
444 #endif // CHROME_BROWSER_GUEST_VIEW_WEB_VIEW_WEB_VIEW_GUEST_H_ | 446 #endif // CHROME_BROWSER_GUEST_VIEW_WEB_VIEW_WEB_VIEW_GUEST_H_ |
OLD | NEW |