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

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 CrOS test 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 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 } 211 }
212 212
213 } // namespace 213 } // namespace
214 214
215 WebViewGuest::WebViewGuest(content::BrowserContext* browser_context, 215 WebViewGuest::WebViewGuest(content::BrowserContext* browser_context,
216 int guest_instance_id) 216 int guest_instance_id)
217 : GuestView<WebViewGuest>(browser_context, guest_instance_id), 217 : GuestView<WebViewGuest>(browser_context, guest_instance_id),
218 pending_context_menu_request_id_(0), 218 pending_context_menu_request_id_(0),
219 next_permission_request_id_(0), 219 next_permission_request_id_(0),
220 is_overriding_user_agent_(false), 220 is_overriding_user_agent_(false),
221 main_frame_id_(0),
222 chromevox_injected_(false), 221 chromevox_injected_(false),
223 find_helper_(this), 222 find_helper_(this),
224 javascript_dialog_helper_(this) { 223 javascript_dialog_helper_(this) {
225 } 224 }
226 225
227 // static 226 // static
228 bool WebViewGuest::GetGuestPartitionConfigForSite( 227 bool WebViewGuest::GetGuestPartitionConfigForSite(
229 const GURL& site, 228 const GURL& site,
230 std::string* partition_domain, 229 std::string* partition_domain,
231 std::string* partition_name, 230 std::string* partition_name,
(...skipping 792 matching lines...) Expand 10 before | Expand all | Expand 10 after
1024 guest_web_contents()->GetController().GetEntryCount()); 1023 guest_web_contents()->GetController().GetEntryCount());
1025 args->SetInteger(webview::kInternalProcessId, 1024 args->SetInteger(webview::kInternalProcessId,
1026 guest_web_contents()->GetRenderProcessHost()->GetID()); 1025 guest_web_contents()->GetRenderProcessHost()->GetID());
1027 DispatchEvent( 1026 DispatchEvent(
1028 new GuestViewBase::Event(webview::kEventLoadCommit, args.Pass())); 1027 new GuestViewBase::Event(webview::kEventLoadCommit, args.Pass()));
1029 1028
1030 // Update the current zoom factor for the new page. 1029 // Update the current zoom factor for the new page.
1031 current_zoom_factor_ = content::ZoomLevelToZoomFactor( 1030 current_zoom_factor_ = content::ZoomLevelToZoomFactor(
1032 content::HostZoomMap::GetZoomLevel(guest_web_contents())); 1031 content::HostZoomMap::GetZoomLevel(guest_web_contents()));
1033 1032
1034 if (!render_frame_host->GetParent()) { 1033 if (!render_frame_host->GetParent())
1035 chromevox_injected_ = false; 1034 chromevox_injected_ = false;
1036 main_frame_id_ = render_frame_host->GetRoutingID();
1037 }
1038 } 1035 }
1039 1036
1040 void WebViewGuest::DidFailProvisionalLoad( 1037 void WebViewGuest::DidFailProvisionalLoad(
1041 content::RenderFrameHost* render_frame_host, 1038 content::RenderFrameHost* render_frame_host,
1042 const GURL& validated_url, 1039 const GURL& validated_url,
1043 int error_code, 1040 int error_code,
1044 const base::string16& error_description) { 1041 const base::string16& error_description) {
1045 // Translate the |error_code| into an error string. 1042 // Translate the |error_code| into an error string.
1046 std::string error_type(net::ErrorToString(error_code)); 1043 std::string error_type(net::ErrorToString(error_code));
1047 DCHECK(StartsWithASCII(error_type, "net::", true)); 1044 DCHECK(StartsWithASCII(error_type, "net::", true));
1048 error_type.erase(0, 5); 1045 error_type.erase(0, 5);
1049 LoadAbort(!render_frame_host->GetParent(), validated_url, error_type); 1046 LoadAbort(!render_frame_host->GetParent(), validated_url, error_type);
1050 } 1047 }
1051 1048
1052 void WebViewGuest::DidStartProvisionalLoadForFrame( 1049 void WebViewGuest::DidStartProvisionalLoadForFrame(
1053 content::RenderFrameHost* render_frame_host, 1050 content::RenderFrameHost* render_frame_host,
1054 const GURL& validated_url, 1051 const GURL& validated_url,
1055 bool is_error_page, 1052 bool is_error_page,
1056 bool is_iframe_srcdoc) { 1053 bool is_iframe_srcdoc) {
1057 scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue()); 1054 scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue());
1058 args->SetString(guestview::kUrl, validated_url.spec()); 1055 args->SetString(guestview::kUrl, validated_url.spec());
1059 args->SetBoolean(guestview::kIsTopLevel, !render_frame_host->GetParent()); 1056 args->SetBoolean(guestview::kIsTopLevel, !render_frame_host->GetParent());
1060 DispatchEvent( 1057 DispatchEvent(
1061 new GuestViewBase::Event(webview::kEventLoadStart, args.Pass())); 1058 new GuestViewBase::Event(webview::kEventLoadStart, args.Pass()));
1062 } 1059 }
1063 1060
1064 void WebViewGuest::DocumentLoadedInFrame( 1061 void WebViewGuest::DocumentLoadedInFrame(
1065 int64 frame_id, 1062 content::RenderFrameHost* render_frame_host) {
1066 content::RenderViewHost* render_view_host) { 1063 if (!render_frame_host->GetParent())
1067 if (frame_id == main_frame_id_) 1064 InjectChromeVoxIfNeeded(render_frame_host->GetRenderViewHost());
1068 InjectChromeVoxIfNeeded(render_view_host);
1069 } 1065 }
1070 1066
1071 bool WebViewGuest::OnMessageReceived(const IPC::Message& message, 1067 bool WebViewGuest::OnMessageReceived(const IPC::Message& message,
1072 RenderFrameHost* render_frame_host) { 1068 RenderFrameHost* render_frame_host) {
1073 bool handled = true; 1069 bool handled = true;
1074 IPC_BEGIN_MESSAGE_MAP(WebViewGuest, message) 1070 IPC_BEGIN_MESSAGE_MAP(WebViewGuest, message)
1075 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_UpdateFrameName, OnUpdateFrameName) 1071 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_UpdateFrameName, OnUpdateFrameName)
1076 IPC_MESSAGE_UNHANDLED(handled = false) 1072 IPC_MESSAGE_UNHANDLED(handled = false)
1077 IPC_END_MESSAGE_MAP() 1073 IPC_END_MESSAGE_MAP()
1078 return handled; 1074 return handled;
(...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after
1646 bool allow, 1642 bool allow,
1647 const std::string& user_input) { 1643 const std::string& user_input) {
1648 WebViewGuest* guest = 1644 WebViewGuest* guest =
1649 WebViewGuest::From(embedder_render_process_id(), new_window_instance_id); 1645 WebViewGuest::From(embedder_render_process_id(), new_window_instance_id);
1650 if (!guest) 1646 if (!guest)
1651 return; 1647 return;
1652 1648
1653 if (!allow) 1649 if (!allow)
1654 guest->Destroy(); 1650 guest->Destroy();
1655 } 1651 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698