Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(125)

Side by Side Diff: chrome/browser/guest_view/web_view/web_view_guest.cc

Issue 373623002: Convert remaining WebContentsObservers loading callbacks to use RFH. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix one more compile error Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 #include "chrome/browser/guest_view/web_view/web_view_guest.h" 5 #include "chrome/browser/guest_view/web_view/web_view_guest.h"
6 6
7 #include "base/message_loop/message_loop.h" 7 #include "base/message_loop/message_loop.h"
8 #include "base/strings/stringprintf.h" 8 #include "base/strings/stringprintf.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "chrome/browser/chrome_notification_types.h" 10 #include "chrome/browser/chrome_notification_types.h"
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 } 220 }
221 221
222 } // namespace 222 } // namespace
223 223
224 WebViewGuest::WebViewGuest(content::BrowserContext* browser_context, 224 WebViewGuest::WebViewGuest(content::BrowserContext* browser_context,
225 int guest_instance_id) 225 int guest_instance_id)
226 : GuestView<WebViewGuest>(browser_context, guest_instance_id), 226 : GuestView<WebViewGuest>(browser_context, guest_instance_id),
227 pending_context_menu_request_id_(0), 227 pending_context_menu_request_id_(0),
228 next_permission_request_id_(0), 228 next_permission_request_id_(0),
229 is_overriding_user_agent_(false), 229 is_overriding_user_agent_(false),
230 main_frame_id_(0),
231 chromevox_injected_(false), 230 chromevox_injected_(false),
232 current_zoom_factor_(1.0), 231 current_zoom_factor_(1.0),
233 find_helper_(this), 232 find_helper_(this),
234 javascript_dialog_helper_(this) { 233 javascript_dialog_helper_(this) {
235 } 234 }
236 235
237 // static 236 // static
238 bool WebViewGuest::GetGuestPartitionConfigForSite( 237 bool WebViewGuest::GetGuestPartitionConfigForSite(
239 const GURL& site, 238 const GURL& site,
240 std::string* partition_domain, 239 std::string* partition_domain,
(...skipping 795 matching lines...) Expand 10 before | Expand all | Expand 10 after
1036 guest_web_contents()->GetRenderProcessHost()->GetID()); 1035 guest_web_contents()->GetRenderProcessHost()->GetID());
1037 DispatchEvent( 1036 DispatchEvent(
1038 new GuestViewBase::Event(webview::kEventLoadCommit, args.Pass())); 1037 new GuestViewBase::Event(webview::kEventLoadCommit, args.Pass()));
1039 1038
1040 // Update the current zoom factor for the new page. 1039 // Update the current zoom factor for the new page.
1041 ZoomController* zoom_controller = 1040 ZoomController* zoom_controller =
1042 ZoomController::FromWebContents(guest_web_contents()); 1041 ZoomController::FromWebContents(guest_web_contents());
1043 DCHECK(zoom_controller); 1042 DCHECK(zoom_controller);
1044 current_zoom_factor_ = zoom_controller->GetZoomLevel(); 1043 current_zoom_factor_ = zoom_controller->GetZoomLevel();
1045 1044
1046 if (!render_frame_host->GetParent()) { 1045 if (!render_frame_host->GetParent())
1047 chromevox_injected_ = false; 1046 chromevox_injected_ = false;
1048 main_frame_id_ = render_frame_host->GetRoutingID();
1049 }
1050 } 1047 }
1051 1048
1052 void WebViewGuest::DidFailProvisionalLoad( 1049 void WebViewGuest::DidFailProvisionalLoad(
1053 content::RenderFrameHost* render_frame_host, 1050 content::RenderFrameHost* render_frame_host,
1054 const GURL& validated_url, 1051 const GURL& validated_url,
1055 int error_code, 1052 int error_code,
1056 const base::string16& error_description) { 1053 const base::string16& error_description) {
1057 // Translate the |error_code| into an error string. 1054 // Translate the |error_code| into an error string.
1058 std::string error_type(net::ErrorToString(error_code)); 1055 std::string error_type(net::ErrorToString(error_code));
1059 DCHECK(StartsWithASCII(error_type, "net::", true)); 1056 DCHECK(StartsWithASCII(error_type, "net::", true));
1060 error_type.erase(0, 5); 1057 error_type.erase(0, 5);
1061 LoadAbort(!render_frame_host->GetParent(), validated_url, error_type); 1058 LoadAbort(!render_frame_host->GetParent(), validated_url, error_type);
1062 } 1059 }
1063 1060
1064 void WebViewGuest::DidStartProvisionalLoadForFrame( 1061 void WebViewGuest::DidStartProvisionalLoadForFrame(
1065 content::RenderFrameHost* render_frame_host, 1062 content::RenderFrameHost* render_frame_host,
1066 const GURL& validated_url, 1063 const GURL& validated_url,
1067 bool is_error_page, 1064 bool is_error_page,
1068 bool is_iframe_srcdoc) { 1065 bool is_iframe_srcdoc) {
1069 scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue()); 1066 scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue());
1070 args->SetString(guestview::kUrl, validated_url.spec()); 1067 args->SetString(guestview::kUrl, validated_url.spec());
1071 args->SetBoolean(guestview::kIsTopLevel, !render_frame_host->GetParent()); 1068 args->SetBoolean(guestview::kIsTopLevel, !render_frame_host->GetParent());
1072 DispatchEvent( 1069 DispatchEvent(
1073 new GuestViewBase::Event(webview::kEventLoadStart, args.Pass())); 1070 new GuestViewBase::Event(webview::kEventLoadStart, args.Pass()));
1074 } 1071 }
1075 1072
1076 void WebViewGuest::DocumentLoadedInFrame( 1073 void WebViewGuest::DocumentLoadedInFrame(
1077 int64 frame_id, 1074 content::RenderFrameHost* render_frame_host) {
1078 content::RenderViewHost* render_view_host) { 1075 if (!render_frame_host->GetParent())
1079 if (frame_id == main_frame_id_) 1076 InjectChromeVoxIfNeeded(render_frame_host->GetRenderViewHost());
1080 InjectChromeVoxIfNeeded(render_view_host);
1081 } 1077 }
1082 1078
1083 bool WebViewGuest::OnMessageReceived(const IPC::Message& message, 1079 bool WebViewGuest::OnMessageReceived(const IPC::Message& message,
1084 RenderFrameHost* render_frame_host) { 1080 RenderFrameHost* render_frame_host) {
1085 bool handled = true; 1081 bool handled = true;
1086 IPC_BEGIN_MESSAGE_MAP(WebViewGuest, message) 1082 IPC_BEGIN_MESSAGE_MAP(WebViewGuest, message)
1087 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_UpdateFrameName, OnUpdateFrameName) 1083 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_UpdateFrameName, OnUpdateFrameName)
1088 IPC_MESSAGE_UNHANDLED(handled = false) 1084 IPC_MESSAGE_UNHANDLED(handled = false)
1089 IPC_END_MESSAGE_MAP() 1085 IPC_END_MESSAGE_MAP()
1090 return handled; 1086 return handled;
(...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after
1661 bool allow, 1657 bool allow,
1662 const std::string& user_input) { 1658 const std::string& user_input) {
1663 WebViewGuest* guest = 1659 WebViewGuest* guest =
1664 WebViewGuest::From(embedder_render_process_id(), new_window_instance_id); 1660 WebViewGuest::From(embedder_render_process_id(), new_window_instance_id);
1665 if (!guest) 1661 if (!guest)
1666 return; 1662 return;
1667 1663
1668 if (!allow) 1664 if (!allow)
1669 guest->Destroy(); 1665 guest->Destroy();
1670 } 1666 }
OLDNEW
« no previous file with comments | « chrome/browser/guest_view/web_view/web_view_guest.h ('k') | chrome/browser/password_manager/password_manager_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698