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 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
488 static_cast<RenderViewHostDelegate*>(params->target_contents-> | 488 static_cast<RenderViewHostDelegate*>(params->target_contents-> |
489 tab_contents())->OnUserGesture(); | 489 tab_contents())->OnUserGesture(); |
490 } | 490 } |
491 | 491 |
492 InitializeExtraHeaders(params, params->target_contents->profile(), | 492 InitializeExtraHeaders(params, params->target_contents->profile(), |
493 &extra_headers); | 493 &extra_headers); |
494 | 494 |
495 // Try to handle non-navigational URLs that popup dialogs and such, these | 495 // Try to handle non-navigational URLs that popup dialogs and such, these |
496 // should not actually navigate. | 496 // should not actually navigate. |
497 if (!HandleNonNavigationAboutURL(url)) { | 497 if (!HandleNonNavigationAboutURL(url)) { |
498 // Perform the actual navigation. | 498 // Perform the actual navigation, tracking whether it came from the |
499 params->target_contents->controller().LoadURL( | 499 // renderer. |
500 url, params->referrer, params->transition, extra_headers); | 500 if (params->is_renderer_initiated) { |
| 501 params->target_contents->controller().LoadURLFromRenderer( |
| 502 url, params->referrer, params->transition, extra_headers); |
| 503 } else { |
| 504 params->target_contents->controller().LoadURL( |
| 505 url, params->referrer, params->transition, extra_headers); |
| 506 } |
501 } | 507 } |
502 } else { | 508 } else { |
503 // |target_contents| was specified non-NULL, and so we assume it has already | 509 // |target_contents| was specified non-NULL, and so we assume it has already |
504 // been navigated appropriately. We need to do nothing more other than | 510 // been navigated appropriately. We need to do nothing more other than |
505 // add it to the appropriate tabstrip. | 511 // add it to the appropriate tabstrip. |
506 } | 512 } |
507 | 513 |
508 // If the user navigated from the omnibox, and the selected tab is going to | 514 // If the user navigated from the omnibox, and the selected tab is going to |
509 // lose focus, then make sure the focus for the source tab goes away from the | 515 // lose focus, then make sure the focus for the source tab goes away from the |
510 // omnibox. | 516 // omnibox. |
(...skipping 27 matching lines...) Expand all Loading... |
538 } | 544 } |
539 | 545 |
540 if (singleton_index >= 0) { | 546 if (singleton_index >= 0) { |
541 TabContents* target = params->browser->GetTabContentsAt(singleton_index); | 547 TabContents* target = params->browser->GetTabContentsAt(singleton_index); |
542 | 548 |
543 if (target->is_crashed()) { | 549 if (target->is_crashed()) { |
544 target->controller().Reload(true); | 550 target->controller().Reload(true); |
545 } else if (params->path_behavior == NavigateParams::IGNORE_AND_NAVIGATE && | 551 } else if (params->path_behavior == NavigateParams::IGNORE_AND_NAVIGATE && |
546 target->GetURL() != params->url) { | 552 target->GetURL() != params->url) { |
547 InitializeExtraHeaders(params, NULL, &extra_headers); | 553 InitializeExtraHeaders(params, NULL, &extra_headers); |
548 target->controller().LoadURL( | 554 if (params->is_renderer_initiated) { |
549 params->url, params->referrer, params->transition, extra_headers); | 555 target->controller().LoadURLFromRenderer( |
| 556 params->url, params->referrer, params->transition, extra_headers); |
| 557 } else { |
| 558 target->controller().LoadURL( |
| 559 params->url, params->referrer, params->transition, extra_headers); |
| 560 } |
550 } | 561 } |
551 | 562 |
552 // If the singleton tab isn't already selected, select it. | 563 // If the singleton tab isn't already selected, select it. |
553 if (params->source_contents != params->target_contents) | 564 if (params->source_contents != params->target_contents) |
554 params->browser->ActivateTabAt(singleton_index, user_initiated); | 565 params->browser->ActivateTabAt(singleton_index, user_initiated); |
555 } | 566 } |
556 | 567 |
557 if (params->disposition != CURRENT_TAB) { | 568 if (params->disposition != CURRENT_TAB) { |
558 NotificationService::current()->Notify( | 569 NotificationService::current()->Notify( |
559 content::NOTIFICATION_TAB_ADDED, | 570 content::NOTIFICATION_TAB_ADDED, |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
601 rewritten_url, replacements)) { | 612 rewritten_url, replacements)) { |
602 params->target_contents = tab; | 613 params->target_contents = tab; |
603 return tab_index; | 614 return tab_index; |
604 } | 615 } |
605 } | 616 } |
606 | 617 |
607 return -1; | 618 return -1; |
608 } | 619 } |
609 | 620 |
610 } // namespace browser | 621 } // namespace browser |
OLD | NEW |