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

Unified Diff: services/navigation/view_impl.cc

Issue 2057023002: Adds support for new-tab targeted loads initiated from the renderer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 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 | « services/navigation/view_impl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: services/navigation/view_impl.cc
diff --git a/services/navigation/view_impl.cc b/services/navigation/view_impl.cc
index dd24b09c13a06778798954c44272f005c245f3ea..3a70646cf127f47308780419c9287e041206f326 100644
--- a/services/navigation/view_impl.cc
+++ b/services/navigation/view_impl.cc
@@ -159,6 +159,26 @@ void ViewImpl::CloseContents(content::WebContents* source) {
client_->Close();
}
+content::WebContents* ViewImpl::OpenURLFromTab(
+ content::WebContents* source,
+ const content::OpenURLParams& params) {
+ mojom::OpenURLParamsPtr params_ptr = mojom::OpenURLParams::New();
+ params_ptr->url = params.url;
+ params_ptr->disposition =
+ static_cast<mojom::WindowOpenDisposition>(params.disposition);
+ client_->OpenURL(std::move(params_ptr));
+ // TODO(beng): Obviously this is the wrong thing to return for dispositions
+ // that would lead to the creation of a new View, i.e. NEW_TAB, NEW_POPUP etc.
+ // However it seems the callers of this function that we've seen so far
+ // disregard the return value. Rather than returning |source| I'm returning
+ // nullptr to locate (via crash) any sites that depend on a valid result.
+ // If we actually had to do this then we'd have to create the new WebContents
+ // here, store it with a cookie, and pass the cookie through to the client to
+ // pass back with their call to CreateView(), so it would get bound to the
+ // WebContents.
+ return nullptr;
+}
+
void ViewImpl::LoadingStateChanged(content::WebContents* source,
bool to_different_document) {
client_->LoadingStateChanged(source->IsLoading());
@@ -191,8 +211,11 @@ gfx::Rect ViewImpl::GetRootWindowResizerRect() const {
void ViewImpl::Observe(int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) {
- DCHECK(content::Source<content::NavigationController>(source).ptr() ==
- &web_view_->GetWebContents()->GetController());
+ if (content::Source<content::NavigationController>(source).ptr() !=
+ &web_view_->GetWebContents()->GetController()) {
+ return;
+ }
+
switch (type) {
case content::NOTIFICATION_NAV_ENTRY_PENDING: {
const content::NavigationEntry* entry =
« no previous file with comments | « services/navigation/view_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698