| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/stringprintf.h" | 10 #include "base/stringprintf.h" |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 return params->browser->profile(); | 242 return params->browser->profile(); |
| 243 } | 243 } |
| 244 | 244 |
| 245 void LoadURLInContents(TabContents* target_contents, | 245 void LoadURLInContents(TabContents* target_contents, |
| 246 const GURL& url, | 246 const GURL& url, |
| 247 browser::NavigateParams* params, | 247 browser::NavigateParams* params, |
| 248 const std::string& extra_headers) { | 248 const std::string& extra_headers) { |
| 249 if (params->transferred_global_request_id != GlobalRequestID()) { | 249 if (params->transferred_global_request_id != GlobalRequestID()) { |
| 250 target_contents->controller().TransferURL( | 250 target_contents->controller().TransferURL( |
| 251 url, | 251 url, |
| 252 content::Referrer(params->referrer, WebKit::WebReferrerPolicyDefault), | 252 params->referrer, |
| 253 params->transition, extra_headers, | 253 params->transition, extra_headers, |
| 254 params->transferred_global_request_id, | 254 params->transferred_global_request_id, |
| 255 params->is_renderer_initiated); | 255 params->is_renderer_initiated); |
| 256 } else if (params->is_renderer_initiated) { | 256 } else if (params->is_renderer_initiated) { |
| 257 target_contents->controller().LoadURLFromRenderer( | 257 target_contents->controller().LoadURLFromRenderer( |
| 258 url, | 258 url, |
| 259 content::Referrer(params->referrer, WebKit::WebReferrerPolicyDefault), | 259 params->referrer, |
| 260 params->transition, extra_headers); | 260 params->transition, extra_headers); |
| 261 } else { | 261 } else { |
| 262 target_contents->controller().LoadURL( | 262 target_contents->controller().LoadURL( |
| 263 url, | 263 url, |
| 264 content::Referrer(params->referrer, WebKit::WebReferrerPolicyDefault), | 264 params->referrer, |
| 265 params->transition, extra_headers); | 265 params->transition, extra_headers); |
| 266 } | 266 } |
| 267 | 267 |
| 268 } | 268 } |
| 269 | 269 |
| 270 // This class makes sure the Browser object held in |params| is made visible | 270 // This class makes sure the Browser object held in |params| is made visible |
| 271 // by the time it goes out of scope, provided |params| wants it to be shown. | 271 // by the time it goes out of scope, provided |params| wants it to be shown. |
| 272 class ScopedBrowserDisplayer { | 272 class ScopedBrowserDisplayer { |
| 273 public: | 273 public: |
| 274 explicit ScopedBrowserDisplayer(browser::NavigateParams* params) | 274 explicit ScopedBrowserDisplayer(browser::NavigateParams* params) |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 415 | 415 |
| 416 if (!params->browser) | 416 if (!params->browser) |
| 417 return; | 417 return; |
| 418 | 418 |
| 419 // Navigate() must not return early after this point. | 419 // Navigate() must not return early after this point. |
| 420 | 420 |
| 421 if (GetSourceProfile(params, source_browser) != params->browser->profile()) { | 421 if (GetSourceProfile(params, source_browser) != params->browser->profile()) { |
| 422 // A tab is being opened from a link from a different profile, we must reset | 422 // A tab is being opened from a link from a different profile, we must reset |
| 423 // source information that may cause state to be shared. | 423 // source information that may cause state to be shared. |
| 424 params->source_contents = NULL; | 424 params->source_contents = NULL; |
| 425 params->referrer = GURL(); | 425 params->referrer = content::Referrer(); |
| 426 } | 426 } |
| 427 | 427 |
| 428 // Make sure the Browser is shown if params call for it. | 428 // Make sure the Browser is shown if params call for it. |
| 429 ScopedBrowserDisplayer displayer(params); | 429 ScopedBrowserDisplayer displayer(params); |
| 430 | 430 |
| 431 // Makes sure any TabContents created by this function is destroyed if | 431 // Makes sure any TabContents created by this function is destroyed if |
| 432 // not properly added to a tab strip. | 432 // not properly added to a tab strip. |
| 433 ScopedTargetContentsOwner target_contents_owner(params); | 433 ScopedTargetContentsOwner target_contents_owner(params); |
| 434 | 434 |
| 435 // Some dispositions need coercion to base types. | 435 // Some dispositions need coercion to base types. |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 640 // chrome://settings. | 640 // chrome://settings. |
| 641 | 641 |
| 642 return !(url.scheme() == chrome::kChromeUIScheme && | 642 return !(url.scheme() == chrome::kChromeUIScheme && |
| 643 (url.host() == chrome::kChromeUISettingsHost || | 643 (url.host() == chrome::kChromeUISettingsHost || |
| 644 url.host() == chrome::kChromeUIExtensionsHost || | 644 url.host() == chrome::kChromeUIExtensionsHost || |
| 645 url.host() == chrome::kChromeUIBookmarksHost || | 645 url.host() == chrome::kChromeUIBookmarksHost || |
| 646 url.host() == chrome::kChromeUISyncPromoHost)); | 646 url.host() == chrome::kChromeUISyncPromoHost)); |
| 647 } | 647 } |
| 648 | 648 |
| 649 } // namespace browser | 649 } // namespace browser |
| OLD | NEW |