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 <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/observer_list.h" | 10 #include "base/observer_list.h" |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 50 std::string* partition_domain, | 50 std::string* partition_domain, |
| 51 std::string* partition_name, | 51 std::string* partition_name, |
| 52 bool* in_memory); | 52 bool* in_memory); |
| 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 | 57 |
| 58 static const char Type[]; | 58 static const char Type[]; |
| 59 | 59 |
| 60 // Return the stored rules registry ID of the given webview. Will generate | |
| 61 // an ID for the first query. | |
| 62 static int GetOrGenerateRulesRegistryID( | |
| 63 int embedder_process_id, | |
| 64 int webview_instance_id, | |
|
Fady Samuel
2014/11/28 11:34:25
nit: web_view_instance_id to be more consistent wi
Xi Han
2014/11/28 16:12:57
Done.
| |
| 65 content::BrowserContext* browser_context); | |
| 66 | |
| 60 // Request navigating the guest to the provided |src| URL. | 67 // Request navigating the guest to the provided |src| URL. |
| 61 void NavigateGuest(const std::string& src, bool force_navigation); | 68 void NavigateGuest(const std::string& src, bool force_navigation); |
| 62 | 69 |
| 63 // Shows the context menu for the guest. | 70 // Shows the context menu for the guest. |
| 64 // |items| acts as a filter. This restricts the current context's default | 71 // |items| acts as a filter. This restricts the current context's default |
| 65 // menu items to contain only the items from |items|. | 72 // menu items to contain only the items from |items|. |
| 66 // |items| == NULL means no filtering will be applied. | 73 // |items| == NULL means no filtering will be applied. |
| 67 void ShowContextMenu( | 74 void ShowContextMenu( |
| 68 int request_id, | 75 int request_id, |
| 69 const WebViewGuestDelegate::MenuItemVector* items); | 76 const WebViewGuestDelegate::MenuItemVector* items); |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 229 // Partition data that are newer than |removal_since| will be removed. | 236 // Partition data that are newer than |removal_since| will be removed. |
| 230 // |removal_mask| corresponds to bitmask in StoragePartition::RemoveDataMask. | 237 // |removal_mask| corresponds to bitmask in StoragePartition::RemoveDataMask. |
| 231 bool ClearData(const base::Time remove_since, | 238 bool ClearData(const base::Time remove_since, |
| 232 uint32 removal_mask, | 239 uint32 removal_mask, |
| 233 const base::Closure& callback); | 240 const base::Closure& callback); |
| 234 | 241 |
| 235 ScriptExecutor* script_executor() { return script_executor_.get(); } | 242 ScriptExecutor* script_executor() { return script_executor_.get(); } |
| 236 | 243 |
| 237 private: | 244 private: |
| 238 friend class WebViewPermissionHelper; | 245 friend class WebViewPermissionHelper; |
| 246 | |
| 239 WebViewGuest(content::BrowserContext* browser_context, | 247 WebViewGuest(content::BrowserContext* browser_context, |
| 240 int guest_instance_id); | 248 int guest_instance_id); |
| 241 | 249 |
| 242 ~WebViewGuest() override; | 250 ~WebViewGuest() override; |
| 243 | 251 |
| 244 void AttachWebViewHelpers(content::WebContents* contents); | 252 void AttachWebViewHelpers(content::WebContents* contents); |
| 245 | 253 |
| 246 void OnWebViewNewWindowResponse(int new_window_instance_id, | 254 void OnWebViewNewWindowResponse(int new_window_instance_id, |
| 247 bool allow, | 255 bool allow, |
| 248 const std::string& user_input); | 256 const std::string& user_input); |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 308 // Creates a new guest window owned by this WebViewGuest. | 316 // Creates a new guest window owned by this WebViewGuest. |
| 309 void CreateNewGuestWebViewWindow(const content::OpenURLParams& params); | 317 void CreateNewGuestWebViewWindow(const content::OpenURLParams& params); |
| 310 | 318 |
| 311 void NewGuestWebViewCallback(const content::OpenURLParams& params, | 319 void NewGuestWebViewCallback(const content::OpenURLParams& params, |
| 312 content::WebContents* guest_web_contents); | 320 content::WebContents* guest_web_contents); |
| 313 | 321 |
| 314 bool HandleKeyboardShortcuts(const content::NativeWebKeyboardEvent& event); | 322 bool HandleKeyboardShortcuts(const content::NativeWebKeyboardEvent& event); |
| 315 | 323 |
| 316 void SetUpAutoSize(); | 324 void SetUpAutoSize(); |
| 317 | 325 |
| 326 // Store the ID of this webview in the RulesRegistryService. | |
|
Fady Samuel
2014/11/28 11:34:25
nit:
// Identifies the set of rules registries be
Xi Han
2014/11/28 16:12:57
Done.
| |
| 327 int rules_registry_id_; | |
| 328 | |
| 318 // Handles find requests and replies for the webview find API. | 329 // Handles find requests and replies for the webview find API. |
| 319 WebViewFindHelper find_helper_; | 330 WebViewFindHelper find_helper_; |
| 320 | 331 |
| 321 ObserverList<ScriptExecutionObserver> script_observers_; | 332 ObserverList<ScriptExecutionObserver> script_observers_; |
| 322 scoped_ptr<ScriptExecutor> script_executor_; | 333 scoped_ptr<ScriptExecutor> script_executor_; |
| 323 | 334 |
| 324 content::NotificationRegistrar notification_registrar_; | 335 content::NotificationRegistrar notification_registrar_; |
| 325 | 336 |
| 326 // True if the user agent is overridden. | 337 // True if the user agent is overridden. |
| 327 bool is_overriding_user_agent_; | 338 bool is_overriding_user_agent_; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 361 // This is used to ensure pending tasks will not fire after this object is | 372 // This is used to ensure pending tasks will not fire after this object is |
| 362 // destroyed. | 373 // destroyed. |
| 363 base::WeakPtrFactory<WebViewGuest> weak_ptr_factory_; | 374 base::WeakPtrFactory<WebViewGuest> weak_ptr_factory_; |
| 364 | 375 |
| 365 DISALLOW_COPY_AND_ASSIGN(WebViewGuest); | 376 DISALLOW_COPY_AND_ASSIGN(WebViewGuest); |
| 366 }; | 377 }; |
| 367 | 378 |
| 368 } // namespace extensions | 379 } // namespace extensions |
| 369 | 380 |
| 370 #endif // EXTENSIONS_BROWSER_GUEST_VIEW_WEB_VIEW_WEB_VIEW_GUEST_H_ | 381 #endif // EXTENSIONS_BROWSER_GUEST_VIEW_WEB_VIEW_WEB_VIEW_GUEST_H_ |
| OLD | NEW |