| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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.h" | 5 #include "chrome/browser/ui/browser.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 871 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 882 NULL); | 882 NULL); |
| 883 } | 883 } |
| 884 | 884 |
| 885 void Browser::UpdateDownloadShelfVisibility(bool visible) { | 885 void Browser::UpdateDownloadShelfVisibility(bool visible) { |
| 886 if (GetStatusBubble()) | 886 if (GetStatusBubble()) |
| 887 GetStatusBubble()->UpdateDownloadShelfVisibility(visible); | 887 GetStatusBubble()->UpdateDownloadShelfVisibility(visible); |
| 888 } | 888 } |
| 889 | 889 |
| 890 /////////////////////////////////////////////////////////////////////////////// | 890 /////////////////////////////////////////////////////////////////////////////// |
| 891 | 891 |
| 892 void Browser::UpdateUIForNavigationInTab(WebContents* contents, | 892 void Browser::UpdateUIForNavigationInTab( |
| 893 ui::PageTransition transition, | 893 WebContents* contents, |
| 894 bool user_initiated) { | 894 ui::PageTransition transition, |
| 895 chrome::NavigateParams::WindowAction action, |
| 896 bool user_initiated) { |
| 895 tab_strip_model_->TabNavigating(contents, transition); | 897 tab_strip_model_->TabNavigating(contents, transition); |
| 896 | 898 |
| 897 bool contents_is_selected = | 899 bool contents_is_selected = |
| 898 contents == tab_strip_model_->GetActiveWebContents(); | 900 contents == tab_strip_model_->GetActiveWebContents(); |
| 899 if (user_initiated && contents_is_selected && window()->GetLocationBar()) { | 901 if (user_initiated && contents_is_selected && window()->GetLocationBar()) { |
| 900 // Forcibly reset the location bar if the url is going to change in the | 902 // Forcibly reset the location bar if the url is going to change in the |
| 901 // current tab, since otherwise it won't discard any ongoing user edits, | 903 // current tab, since otherwise it won't discard any ongoing user edits, |
| 902 // since it doesn't realize this is a user-initiated action. | 904 // since it doesn't realize this is a user-initiated action. |
| 903 window()->GetLocationBar()->Revert(); | 905 window()->GetLocationBar()->Revert(); |
| 904 } | 906 } |
| 905 | 907 |
| 906 if (GetStatusBubble()) | 908 if (GetStatusBubble()) |
| 907 GetStatusBubble()->Hide(); | 909 GetStatusBubble()->Hide(); |
| 908 | 910 |
| 909 // Update the location bar. This is synchronous. We specifically don't | 911 // Update the location bar. This is synchronous. We specifically don't |
| 910 // update the load state since the load hasn't started yet and updating it | 912 // update the load state since the load hasn't started yet and updating it |
| 911 // will put it out of sync with the actual state like whether we're | 913 // will put it out of sync with the actual state like whether we're |
| 912 // displaying a favicon, which controls the throbber. If we updated it here, | 914 // displaying a favicon, which controls the throbber. If we updated it here, |
| 913 // the throbber will show the default favicon for a split second when | 915 // the throbber will show the default favicon for a split second when |
| 914 // navigating away from the new tab page. | 916 // navigating away from the new tab page. |
| 915 ScheduleUIUpdate(contents, content::INVALIDATE_TYPE_URL); | 917 ScheduleUIUpdate(contents, content::INVALIDATE_TYPE_URL); |
| 916 | 918 |
| 917 if (contents_is_selected) | 919 if (contents_is_selected && |
| 920 (window()->IsActive() || action == chrome::NavigateParams::SHOW_WINDOW)) { |
| 918 contents->SetInitialFocus(); | 921 contents->SetInitialFocus(); |
| 922 } |
| 919 } | 923 } |
| 920 | 924 |
| 921 void Browser::ShowModalSigninWindow(profiles::BubbleViewMode mode, | 925 void Browser::ShowModalSigninWindow(profiles::BubbleViewMode mode, |
| 922 signin_metrics::AccessPoint access_point) { | 926 signin_metrics::AccessPoint access_point) { |
| 923 signin_view_controller_.ShowModalSignin(mode, this, access_point); | 927 signin_view_controller_.ShowModalSignin(mode, this, access_point); |
| 924 } | 928 } |
| 925 | 929 |
| 926 void Browser::CloseModalSigninWindow() { | 930 void Browser::CloseModalSigninWindow() { |
| 927 signin_view_controller_.CloseModalSignin(); | 931 signin_view_controller_.CloseModalSignin(); |
| 928 } | 932 } |
| (...skipping 1671 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2600 if (contents && !allow_js_access) { | 2604 if (contents && !allow_js_access) { |
| 2601 contents->web_contents()->GetController().LoadURL( | 2605 contents->web_contents()->GetController().LoadURL( |
| 2602 target_url, | 2606 target_url, |
| 2603 content::Referrer(), | 2607 content::Referrer(), |
| 2604 ui::PAGE_TRANSITION_LINK, | 2608 ui::PAGE_TRANSITION_LINK, |
| 2605 std::string()); // No extra headers. | 2609 std::string()); // No extra headers. |
| 2606 } | 2610 } |
| 2607 | 2611 |
| 2608 return contents != NULL; | 2612 return contents != NULL; |
| 2609 } | 2613 } |
| OLD | NEW |