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 <vector> | 8 #include <vector> |
9 | 9 |
| 10 #include "base/callback.h" |
10 #include "base/observer_list.h" | 11 #include "base/observer_list.h" |
11 #include "content/public/browser/javascript_dialog_manager.h" | 12 #include "content/public/browser/javascript_dialog_manager.h" |
12 #include "content/public/browser/notification_observer.h" | 13 #include "content/public/browser/notification_observer.h" |
13 #include "content/public/browser/notification_registrar.h" | 14 #include "content/public/browser/notification_registrar.h" |
14 #include "extensions/browser/guest_view/guest_view.h" | 15 #include "extensions/browser/guest_view/guest_view.h" |
15 #include "extensions/browser/guest_view/web_view/javascript_dialog_helper.h" | 16 #include "extensions/browser/guest_view/web_view/javascript_dialog_helper.h" |
16 #include "extensions/browser/guest_view/web_view/web_view_find_helper.h" | 17 #include "extensions/browser/guest_view/web_view/web_view_find_helper.h" |
17 #include "extensions/browser/guest_view/web_view/web_view_guest_delegate.h" | 18 #include "extensions/browser/guest_view/web_view/web_view_guest_delegate.h" |
18 #include "extensions/browser/guest_view/web_view/web_view_permission_helper.h" | 19 #include "extensions/browser/guest_view/web_view/web_view_permission_helper.h" |
19 #include "extensions/browser/guest_view/web_view/web_view_permission_types.h" | 20 #include "extensions/browser/guest_view/web_view/web_view_permission_types.h" |
(...skipping 29 matching lines...) Expand all Loading... |
49 std::string* partition_domain, | 50 std::string* partition_domain, |
50 std::string* partition_name, | 51 std::string* partition_name, |
51 bool* in_memory); | 52 bool* in_memory); |
52 | 53 |
53 // Returns guestview::kInstanceIDNone if |contents| does not correspond to a | 54 // Returns guestview::kInstanceIDNone if |contents| does not correspond to a |
54 // WebViewGuest. | 55 // WebViewGuest. |
55 static int GetViewInstanceId(content::WebContents* contents); | 56 static int GetViewInstanceId(content::WebContents* contents); |
56 | 57 |
57 static const char Type[]; | 58 static const char Type[]; |
58 | 59 |
59 // Return the stored rules registry ID of the given webview. Will generate | 60 // Returns the stored rules registry ID of the given webview. Will generate |
60 // an ID for the first query. | 61 // an ID for the first query. |
61 static int GetOrGenerateRulesRegistryID( | 62 static int GetOrGenerateRulesRegistryID( |
62 int embedder_process_id, | 63 int embedder_process_id, |
63 int web_view_instance_id); | 64 int web_view_instance_id); |
64 | 65 |
| 66 // Returns the stored instance ID of the given guest. The instance ID is |
| 67 // unique per <webview> guest, and is used in script injection. |
| 68 // Will generate an ID for the first query. |
| 69 static int GetOrGenerateUniqueInstanceID( |
| 70 int embedder_process_id, |
| 71 int guest_instance_id); |
| 72 |
65 // Request navigating the guest to the provided |src| URL. | 73 // Request navigating the guest to the provided |src| URL. |
66 void NavigateGuest(const std::string& src, bool force_navigation); | 74 void NavigateGuest(const std::string& src, bool force_navigation); |
67 | 75 |
68 // Shows the context menu for the guest. | 76 // Shows the context menu for the guest. |
69 // |items| acts as a filter. This restricts the current context's default | 77 // |items| acts as a filter. This restricts the current context's default |
70 // menu items to contain only the items from |items|. | 78 // menu items to contain only the items from |items|. |
71 // |items| == NULL means no filtering will be applied. | 79 // |items| == NULL means no filtering will be applied. |
72 void ShowContextMenu( | 80 void ShowContextMenu( |
73 int request_id, | 81 int request_id, |
74 const WebViewGuestDelegate::MenuItemVector* items); | 82 const WebViewGuestDelegate::MenuItemVector* items); |
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
365 // This is used to ensure pending tasks will not fire after this object is | 373 // This is used to ensure pending tasks will not fire after this object is |
366 // destroyed. | 374 // destroyed. |
367 base::WeakPtrFactory<WebViewGuest> weak_ptr_factory_; | 375 base::WeakPtrFactory<WebViewGuest> weak_ptr_factory_; |
368 | 376 |
369 DISALLOW_COPY_AND_ASSIGN(WebViewGuest); | 377 DISALLOW_COPY_AND_ASSIGN(WebViewGuest); |
370 }; | 378 }; |
371 | 379 |
372 } // namespace extensions | 380 } // namespace extensions |
373 | 381 |
374 #endif // EXTENSIONS_BROWSER_GUEST_VIEW_WEB_VIEW_WEB_VIEW_GUEST_H_ | 382 #endif // EXTENSIONS_BROWSER_GUEST_VIEW_WEB_VIEW_WEB_VIEW_GUEST_H_ |
OLD | NEW |