| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #include "chrome/browser/guestview/webview/webview_guest.h" | 5 #include "chrome/browser/guestview/webview/webview_guest.h" |
| 6 | 6 |
| 7 #include "base/strings/stringprintf.h" | 7 #include "base/strings/stringprintf.h" |
| 8 #include "chrome/browser/chrome_notification_types.h" | 8 #include "chrome/browser/chrome_notification_types.h" |
| 9 #include "chrome/browser/extensions/api/web_request/web_request_api.h" | 9 #include "chrome/browser/extensions/api/web_request/web_request_api.h" |
| 10 #include "chrome/browser/extensions/api/webview/webview_api.h" | 10 #include "chrome/browser/extensions/api/webview/webview_api.h" |
| 11 #include "chrome/browser/extensions/extension_renderer_state.h" | 11 #include "chrome/browser/extensions/extension_renderer_state.h" |
| 12 #include "chrome/browser/extensions/extension_web_contents_observer.h" | 12 #include "chrome/browser/extensions/extension_web_contents_observer.h" |
| 13 #include "chrome/browser/extensions/menu_manager.h" |
| 13 #include "chrome/browser/extensions/script_executor.h" | 14 #include "chrome/browser/extensions/script_executor.h" |
| 14 #include "chrome/browser/favicon/favicon_tab_helper.h" | 15 #include "chrome/browser/favicon/favicon_tab_helper.h" |
| 15 #include "chrome/browser/guestview/guestview_constants.h" | 16 #include "chrome/browser/guestview/guestview_constants.h" |
| 16 #include "chrome/browser/guestview/webview/webview_constants.h" | 17 #include "chrome/browser/guestview/webview/webview_constants.h" |
| 17 #include "chrome/browser/guestview/webview/webview_permission_types.h" | 18 #include "chrome/browser/guestview/webview/webview_permission_types.h" |
| 18 #include "chrome/common/chrome_version_info.h" | 19 #include "chrome/common/chrome_version_info.h" |
| 19 #include "content/public/browser/browser_thread.h" | 20 #include "content/public/browser/browser_thread.h" |
| 20 #include "content/public/browser/native_web_keyboard_event.h" | 21 #include "content/public/browser/native_web_keyboard_event.h" |
| 21 #include "content/public/browser/navigation_entry.h" | 22 #include "content/public/browser/navigation_entry.h" |
| 22 #include "content/public/browser/notification_details.h" | 23 #include "content/public/browser/notification_details.h" |
| (...skipping 652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 675 if (frame_id == main_frame_id_) | 676 if (frame_id == main_frame_id_) |
| 676 InjectChromeVoxIfNeeded(render_view_host); | 677 InjectChromeVoxIfNeeded(render_view_host); |
| 677 } | 678 } |
| 678 | 679 |
| 679 void WebViewGuest::DidStopLoading(content::RenderViewHost* render_view_host) { | 680 void WebViewGuest::DidStopLoading(content::RenderViewHost* render_view_host) { |
| 680 scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue()); | 681 scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue()); |
| 681 DispatchEvent(new GuestView::Event(webview::kEventLoadStop, args.Pass())); | 682 DispatchEvent(new GuestView::Event(webview::kEventLoadStop, args.Pass())); |
| 682 } | 683 } |
| 683 | 684 |
| 684 void WebViewGuest::WebContentsDestroyed(WebContents* web_contents) { | 685 void WebViewGuest::WebContentsDestroyed(WebContents* web_contents) { |
| 686 // Clean up custom context menu items for this guest. |
| 687 extensions::MenuManager* menu_manager = extensions::MenuManager::Get( |
| 688 Profile::FromBrowserContext(browser_context())); |
| 689 menu_manager->RemoveAllWebviewContextItems(extension_id(), |
| 690 view_instance_id()); |
| 691 |
| 685 RemoveWebViewFromExtensionRendererState(web_contents); | 692 RemoveWebViewFromExtensionRendererState(web_contents); |
| 686 } | 693 } |
| 687 | 694 |
| 688 void WebViewGuest::UserAgentOverrideSet(const std::string& user_agent) { | 695 void WebViewGuest::UserAgentOverrideSet(const std::string& user_agent) { |
| 689 content::NavigationController& controller = | 696 content::NavigationController& controller = |
| 690 guest_web_contents()->GetController(); | 697 guest_web_contents()->GetController(); |
| 691 content::NavigationEntry* entry = controller.GetVisibleEntry(); | 698 content::NavigationEntry* entry = controller.GetVisibleEntry(); |
| 692 if (!entry) | 699 if (!entry) |
| 693 return; | 700 return; |
| 694 entry->SetIsOverridingUserAgent(!user_agent.empty()); | 701 entry->SetIsOverridingUserAgent(!user_agent.empty()); |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 813 const PermissionResponseCallback& callback, | 820 const PermissionResponseCallback& callback, |
| 814 BrowserPluginPermissionType permission_type, | 821 BrowserPluginPermissionType permission_type, |
| 815 bool allowed_by_default) | 822 bool allowed_by_default) |
| 816 : callback(callback), | 823 : callback(callback), |
| 817 permission_type(permission_type), | 824 permission_type(permission_type), |
| 818 allowed_by_default(allowed_by_default) { | 825 allowed_by_default(allowed_by_default) { |
| 819 } | 826 } |
| 820 | 827 |
| 821 WebViewGuest::PermissionResponseInfo::~PermissionResponseInfo() { | 828 WebViewGuest::PermissionResponseInfo::~PermissionResponseInfo() { |
| 822 } | 829 } |
| OLD | NEW |