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

Side by Side Diff: chrome/browser/ui/browser_navigator.cc

Issue 2372323003: Keep web popups opened from extensions in same BrowsingInstance. (Closed)
Patch Set: Fix another test (ExtensionApiTest.TabQuery) Created 4 years, 2 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/ui/browser_navigator.h" 5 #include "chrome/browser/ui/browser_navigator.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 params->tabstrip_add_types |= TabStripModel::ADD_ACTIVE; 241 params->tabstrip_add_types |= TabStripModel::ADD_ACTIVE;
242 break; 242 break;
243 243
244 default: 244 default:
245 break; 245 break;
246 } 246 }
247 } 247 }
248 248
249 // Obtain the profile used by the code that originated the Navigate() request. 249 // Obtain the profile used by the code that originated the Navigate() request.
250 Profile* GetSourceProfile(chrome::NavigateParams* params) { 250 Profile* GetSourceProfile(chrome::NavigateParams* params) {
251 if (params->source_site_instance) {
alexmos 2016/10/04 21:24:44 Turned out the source_site_instance check needed t
Lei Zhang 2016/10/06 00:36:47 You may want to write down some of your notes here
alexmos 2016/10/06 00:42:00 Thanks! I'll add the comment in a followup so I c
252 return Profile::FromBrowserContext(
253 params->source_site_instance->GetBrowserContext());
254 }
255
251 if (params->source_contents) { 256 if (params->source_contents) {
252 return Profile::FromBrowserContext( 257 return Profile::FromBrowserContext(
253 params->source_contents->GetBrowserContext()); 258 params->source_contents->GetBrowserContext());
254 } 259 }
255 260
256 return params->initiating_profile; 261 return params->initiating_profile;
257 } 262 }
258 263
259 void LoadURLInContents(WebContents* target_contents, 264 void LoadURLInContents(WebContents* target_contents,
260 const GURL& url, 265 const GURL& url,
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
458 } 463 }
459 } 464 }
460 } 465 }
461 #endif 466 #endif
462 467
463 // Navigate() must not return early after this point. 468 // Navigate() must not return early after this point.
464 469
465 if (GetSourceProfile(params) != params->browser->profile()) { 470 if (GetSourceProfile(params) != params->browser->profile()) {
466 // A tab is being opened from a link from a different profile, we must reset 471 // A tab is being opened from a link from a different profile, we must reset
467 // source information that may cause state to be shared. 472 // source information that may cause state to be shared.
468 params->source_contents = NULL; 473 params->source_contents = nullptr;
474 params->source_site_instance = nullptr;
469 params->referrer = content::Referrer(); 475 params->referrer = content::Referrer();
470 } 476 }
471 477
472 // Make sure the Browser is shown if params call for it. 478 // Make sure the Browser is shown if params call for it.
473 ScopedBrowserShower shower(params); 479 ScopedBrowserShower shower(params);
474 480
475 // Makes sure any WebContents created by this function is destroyed if 481 // Makes sure any WebContents created by this function is destroyed if
476 // not properly added to a tab strip. 482 // not properly added to a tab strip.
477 ScopedTargetContentsOwner target_contents_owner(params); 483 ScopedTargetContentsOwner target_contents_owner(params);
478 484
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
667 bool reverse_on_redirect = false; 673 bool reverse_on_redirect = false;
668 content::BrowserURLHandler::GetInstance()->RewriteURLIfNecessary( 674 content::BrowserURLHandler::GetInstance()->RewriteURLIfNecessary(
669 &rewritten_url, browser_context, &reverse_on_redirect); 675 &rewritten_url, browser_context, &reverse_on_redirect);
670 676
671 // Some URLs are mapped to uber subpages. Do not allow them in incognito. 677 // Some URLs are mapped to uber subpages. Do not allow them in incognito.
672 return !(rewritten_url.scheme() == content::kChromeUIScheme && 678 return !(rewritten_url.scheme() == content::kChromeUIScheme &&
673 rewritten_url.host() == chrome::kChromeUIUberHost); 679 rewritten_url.host() == chrome::kChromeUIUberHost);
674 } 680 }
675 681
676 } // namespace chrome 682 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698