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

Unified Diff: chrome/browser/chrome_content_browser_client.cc

Issue 17165004: <webview>: Partially migrate loadcommit event from content to chrome (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merge with ToT Created 7 years, 6 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
« no previous file with comments | « chrome/browser/adview/adview_guest.cc ('k') | chrome/browser/extensions/api/webview/webview_api.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chrome_content_browser_client.cc
diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc
index 61cda79fd04824f0228e8388774a87b34f5c289d..6e16a0b943b5b0717e432c000f521b9908acafc9 100644
--- a/chrome/browser/chrome_content_browser_client.cc
+++ b/chrome/browser/chrome_content_browser_client.cc
@@ -17,6 +17,7 @@
#include "base/strings/utf_string_conversions.h"
#include "base/threading/sequenced_worker_pool.h"
#include "chrome/app/breakpad_mac.h"
+#include "chrome/browser/adview/adview_guest.h"
#include "chrome/browser/app_mode/app_mode_utils.h"
#include "chrome/browser/browser_about_handler.h"
#include "chrome/browser/browser_process.h"
@@ -84,6 +85,7 @@
#include "chrome/browser/user_style_sheet_watcher.h"
#include "chrome/browser/user_style_sheet_watcher_factory.h"
#include "chrome/browser/validation_message_message_filter.h"
+#include "chrome/browser/webview/webview_constants.h"
#include "chrome/browser/webview/webview_guest.h"
#include "chrome/common/child_process_logging.h"
#include "chrome/common/chrome_constants.h"
@@ -710,11 +712,28 @@ void ChromeContentBrowserClient::GuestWebContentsAttached(
GetExtensionOrAppByURL(ExtensionURLInfo(url));
if (!extension)
return;
- new WebViewGuest(guest_web_contents,
- embedder_web_contents,
- extension->id(),
- browser_plugin_instance_id,
- extra_params);
+
+ std::string api_type;
+ extra_params.GetString(webview::kAttributeApi, &api_type);
+
+ // WebViewGuest and AdViewGuest's lifetimes iare tied to their associated
+ // guest WebContents' lifetime. When the guest WebContents is destroyed, so is
+ // the attached WebViewGuest or AdViewGuest.
+ if (api_type == "adview") {
+ new AdViewGuest(guest_web_contents,
+ embedder_web_contents,
+ extension->id(),
+ browser_plugin_instance_id,
+ extra_params);
+ } else if (api_type == "webview") {
+ new WebViewGuest(guest_web_contents,
+ embedder_web_contents,
+ extension->id(),
+ browser_plugin_instance_id,
+ extra_params);
+ } else {
+ NOTREACHED();
+ }
}
void ChromeContentBrowserClient::RenderProcessHostCreated(
« no previous file with comments | « chrome/browser/adview/adview_guest.cc ('k') | chrome/browser/extensions/api/webview/webview_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698