Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 16 matching lines...) Expand all Loading... | |
| 27 #include "chrome/browser/ui/search/instant_search_prerenderer.h" | 27 #include "chrome/browser/ui/search/instant_search_prerenderer.h" |
| 28 #include "chrome/browser/ui/singleton_tabs.h" | 28 #include "chrome/browser/ui/singleton_tabs.h" |
| 29 #include "chrome/browser/ui/status_bubble.h" | 29 #include "chrome/browser/ui/status_bubble.h" |
| 30 #include "chrome/browser/ui/tab_helpers.h" | 30 #include "chrome/browser/ui/tab_helpers.h" |
| 31 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 31 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 32 #include "chrome/common/url_constants.h" | 32 #include "chrome/common/url_constants.h" |
| 33 #include "components/prefs/pref_service.h" | 33 #include "components/prefs/pref_service.h" |
| 34 #include "content/public/browser/browser_url_handler.h" | 34 #include "content/public/browser/browser_url_handler.h" |
| 35 #include "content/public/browser/navigation_entry.h" | 35 #include "content/public/browser/navigation_entry.h" |
| 36 #include "content/public/browser/notification_service.h" | 36 #include "content/public/browser/notification_service.h" |
| 37 #include "content/public/browser/render_frame_host.h" | |
| 38 #include "content/public/browser/render_process_host.h" | |
| 37 #include "content/public/browser/render_view_host.h" | 39 #include "content/public/browser/render_view_host.h" |
| 38 #include "content/public/browser/web_contents.h" | 40 #include "content/public/browser/web_contents.h" |
| 39 #include "extensions/features/features.h" | 41 #include "extensions/features/features.h" |
| 40 | 42 |
| 41 #if defined(USE_ASH) | 43 #if defined(USE_ASH) |
| 42 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager.h" | 44 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager.h" |
| 43 #include "components/signin/core/account_id/account_id.h" | 45 #include "components/signin/core/account_id/account_id.h" |
| 44 #endif | 46 #endif |
| 45 | 47 |
| 46 #if defined(USE_AURA) | 48 #if defined(USE_AURA) |
| (...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 351 private: | 353 private: |
| 352 chrome::NavigateParams* params_; | 354 chrome::NavigateParams* params_; |
| 353 std::unique_ptr<WebContents> target_contents_owner_; | 355 std::unique_ptr<WebContents> target_contents_owner_; |
| 354 DISALLOW_COPY_AND_ASSIGN(ScopedTargetContentsOwner); | 356 DISALLOW_COPY_AND_ASSIGN(ScopedTargetContentsOwner); |
| 355 }; | 357 }; |
| 356 | 358 |
| 357 content::WebContents* CreateTargetContents(const chrome::NavigateParams& params, | 359 content::WebContents* CreateTargetContents(const chrome::NavigateParams& params, |
| 358 const GURL& url) { | 360 const GURL& url) { |
| 359 WebContents::CreateParams create_params( | 361 WebContents::CreateParams create_params( |
| 360 params.browser->profile(), | 362 params.browser->profile(), |
| 361 params.source_site_instance && !params.force_new_process_for_new_contents | 363 params.opener |
| 362 ? params.source_site_instance | 364 ? params.opener->GetSiteInstance() |
|
Charlie Reis
2017/06/05 21:06:28
Was this really only used for chrome.windows.creat
Łukasz Anforowicz
2017/06/05 22:06:54
I've added a comment here.
| |
| 363 : tab_util::GetSiteInstanceForNewTab(params.browser->profile(), url)); | 365 : tab_util::GetSiteInstanceForNewTab(params.browser->profile(), url)); |
| 364 create_params.main_frame_name = params.frame_name; | 366 create_params.main_frame_name = params.frame_name; |
| 367 if (params.opener) { | |
| 368 create_params.opener_render_frame_id = params.opener->GetRoutingID(); | |
| 369 create_params.opener_render_process_id = | |
| 370 params.opener->GetProcess()->GetID(); | |
| 371 } | |
| 365 if (params.source_contents) { | 372 if (params.source_contents) { |
| 366 create_params.initial_size = | 373 create_params.initial_size = |
| 367 params.source_contents->GetContainerBounds().size(); | 374 params.source_contents->GetContainerBounds().size(); |
| 368 create_params.created_with_opener = params.created_with_opener; | 375 create_params.created_with_opener = params.created_with_opener; |
| 369 } | 376 } |
| 370 if (params.disposition == WindowOpenDisposition::NEW_BACKGROUND_TAB) | 377 if (params.disposition == WindowOpenDisposition::NEW_BACKGROUND_TAB) |
| 371 create_params.initially_hidden = true; | 378 create_params.initially_hidden = true; |
| 372 | 379 |
| 373 #if defined(USE_AURA) | 380 #if defined(USE_AURA) |
| 374 if (params.browser->window() && | 381 if (params.browser->window() && |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 466 } | 473 } |
| 467 } | 474 } |
| 468 } | 475 } |
| 469 #endif | 476 #endif |
| 470 | 477 |
| 471 // Navigate() must not return early after this point. | 478 // Navigate() must not return early after this point. |
| 472 | 479 |
| 473 if (GetSourceProfile(params) != params->browser->profile()) { | 480 if (GetSourceProfile(params) != params->browser->profile()) { |
| 474 // A tab is being opened from a link from a different profile, we must reset | 481 // A tab is being opened from a link from a different profile, we must reset |
| 475 // source information that may cause state to be shared. | 482 // source information that may cause state to be shared. |
| 483 params->opener = nullptr; | |
| 476 params->source_contents = nullptr; | 484 params->source_contents = nullptr; |
| 477 params->source_site_instance = nullptr; | 485 params->source_site_instance = nullptr; |
| 478 params->referrer = content::Referrer(); | 486 params->referrer = content::Referrer(); |
| 479 } | 487 } |
| 480 | 488 |
| 481 // Make sure the Browser is shown if params call for it. | 489 // Make sure the Browser is shown if params call for it. |
| 482 ScopedBrowserShower shower(params); | 490 ScopedBrowserShower shower(params); |
| 483 | 491 |
| 484 // Makes sure any WebContents created by this function is destroyed if | 492 // Makes sure any WebContents created by this function is destroyed if |
| 485 // not properly added to a tab strip. | 493 // not properly added to a tab strip. |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 676 bool reverse_on_redirect = false; | 684 bool reverse_on_redirect = false; |
| 677 content::BrowserURLHandler::GetInstance()->RewriteURLIfNecessary( | 685 content::BrowserURLHandler::GetInstance()->RewriteURLIfNecessary( |
| 678 &rewritten_url, browser_context, &reverse_on_redirect); | 686 &rewritten_url, browser_context, &reverse_on_redirect); |
| 679 | 687 |
| 680 // Some URLs are mapped to uber subpages. Do not allow them in incognito. | 688 // Some URLs are mapped to uber subpages. Do not allow them in incognito. |
| 681 return !(rewritten_url.scheme_piece() == content::kChromeUIScheme && | 689 return !(rewritten_url.scheme_piece() == content::kChromeUIScheme && |
| 682 rewritten_url.host_piece() == chrome::kChromeUIUberHost); | 690 rewritten_url.host_piece() == chrome::kChromeUIUberHost); |
| 683 } | 691 } |
| 684 | 692 |
| 685 } // namespace chrome | 693 } // namespace chrome |
| OLD | NEW |