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