| Index: chrome/browser/ui/browser.cc
|
| ===================================================================
|
| --- chrome/browser/ui/browser.cc (revision 224205)
|
| +++ chrome/browser/ui/browser.cc (working copy)
|
| @@ -1047,71 +1047,6 @@
|
| instant_controller_->TabDeactivated(contents);
|
| }
|
|
|
| -void Browser::ActiveTabChanged(WebContents* old_contents,
|
| - WebContents* new_contents,
|
| - int index,
|
| - int reason) {
|
| - content::RecordAction(UserMetricsAction("ActiveTabChanged"));
|
| -
|
| - // Discarded tabs always get reloaded.
|
| - if (tab_strip_model_->IsTabDiscarded(index)) {
|
| - LOG(WARNING) << "Reloading discarded tab at " << index;
|
| - static int reload_count = 0;
|
| - UMA_HISTOGRAM_CUSTOM_COUNTS(
|
| - "Tabs.Discard.ReloadCount", ++reload_count, 1, 1000, 50);
|
| - chrome::Reload(this, CURRENT_TAB);
|
| - }
|
| -
|
| - // If we have any update pending, do it now.
|
| - if (chrome_updater_factory_.HasWeakPtrs() && old_contents)
|
| - ProcessPendingUIUpdates();
|
| -
|
| - // Propagate the profile to the location bar.
|
| - UpdateToolbar((reason & CHANGE_REASON_REPLACED) == 0);
|
| -
|
| - // Propagate tab state to toolbar, tab-strip, etc.
|
| - UpdateSearchState(new_contents);
|
| -
|
| - // Update reload/stop state.
|
| - command_controller_->LoadingStateChanged(new_contents->IsLoading(), true);
|
| -
|
| - // Update commands to reflect current state.
|
| - command_controller_->TabStateChanged();
|
| -
|
| - // Reset the status bubble.
|
| - StatusBubble* status_bubble = GetStatusBubble();
|
| - if (status_bubble) {
|
| - status_bubble->Hide();
|
| -
|
| - // Show the loading state (if any).
|
| - status_bubble->SetStatus(CoreTabHelper::FromWebContents(
|
| - tab_strip_model_->GetActiveWebContents())->GetStatusText());
|
| - }
|
| -
|
| - if (HasFindBarController()) {
|
| - find_bar_controller_->ChangeWebContents(new_contents);
|
| - find_bar_controller_->find_bar()->MoveWindowIfNecessary(gfx::Rect(), true);
|
| - }
|
| -
|
| - // Update sessions. Don't force creation of sessions. If sessions doesn't
|
| - // exist, the change will be picked up by sessions when created.
|
| - SessionService* session_service =
|
| - SessionServiceFactory::GetForProfileIfExisting(profile_);
|
| - if (session_service && !tab_strip_model_->closing_all()) {
|
| - session_service->SetSelectedTabInWindow(session_id(),
|
| - tab_strip_model_->active_index());
|
| - }
|
| -
|
| - UpdateBookmarkBarState(BOOKMARK_BAR_STATE_CHANGE_TAB_SWITCH);
|
| -
|
| - // This needs to be called after UpdateSearchState().
|
| - if (instant_controller_)
|
| - instant_controller_->ActiveTabChanged();
|
| -
|
| - autofill::TabAutofillManagerDelegate::FromWebContents(new_contents)->
|
| - TabActivated(reason);
|
| -}
|
| -
|
| void Browser::TabMoved(WebContents* contents,
|
| int from_index,
|
| int to_index) {
|
| @@ -1177,6 +1112,71 @@
|
| instant_controller_.reset();
|
| }
|
|
|
| +void Browser::OnActiveTabChanged(WebContents* old_contents,
|
| + WebContents* new_contents,
|
| + int index,
|
| + int reason) {
|
| + content::RecordAction(UserMetricsAction("ActiveTabChanged"));
|
| +
|
| + // Discarded tabs always get reloaded.
|
| + if (tab_strip_model_->IsTabDiscarded(index)) {
|
| + LOG(WARNING) << "Reloading discarded tab at " << index;
|
| + static int reload_count = 0;
|
| + UMA_HISTOGRAM_CUSTOM_COUNTS(
|
| + "Tabs.Discard.ReloadCount", ++reload_count, 1, 1000, 50);
|
| + chrome::Reload(this, CURRENT_TAB);
|
| + }
|
| +
|
| + // If we have any update pending, do it now.
|
| + if (chrome_updater_factory_.HasWeakPtrs() && old_contents)
|
| + ProcessPendingUIUpdates();
|
| +
|
| + // Propagate the profile to the location bar.
|
| + UpdateToolbar((reason & CHANGE_REASON_REPLACED) == 0);
|
| +
|
| + // Propagate tab state to toolbar, tab-strip, etc.
|
| + UpdateSearchState(new_contents);
|
| +
|
| + // Update reload/stop state.
|
| + command_controller_->LoadingStateChanged(new_contents->IsLoading(), true);
|
| +
|
| + // Update commands to reflect current state.
|
| + command_controller_->TabStateChanged();
|
| +
|
| + // Reset the status bubble.
|
| + StatusBubble* status_bubble = GetStatusBubble();
|
| + if (status_bubble) {
|
| + status_bubble->Hide();
|
| +
|
| + // Show the loading state (if any).
|
| + status_bubble->SetStatus(CoreTabHelper::FromWebContents(
|
| + tab_strip_model_->GetActiveWebContents())->GetStatusText());
|
| + }
|
| +
|
| + if (HasFindBarController()) {
|
| + find_bar_controller_->ChangeWebContents(new_contents);
|
| + find_bar_controller_->find_bar()->MoveWindowIfNecessary(gfx::Rect(), true);
|
| + }
|
| +
|
| + // Update sessions. Don't force creation of sessions. If sessions doesn't
|
| + // exist, the change will be picked up by sessions when created.
|
| + SessionService* session_service =
|
| + SessionServiceFactory::GetForProfileIfExisting(profile_);
|
| + if (session_service && !tab_strip_model_->closing_all()) {
|
| + session_service->SetSelectedTabInWindow(session_id(),
|
| + tab_strip_model_->active_index());
|
| + }
|
| +
|
| + UpdateBookmarkBarState(BOOKMARK_BAR_STATE_CHANGE_TAB_SWITCH);
|
| +
|
| + // This needs to be called after UpdateSearchState().
|
| + if (instant_controller_)
|
| + instant_controller_->ActiveTabChanged();
|
| +
|
| + autofill::TabAutofillManagerDelegate::FromWebContents(new_contents)->
|
| + TabActivated(reason);
|
| +}
|
| +
|
| bool Browser::CanOverscrollContent() const {
|
| #if defined(USE_AURA)
|
| bool overscroll_enabled = CommandLine::ForCurrentProcess()->
|
|
|