Chromium Code Reviews| 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_WEB_VIEW_WEB_VIEW_GUEST_H_ | 5 #ifndef EXTENSIONS_BROWSER_GUEST_VIEW_WEB_VIEW_WEB_VIEW_GUEST_H_ |
| 6 #define EXTENSIONS_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 <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "base/observer_list.h" | 13 #include "base/observer_list.h" |
| 14 #include "components/guest_view/browser/guest_view.h" | 14 #include "components/guest_view/browser/guest_view.h" |
| 15 #include "content/public/browser/javascript_dialog_manager.h" | 15 #include "content/public/browser/javascript_dialog_manager.h" |
| 16 #include "content/public/browser/notification_observer.h" | 16 #include "content/public/browser/notification_observer.h" |
| 17 #include "content/public/browser/notification_registrar.h" | 17 #include "content/public/browser/notification_registrar.h" |
| 18 #include "extensions/browser/guest_view/web_view/javascript_dialog_helper.h" | 18 #include "extensions/browser/guest_view/web_view/javascript_dialog_helper.h" |
| 19 #include "extensions/browser/guest_view/web_view/web_view_find_helper.h" | 19 #include "extensions/browser/guest_view/web_view/web_view_find_helper.h" |
| 20 #include "extensions/browser/guest_view/web_view/web_view_guest_delegate.h" | 20 #include "extensions/browser/guest_view/web_view/web_view_guest_delegate.h" |
| 21 #include "extensions/browser/guest_view/web_view/web_view_permission_helper.h" | 21 #include "extensions/browser/guest_view/web_view/web_view_permission_helper.h" |
| 22 #include "extensions/browser/guest_view/web_view/web_view_permission_types.h" | 22 #include "extensions/browser/guest_view/web_view/web_view_permission_types.h" |
| 23 #include "extensions/browser/guest_view/web_view/web_view_renderer_state.h" | |
| 23 #include "extensions/browser/script_executor.h" | 24 #include "extensions/browser/script_executor.h" |
| 24 | 25 |
| 25 namespace blink { | 26 namespace blink { |
| 26 struct WebFindOptions; | 27 struct WebFindOptions; |
| 27 } // namespace blink | 28 } // namespace blink |
| 28 | 29 |
| 29 namespace content { | 30 namespace content { |
| 30 struct GlobalRequestID; | 31 struct GlobalRequestID; |
| 32 class RequestContext; | |
| 31 } // namespace content | 33 } // namespace content |
| 32 | 34 |
| 33 namespace extensions { | 35 namespace extensions { |
| 34 | 36 |
| 35 class WebViewInternalFindFunction; | 37 class WebViewInternalFindFunction; |
| 36 | 38 |
| 37 // A WebViewGuest provides the browser-side implementation of the <webview> API | 39 // A WebViewGuest provides the browser-side implementation of the <webview> API |
| 38 // and manages the dispatch of <webview> extension events. WebViewGuest is | 40 // and manages the dispatch of <webview> extension events. WebViewGuest is |
| 39 // 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 |
| 40 // a particular embedder WebContents. This happens on either initial navigation | 42 // a particular embedder WebContents. This happens on either initial navigation |
| (...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 314 // Creates a new guest window owned by this WebViewGuest. | 316 // Creates a new guest window owned by this WebViewGuest. |
| 315 void CreateNewGuestWebViewWindow(const content::OpenURLParams& params); | 317 void CreateNewGuestWebViewWindow(const content::OpenURLParams& params); |
| 316 | 318 |
| 317 void NewGuestWebViewCallback(const content::OpenURLParams& params, | 319 void NewGuestWebViewCallback(const content::OpenURLParams& params, |
| 318 content::WebContents* guest_web_contents); | 320 content::WebContents* guest_web_contents); |
| 319 | 321 |
| 320 bool HandleKeyboardShortcuts(const content::NativeWebKeyboardEvent& event); | 322 bool HandleKeyboardShortcuts(const content::NativeWebKeyboardEvent& event); |
| 321 | 323 |
| 322 void ApplyAttributes(const base::DictionaryValue& params); | 324 void ApplyAttributes(const base::DictionaryValue& params); |
| 323 | 325 |
| 326 // Helper functions to add and remove guest processes. Invoked on the IO | |
|
jam
2016/08/02 17:01:46
ditto: just move to anonymous namespace
ananta
2016/08/02 22:28:28
Can't right now. The WebViewRendererState::AddGues
| |
| 327 // thread. | |
| 328 static void AddGuestHelper( | |
| 329 WebViewRendererState* renderer_state, | |
| 330 int guest_process_id, | |
| 331 int guest_routing_id, | |
| 332 const WebViewRendererState::WebViewInfo& web_view_info, | |
| 333 const content::ResourceContext* context); | |
| 334 | |
| 335 static void RemoveGuestHelper(WebViewRendererState* renderer_state, | |
| 336 int guest_process_id, | |
| 337 int guest_routing_id, | |
| 338 const content::ResourceContext* context); | |
| 339 | |
| 324 // Identifies the set of rules registries belonging to this guest. | 340 // Identifies the set of rules registries belonging to this guest. |
| 325 int rules_registry_id_; | 341 int rules_registry_id_; |
| 326 | 342 |
| 327 // Handles find requests and replies for the webview find API. | 343 // Handles find requests and replies for the webview find API. |
| 328 WebViewFindHelper find_helper_; | 344 WebViewFindHelper find_helper_; |
| 329 | 345 |
| 330 base::ObserverList<ScriptExecutionObserver> script_observers_; | 346 base::ObserverList<ScriptExecutionObserver> script_observers_; |
| 331 std::unique_ptr<ScriptExecutor> script_executor_; | 347 std::unique_ptr<ScriptExecutor> script_executor_; |
| 332 | 348 |
| 333 content::NotificationRegistrar notification_registrar_; | 349 content::NotificationRegistrar notification_registrar_; |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 380 // This is used to ensure pending tasks will not fire after this object is | 396 // This is used to ensure pending tasks will not fire after this object is |
| 381 // destroyed. | 397 // destroyed. |
| 382 base::WeakPtrFactory<WebViewGuest> weak_ptr_factory_; | 398 base::WeakPtrFactory<WebViewGuest> weak_ptr_factory_; |
| 383 | 399 |
| 384 DISALLOW_COPY_AND_ASSIGN(WebViewGuest); | 400 DISALLOW_COPY_AND_ASSIGN(WebViewGuest); |
| 385 }; | 401 }; |
| 386 | 402 |
| 387 } // namespace extensions | 403 } // namespace extensions |
| 388 | 404 |
| 389 #endif // EXTENSIONS_BROWSER_GUEST_VIEW_WEB_VIEW_WEB_VIEW_GUEST_H_ | 405 #endif // EXTENSIONS_BROWSER_GUEST_VIEW_WEB_VIEW_WEB_VIEW_GUEST_H_ |
| OLD | NEW |