Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(152)

Side by Side Diff: chrome/browser/ui/browser.cc

Issue 1332003002: Add option to disallow the discarding of a tab that was previously discarded. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: sky@ comments + fix tests. Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 #include "chrome/browser/ui/search/search_tab_helper.h" 125 #include "chrome/browser/ui/search/search_tab_helper.h"
126 #include "chrome/browser/ui/search_engines/search_engine_tab_helper.h" 126 #include "chrome/browser/ui/search_engines/search_engine_tab_helper.h"
127 #include "chrome/browser/ui/settings_window_manager.h" 127 #include "chrome/browser/ui/settings_window_manager.h"
128 #include "chrome/browser/ui/singleton_tabs.h" 128 #include "chrome/browser/ui/singleton_tabs.h"
129 #include "chrome/browser/ui/status_bubble.h" 129 #include "chrome/browser/ui/status_bubble.h"
130 #include "chrome/browser/ui/sync/browser_synced_window_delegate.h" 130 #include "chrome/browser/ui/sync/browser_synced_window_delegate.h"
131 #include "chrome/browser/ui/tab_contents/core_tab_helper.h" 131 #include "chrome/browser/ui/tab_contents/core_tab_helper.h"
132 #include "chrome/browser/ui/tab_dialogs.h" 132 #include "chrome/browser/ui/tab_dialogs.h"
133 #include "chrome/browser/ui/tab_helpers.h" 133 #include "chrome/browser/ui/tab_helpers.h"
134 #include "chrome/browser/ui/tab_modal_confirm_dialog.h" 134 #include "chrome/browser/ui/tab_modal_confirm_dialog.h"
135 #include "chrome/browser/ui/tabs/tab_discard_state.h"
135 #include "chrome/browser/ui/tabs/tab_menu_model.h" 136 #include "chrome/browser/ui/tabs/tab_menu_model.h"
136 #include "chrome/browser/ui/tabs/tab_strip_model.h" 137 #include "chrome/browser/ui/tabs/tab_strip_model.h"
137 #include "chrome/browser/ui/tabs/tab_strip_model_utils.h" 138 #include "chrome/browser/ui/tabs/tab_strip_model_utils.h"
138 #include "chrome/browser/ui/tabs/tab_utils.h" 139 #include "chrome/browser/ui/tabs/tab_utils.h"
139 #include "chrome/browser/ui/toolbar/toolbar_model_impl.h" 140 #include "chrome/browser/ui/toolbar/toolbar_model_impl.h"
140 #include "chrome/browser/ui/unload_controller.h" 141 #include "chrome/browser/ui/unload_controller.h"
141 #include "chrome/browser/ui/validation_message_bubble.h" 142 #include "chrome/browser/ui/validation_message_bubble.h"
142 #include "chrome/browser/ui/website_settings/permission_bubble_manager.h" 143 #include "chrome/browser/ui/website_settings/permission_bubble_manager.h"
143 #include "chrome/browser/ui/webui/signin/login_ui_service.h" 144 #include "chrome/browser/ui/webui/signin/login_ui_service.h"
144 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" 145 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h"
(...skipping 902 matching lines...) Expand 10 before | Expand all | Expand 10 after
1047 1048
1048 // Let the BrowserWindow do its handling. On e.g. views this changes the 1049 // Let the BrowserWindow do its handling. On e.g. views this changes the
1049 // focused object, which should happen before we update the toolbar below, 1050 // focused object, which should happen before we update the toolbar below,
1050 // since the omnibox expects the correct element to already be focused when it 1051 // since the omnibox expects the correct element to already be focused when it
1051 // is updated. 1052 // is updated.
1052 window_->OnActiveTabChanged(old_contents, new_contents, index, reason); 1053 window_->OnActiveTabChanged(old_contents, new_contents, index, reason);
1053 1054
1054 exclusive_access_manager_->OnTabDetachedFromView(old_contents); 1055 exclusive_access_manager_->OnTabDetachedFromView(old_contents);
1055 1056
1056 // Discarded tabs always get reloaded. 1057 // Discarded tabs always get reloaded.
1057 if (tab_strip_model_->IsTabDiscarded(index)) { 1058 if (TabDiscardState::IsDiscarded(new_contents)) {
1058 LOG(WARNING) << "Reloading discarded tab at " << index; 1059 LOG(WARNING) << "Reloading discarded tab at " << index;
1059 static int reload_count = 0; 1060 static int reload_count = 0;
1060 UMA_HISTOGRAM_CUSTOM_COUNTS( 1061 UMA_HISTOGRAM_CUSTOM_COUNTS(
1061 "Tabs.Discard.ReloadCount", ++reload_count, 1, 1000, 50); 1062 "Tabs.Discard.ReloadCount", ++reload_count, 1, 1000, 50);
1062 chrome::Reload(this, CURRENT_TAB); 1063 chrome::Reload(this, CURRENT_TAB);
1063 } 1064 }
1064 1065
1065 // If we have any update pending, do it now. 1066 // If we have any update pending, do it now.
1066 if (chrome_updater_factory_.HasWeakPtrs() && old_contents) 1067 if (chrome_updater_factory_.HasWeakPtrs() && old_contents)
1067 ProcessPendingUIUpdates(); 1068 ProcessPendingUIUpdates();
(...skipping 1634 matching lines...) Expand 10 before | Expand all | Expand 10 after
2702 if (contents && !allow_js_access) { 2703 if (contents && !allow_js_access) {
2703 contents->web_contents()->GetController().LoadURL( 2704 contents->web_contents()->GetController().LoadURL(
2704 target_url, 2705 target_url,
2705 content::Referrer(), 2706 content::Referrer(),
2706 ui::PAGE_TRANSITION_LINK, 2707 ui::PAGE_TRANSITION_LINK,
2707 std::string()); // No extra headers. 2708 std::string()); // No extra headers.
2708 } 2709 }
2709 2710
2710 return contents != NULL; 2711 return contents != NULL;
2711 } 2712 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698