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 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 params->referrer, | 252 params->referrer, |
253 params->transition, extra_headers, | 253 params->transition, extra_headers, |
| 254 params->opener_browsing_instance_frame_id, |
254 params->transferred_global_request_id, | 255 params->transferred_global_request_id, |
255 params->is_renderer_initiated); | 256 params->is_renderer_initiated); |
256 } else if (params->is_renderer_initiated) { | 257 } else if (params->is_renderer_initiated) { |
257 target_contents->controller().LoadURLFromRenderer( | 258 target_contents->controller().LoadURLFromRenderer( |
258 url, | 259 url, |
259 params->referrer, | 260 params->referrer, |
260 params->transition, extra_headers); | 261 params->transition, |
| 262 extra_headers, |
| 263 params->opener_browsing_instance_frame_id); |
261 } else { | 264 } else { |
262 target_contents->controller().LoadURL( | 265 target_contents->controller().LoadURL( |
263 url, | 266 url, |
264 params->referrer, | 267 params->referrer, |
265 params->transition, extra_headers); | 268 params->transition, |
| 269 extra_headers); |
266 } | 270 } |
267 | 271 |
268 } | 272 } |
269 | 273 |
270 // This class makes sure the Browser object held in |params| is made visible | 274 // 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. | 275 // by the time it goes out of scope, provided |params| wants it to be shown. |
272 class ScopedBrowserDisplayer { | 276 class ScopedBrowserDisplayer { |
273 public: | 277 public: |
274 explicit ScopedBrowserDisplayer(browser::NavigateParams* params) | 278 explicit ScopedBrowserDisplayer(browser::NavigateParams* params) |
275 : params_(params) { | 279 : params_(params) { |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
360 NavigateParams::NavigateParams( | 364 NavigateParams::NavigateParams( |
361 Browser* a_browser, | 365 Browser* a_browser, |
362 const GURL& a_url, | 366 const GURL& a_url, |
363 content::PageTransition a_transition) | 367 content::PageTransition a_transition) |
364 : url(a_url), | 368 : url(a_url), |
365 target_contents(NULL), | 369 target_contents(NULL), |
366 source_contents(NULL), | 370 source_contents(NULL), |
367 disposition(CURRENT_TAB), | 371 disposition(CURRENT_TAB), |
368 transition(a_transition), | 372 transition(a_transition), |
369 is_renderer_initiated(false), | 373 is_renderer_initiated(false), |
| 374 opener_browsing_instance_frame_id(-1), |
370 tabstrip_index(-1), | 375 tabstrip_index(-1), |
371 tabstrip_add_types(TabStripModel::ADD_ACTIVE), | 376 tabstrip_add_types(TabStripModel::ADD_ACTIVE), |
372 window_action(NO_ACTION), | 377 window_action(NO_ACTION), |
373 user_gesture(true), | 378 user_gesture(true), |
374 path_behavior(RESPECT), | 379 path_behavior(RESPECT), |
375 ref_behavior(IGNORE_REF), | 380 ref_behavior(IGNORE_REF), |
376 browser(a_browser), | 381 browser(a_browser), |
377 profile(NULL) { | 382 profile(NULL) { |
378 } | 383 } |
379 | 384 |
380 NavigateParams::NavigateParams(Browser* a_browser, | 385 NavigateParams::NavigateParams(Browser* a_browser, |
381 TabContentsWrapper* a_target_contents) | 386 TabContentsWrapper* a_target_contents) |
382 : target_contents(a_target_contents), | 387 : target_contents(a_target_contents), |
383 source_contents(NULL), | 388 source_contents(NULL), |
384 disposition(CURRENT_TAB), | 389 disposition(CURRENT_TAB), |
385 transition(content::PAGE_TRANSITION_LINK), | 390 transition(content::PAGE_TRANSITION_LINK), |
386 is_renderer_initiated(false), | 391 is_renderer_initiated(false), |
| 392 opener_browsing_instance_frame_id(-1), |
387 tabstrip_index(-1), | 393 tabstrip_index(-1), |
388 tabstrip_add_types(TabStripModel::ADD_ACTIVE), | 394 tabstrip_add_types(TabStripModel::ADD_ACTIVE), |
389 window_action(NO_ACTION), | 395 window_action(NO_ACTION), |
390 user_gesture(true), | 396 user_gesture(true), |
391 path_behavior(RESPECT), | 397 path_behavior(RESPECT), |
392 ref_behavior(IGNORE_REF), | 398 ref_behavior(IGNORE_REF), |
393 browser(a_browser), | 399 browser(a_browser), |
394 profile(NULL) { | 400 profile(NULL) { |
395 } | 401 } |
396 | 402 |
(...skipping 19 matching lines...) Expand all Loading... |
416 if (!params->browser) | 422 if (!params->browser) |
417 return; | 423 return; |
418 | 424 |
419 // Navigate() must not return early after this point. | 425 // Navigate() must not return early after this point. |
420 | 426 |
421 if (GetSourceProfile(params, source_browser) != params->browser->profile()) { | 427 if (GetSourceProfile(params, source_browser) != params->browser->profile()) { |
422 // A tab is being opened from a link from a different profile, we must reset | 428 // 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. | 429 // source information that may cause state to be shared. |
424 params->source_contents = NULL; | 430 params->source_contents = NULL; |
425 params->referrer = content::Referrer(); | 431 params->referrer = content::Referrer(); |
| 432 params->opener_browsing_instance_frame_id = -1; |
426 } | 433 } |
427 | 434 |
428 // Make sure the Browser is shown if params call for it. | 435 // Make sure the Browser is shown if params call for it. |
429 ScopedBrowserDisplayer displayer(params); | 436 ScopedBrowserDisplayer displayer(params); |
430 | 437 |
431 // Makes sure any TabContents created by this function is destroyed if | 438 // Makes sure any TabContents created by this function is destroyed if |
432 // not properly added to a tab strip. | 439 // not properly added to a tab strip. |
433 ScopedTargetContentsOwner target_contents_owner(params); | 440 ScopedTargetContentsOwner target_contents_owner(params); |
434 | 441 |
435 // Some dispositions need coercion to base types. | 442 // Some dispositions need coercion to base types. |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
640 // chrome://settings. | 647 // chrome://settings. |
641 | 648 |
642 return !(url.scheme() == chrome::kChromeUIScheme && | 649 return !(url.scheme() == chrome::kChromeUIScheme && |
643 (url.host() == chrome::kChromeUISettingsHost || | 650 (url.host() == chrome::kChromeUISettingsHost || |
644 url.host() == chrome::kChromeUIExtensionsHost || | 651 url.host() == chrome::kChromeUIExtensionsHost || |
645 url.host() == chrome::kChromeUIBookmarksHost || | 652 url.host() == chrome::kChromeUIBookmarksHost || |
646 url.host() == chrome::kChromeUISyncPromoHost)); | 653 url.host() == chrome::kChromeUISyncPromoHost)); |
647 } | 654 } |
648 | 655 |
649 } // namespace browser | 656 } // namespace browser |
OLD | NEW |