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

Unified Diff: extensions/browser/guest_view/web_view/web_view_guest.cc

Issue 972313002: Make <webview> use out-of-process iframe architecture. (Closed) Base URL: ssh://saopaulo.wat/mnt/dev/shared/src@testoopif2z-better-chrome
Patch Set: Make <webview> work without --site-per-process as well Created 5 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: extensions/browser/guest_view/web_view/web_view_guest.cc
diff --git a/extensions/browser/guest_view/web_view/web_view_guest.cc b/extensions/browser/guest_view/web_view/web_view_guest.cc
index 721cb11cac8d86967d8c61f5e73048f012723e6e..387a814e19e0f53be3ae62bda832b665dfdaadbe 100644
--- a/extensions/browser/guest_view/web_view/web_view_guest.cc
+++ b/extensions/browser/guest_view/web_view/web_view_guest.cc
@@ -4,6 +4,7 @@
#include "extensions/browser/guest_view/web_view/web_view_guest.h"
+#include "base/command_line.h"
#include "base/message_loop/message_loop.h"
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
@@ -27,6 +28,7 @@
#include "content/public/browser/user_metrics.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_contents_delegate.h"
+#include "content/public/common/content_switches.h"
#include "content/public/common/media_stream_request.h"
#include "content/public/common/page_zoom.h"
#include "content/public/common/result_codes.h"
@@ -340,7 +342,11 @@ void WebViewGuest::DidInitialize(const base::DictionaryValue& create_params) {
// requests.
PushWebViewStateToIOThread();
- ApplyAttributes(create_params);
+ // TODO(lazyboy): Fix this, site-per-process should also use this code path.
+ if (!base::CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kSitePerProcess)) {
+ ApplyAttributes(create_params);
+ }
}
void WebViewGuest::AttachWebViewHelpers(WebContents* contents) {
@@ -839,7 +845,7 @@ void WebViewGuest::FrameNameChanged(RenderFrameHost* render_frame_host,
if (name_ == name)
return;
- ReportFrameNameChange(name);
+ //ReportFrameNameChange(name);
}
void WebViewGuest::ReportFrameNameChange(const std::string& name) {
@@ -1035,8 +1041,8 @@ void WebViewGuest::ApplyAttributes(const base::DictionaryValue& params) {
if (name_.empty())
SetName(name);
}
- if (attached())
- ReportFrameNameChange(name_);
+ //if (attached())
+ // ReportFrameNameChange(name_);
std::string user_agent_override;
params.GetString(webview::kParameterUserAgentOverride, &user_agent_override);
@@ -1208,6 +1214,11 @@ content::WebContents* WebViewGuest::OpenURLFromTab(
owner_web_contents(), params);
}
+ if (base::CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kSitePerProcess)) {
+ return OpenURLFromTabForSitePerProcess(source, params);
+ }
+
// If the guest wishes to navigate away prior to attachment then we save the
// navigation to perform upon attachment. Navigation initializes a lot of
// state that assumes an embedder exists, such as RenderWidgetHostViewGuest.
@@ -1247,6 +1258,23 @@ content::WebContents* WebViewGuest::OpenURLFromTab(
return nullptr;
}
+content::WebContents* WebViewGuest::OpenURLFromTabForSitePerProcess(
+ content::WebContents* source, const content::OpenURLParams& params) {
+ // site-per-process
+ LOG(WARNING) << "source: " << source << ", web_contents: "<< web_contents();
+ //CHECK(0);
+ content::NavigationController::LoadURLParams load_url_params(
+ params.url);
+ load_url_params.referrer = params.referrer;
+ load_url_params.transition_type = params.transition;
+ load_url_params.extra_headers = std::string();
+ //load_url_params.frame_tree_node_id = params.frame_tree_node_id;
+ load_url_params.transferred_global_request_id =
+ params.transferred_global_request_id;
+ source->GetController().LoadURLWithParams(load_url_params);
+ return source;
+}
+
void WebViewGuest::WebContentsCreated(WebContents* source_contents,
int opener_render_frame_id,
const base::string16& frame_name,

Powered by Google App Engine
This is Rietveld 408576698