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 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
8 #include <windows.h> | 8 #include <windows.h> |
9 #include <shellapi.h> | 9 #include <shellapi.h> |
10 #endif // defined(OS_WIN) | 10 #endif // defined(OS_WIN) |
(...skipping 896 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
907 | 907 |
908 content::NotificationService::current()->Notify( | 908 content::NotificationService::current()->Notify( |
909 chrome::NOTIFICATION_TAB_PARENTED, | 909 chrome::NOTIFICATION_TAB_PARENTED, |
910 content::Source<content::WebContents>(contents), | 910 content::Source<content::WebContents>(contents), |
911 content::NotificationService::NoDetails()); | 911 content::NotificationService::NoDetails()); |
912 | 912 |
913 SyncHistoryWithTabs(index); | 913 SyncHistoryWithTabs(index); |
914 | 914 |
915 // Make sure the loading state is updated correctly, otherwise the throbber | 915 // Make sure the loading state is updated correctly, otherwise the throbber |
916 // won't start if the page is loading. | 916 // won't start if the page is loading. |
917 LoadingStateChanged(contents); | 917 LoadingStateChanged(contents, true); |
918 | 918 |
919 interstitial_observers_.push_back(new InterstitialObserver(this, contents)); | 919 interstitial_observers_.push_back(new InterstitialObserver(this, contents)); |
920 | 920 |
921 SessionService* session_service = | 921 SessionService* session_service = |
922 SessionServiceFactory::GetForProfile(profile_); | 922 SessionServiceFactory::GetForProfile(profile_); |
923 if (session_service) { | 923 if (session_service) { |
924 session_service->TabInserted(contents); | 924 session_service->TabInserted(contents); |
925 int new_active_index = tab_strip_model_->active_index(); | 925 int new_active_index = tab_strip_model_->active_index(); |
926 if (index < new_active_index) | 926 if (index < new_active_index) |
927 session_service->SetSelectedTabInWindow(session_id(), | 927 session_service->SetSelectedTabInWindow(session_id(), |
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1332 void Browser::ActivateContents(WebContents* contents) { | 1332 void Browser::ActivateContents(WebContents* contents) { |
1333 tab_strip_model_->ActivateTabAt( | 1333 tab_strip_model_->ActivateTabAt( |
1334 tab_strip_model_->GetIndexOfWebContents(contents), false); | 1334 tab_strip_model_->GetIndexOfWebContents(contents), false); |
1335 window_->Activate(); | 1335 window_->Activate(); |
1336 } | 1336 } |
1337 | 1337 |
1338 void Browser::DeactivateContents(WebContents* contents) { | 1338 void Browser::DeactivateContents(WebContents* contents) { |
1339 window_->Deactivate(); | 1339 window_->Deactivate(); |
1340 } | 1340 } |
1341 | 1341 |
1342 void Browser::LoadingStateChanged(WebContents* source) { | 1342 void Browser::LoadingStateChanged(WebContents* source, |
| 1343 bool to_different_document) { |
1343 window_->UpdateLoadingAnimations(tab_strip_model_->TabsAreLoading()); | 1344 window_->UpdateLoadingAnimations(tab_strip_model_->TabsAreLoading()); |
1344 window_->UpdateTitleBar(); | 1345 window_->UpdateTitleBar(); |
1345 | 1346 |
1346 WebContents* selected_contents = tab_strip_model_->GetActiveWebContents(); | 1347 WebContents* selected_contents = tab_strip_model_->GetActiveWebContents(); |
1347 if (source == selected_contents) { | 1348 if (source == selected_contents) { |
1348 bool is_loading = source->IsLoading(); | 1349 bool is_loading = source->IsLoading() && to_different_document; |
1349 command_controller_->LoadingStateChanged(is_loading, false); | 1350 command_controller_->LoadingStateChanged(is_loading, false); |
1350 if (GetStatusBubble()) { | 1351 if (GetStatusBubble()) { |
1351 GetStatusBubble()->SetStatus(CoreTabHelper::FromWebContents( | 1352 GetStatusBubble()->SetStatus(CoreTabHelper::FromWebContents( |
1352 tab_strip_model_->GetActiveWebContents())->GetStatusText()); | 1353 tab_strip_model_->GetActiveWebContents())->GetStatusText()); |
1353 } | 1354 } |
1354 } | 1355 } |
1355 } | 1356 } |
1356 | 1357 |
1357 void Browser::CloseContents(WebContents* source) { | 1358 void Browser::CloseContents(WebContents* source) { |
1358 bool can_close_contents; | 1359 bool can_close_contents; |
(...skipping 1001 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2360 if (contents && !allow_js_access) { | 2361 if (contents && !allow_js_access) { |
2361 contents->web_contents()->GetController().LoadURL( | 2362 contents->web_contents()->GetController().LoadURL( |
2362 target_url, | 2363 target_url, |
2363 content::Referrer(), | 2364 content::Referrer(), |
2364 content::PAGE_TRANSITION_LINK, | 2365 content::PAGE_TRANSITION_LINK, |
2365 std::string()); // No extra headers. | 2366 std::string()); // No extra headers. |
2366 } | 2367 } |
2367 | 2368 |
2368 return contents != NULL; | 2369 return contents != NULL; |
2369 } | 2370 } |
OLD | NEW |