| 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 EXTENSIONS_BROWSER_GUEST_VIEW_WEB_VIEW_WEB_VIEW_GUEST_H_ |
| 6 #define CHROME_BROWSER_GUEST_VIEW_WEB_VIEW_WEB_VIEW_GUEST_H_ | 6 #define EXTENSIONS_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/guest_view/web_view/javascript_dialog_helper.h" | |
| 12 #include "chrome/browser/guest_view/web_view/web_view_find_helper.h" | |
| 13 #include "chrome/browser/guest_view/web_view/web_view_permission_helper.h" | |
| 14 #include "chrome/browser/guest_view/web_view/web_view_permission_types.h" | |
| 15 #include "content/public/browser/javascript_dialog_manager.h" | 11 #include "content/public/browser/javascript_dialog_manager.h" |
| 16 #include "content/public/browser/notification_observer.h" | 12 #include "content/public/browser/notification_observer.h" |
| 17 #include "content/public/browser/notification_registrar.h" | 13 #include "content/public/browser/notification_registrar.h" |
| 18 #include "extensions/browser/guest_view/guest_view.h" | 14 #include "extensions/browser/guest_view/guest_view.h" |
| 15 #include "extensions/browser/guest_view/web_view/javascript_dialog_helper.h" |
| 19 #include "extensions/browser/guest_view/web_view/web_view_guest_delegate.h" | 16 #include "extensions/browser/guest_view/web_view/web_view_guest_delegate.h" |
| 17 #include "extensions/browser/guest_view/web_view/web_view_permission_helper.h" |
| 18 #include "extensions/browser/guest_view/web_view/web_view_permission_types.h" |
| 20 #include "extensions/browser/script_executor.h" | 19 #include "extensions/browser/script_executor.h" |
| 21 #include "third_party/WebKit/public/web/WebFindOptions.h" | 20 |
| 21 namespace blink { |
| 22 struct WebFindOptions; |
| 23 } // nanespace blink |
| 22 | 24 |
| 23 namespace extensions { | 25 namespace extensions { |
| 24 | 26 |
| 25 class WebViewInternalFindFunction; | 27 class WebViewInternalFindFunction; |
| 26 | 28 |
| 27 // A WebViewGuest provides the browser-side implementation of the <webview> API | 29 // A WebViewGuest provides the browser-side implementation of the <webview> API |
| 28 // and manages the dispatch of <webview> extension events. WebViewGuest is | 30 // and manages the dispatch of <webview> extension events. WebViewGuest is |
| 29 // created on attachment. That is, when a guest WebContents is associated with | 31 // created on attachment. That is, when a guest WebContents is associated with |
| 30 // a particular embedder WebContents. This happens on either initial navigation | 32 // a particular embedder WebContents. This happens on either initial navigation |
| 31 // or through the use of the New Window API, when a new window is attached to | 33 // or through the use of the New Window API, when a new window is attached to |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 const content::NotificationSource& source, | 160 const content::NotificationSource& source, |
| 159 const content::NotificationDetails& details) OVERRIDE; | 161 const content::NotificationDetails& details) OVERRIDE; |
| 160 | 162 |
| 161 // Returns the current zoom factor. | 163 // Returns the current zoom factor. |
| 162 double GetZoom(); | 164 double GetZoom(); |
| 163 | 165 |
| 164 // Begin or continue a find request. | 166 // Begin or continue a find request. |
| 165 void Find( | 167 void Find( |
| 166 const base::string16& search_text, | 168 const base::string16& search_text, |
| 167 const blink::WebFindOptions& options, | 169 const blink::WebFindOptions& options, |
| 168 scoped_refptr<WebViewInternalFindFunction> find_function); | 170 WebViewInternalFindFunction* find_function); |
| 169 | 171 |
| 170 // Conclude a find request to clear highlighting. | 172 // Conclude a find request to clear highlighting. |
| 171 void StopFinding(content::StopFindAction); | 173 void StopFinding(content::StopFindAction); |
| 172 | 174 |
| 173 // If possible, navigate the guest to |relative_index| entries away from the | 175 // If possible, navigate the guest to |relative_index| entries away from the |
| 174 // current navigation entry. | 176 // current navigation entry. |
| 175 void Go(int relative_index); | 177 void Go(int relative_index); |
| 176 | 178 |
| 177 // Reload the guest. | 179 // Reload the guest. |
| 178 void Reload(); | 180 void Reload(); |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 316 scoped_ptr<ScriptExecutor> script_executor_; | 318 scoped_ptr<ScriptExecutor> script_executor_; |
| 317 | 319 |
| 318 content::NotificationRegistrar notification_registrar_; | 320 content::NotificationRegistrar notification_registrar_; |
| 319 | 321 |
| 320 // True if the user agent is overridden. | 322 // True if the user agent is overridden. |
| 321 bool is_overriding_user_agent_; | 323 bool is_overriding_user_agent_; |
| 322 | 324 |
| 323 // Stores the window name of the main frame of the guest. | 325 // Stores the window name of the main frame of the guest. |
| 324 std::string name_; | 326 std::string name_; |
| 325 | 327 |
| 326 // Handles find requests and replies for the webview find API. | |
| 327 WebViewFindHelper find_helper_; | |
| 328 | |
| 329 // Handles the JavaScript dialog requests. | 328 // Handles the JavaScript dialog requests. |
| 330 JavaScriptDialogHelper javascript_dialog_helper_; | 329 JavaScriptDialogHelper javascript_dialog_helper_; |
| 331 | 330 |
| 332 // Handels permission requests. | 331 // Handels permission requests. |
| 333 scoped_ptr<WebViewPermissionHelper> web_view_permission_helper_; | 332 scoped_ptr<WebViewPermissionHelper> web_view_permission_helper_; |
| 334 | 333 |
| 335 scoped_ptr<WebViewGuestDelegate> web_view_guest_delegate_; | 334 scoped_ptr<WebViewGuestDelegate> web_view_guest_delegate_; |
| 336 | 335 |
| 337 friend void WebViewFindHelper::DispatchFindUpdateEvent(bool canceled, | |
| 338 bool final_update); | |
| 339 | |
| 340 // Tracks the name, and target URL of the new window. Once the first | 336 // Tracks the name, and target URL of the new window. Once the first |
| 341 // navigation commits, we no longer track this information. | 337 // navigation commits, we no longer track this information. |
| 342 struct NewWindowInfo { | 338 struct NewWindowInfo { |
| 343 GURL url; | 339 GURL url; |
| 344 std::string name; | 340 std::string name; |
| 345 bool changed; | 341 bool changed; |
| 346 NewWindowInfo(const GURL& url, const std::string& name) : | 342 NewWindowInfo(const GURL& url, const std::string& name) : |
| 347 url(url), | 343 url(url), |
| 348 name(name), | 344 name(name), |
| 349 changed(false) {} | 345 changed(false) {} |
| 350 }; | 346 }; |
| 351 | 347 |
| 352 typedef std::map<WebViewGuest*, NewWindowInfo> PendingWindowMap; | 348 typedef std::map<WebViewGuest*, NewWindowInfo> PendingWindowMap; |
| 353 PendingWindowMap pending_new_windows_; | 349 PendingWindowMap pending_new_windows_; |
| 354 | 350 |
| 355 DISALLOW_COPY_AND_ASSIGN(WebViewGuest); | 351 DISALLOW_COPY_AND_ASSIGN(WebViewGuest); |
| 356 }; | 352 }; |
| 357 | 353 |
| 358 } // namespace extensions | 354 } // namespace extensions |
| 359 | 355 |
| 360 #endif // CHROME_BROWSER_GUEST_VIEW_WEB_VIEW_WEB_VIEW_GUEST_H_ | 356 #endif // EXTENSIONS_BROWSER_GUEST_VIEW_WEB_VIEW_WEB_VIEW_GUEST_H_ |
| OLD | NEW |