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

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

Issue 10891044: RestoreTabHelper > SessionTabHelper, move more session stuff into it. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 // OS_WIN 10 #endif // OS_WIN
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 #include "chrome/browser/platform_util.h" 71 #include "chrome/browser/platform_util.h"
72 #include "chrome/browser/prefs/incognito_mode_prefs.h" 72 #include "chrome/browser/prefs/incognito_mode_prefs.h"
73 #include "chrome/browser/prefs/pref_service.h" 73 #include "chrome/browser/prefs/pref_service.h"
74 #include "chrome/browser/printing/cloud_print/cloud_print_setup_flow.h" 74 #include "chrome/browser/printing/cloud_print/cloud_print_setup_flow.h"
75 #include "chrome/browser/printing/print_preview_tab_controller.h" 75 #include "chrome/browser/printing/print_preview_tab_controller.h"
76 #include "chrome/browser/profiles/profile.h" 76 #include "chrome/browser/profiles/profile.h"
77 #include "chrome/browser/profiles/profile_destroyer.h" 77 #include "chrome/browser/profiles/profile_destroyer.h"
78 #include "chrome/browser/profiles/profile_manager.h" 78 #include "chrome/browser/profiles/profile_manager.h"
79 #include "chrome/browser/profiles/profile_metrics.h" 79 #include "chrome/browser/profiles/profile_metrics.h"
80 #include "chrome/browser/repost_form_warning_controller.h" 80 #include "chrome/browser/repost_form_warning_controller.h"
81 #include "chrome/browser/sessions/restore_tab_helper.h"
82 #include "chrome/browser/sessions/session_service.h" 81 #include "chrome/browser/sessions/session_service.h"
83 #include "chrome/browser/sessions/session_service_factory.h" 82 #include "chrome/browser/sessions/session_service_factory.h"
83 #include "chrome/browser/sessions/session_tab_helper.h"
84 #include "chrome/browser/sessions/session_types.h" 84 #include "chrome/browser/sessions/session_types.h"
85 #include "chrome/browser/sessions/tab_restore_service.h" 85 #include "chrome/browser/sessions/tab_restore_service.h"
86 #include "chrome/browser/sessions/tab_restore_service_factory.h" 86 #include "chrome/browser/sessions/tab_restore_service_factory.h"
87 #include "chrome/browser/sync/profile_sync_service.h" 87 #include "chrome/browser/sync/profile_sync_service.h"
88 #include "chrome/browser/sync/profile_sync_service_factory.h" 88 #include "chrome/browser/sync/profile_sync_service_factory.h"
89 #include "chrome/browser/sync/sync_ui_util.h" 89 #include "chrome/browser/sync/sync_ui_util.h"
90 #include "chrome/browser/tab_contents/background_contents.h" 90 #include "chrome/browser/tab_contents/background_contents.h"
91 #include "chrome/browser/tab_contents/retargeting_details.h" 91 #include "chrome/browser/tab_contents/retargeting_details.h"
92 #include "chrome/browser/tab_contents/tab_util.h" 92 #include "chrome/browser/tab_contents/tab_util.h"
93 #include "chrome/browser/themes/theme_service.h" 93 #include "chrome/browser/themes/theme_service.h"
(...skipping 925 matching lines...) Expand 10 before | Expand all | Expand 10 after
1019 return OpenURLFromTab(NULL, params); 1019 return OpenURLFromTab(NULL, params);
1020 } 1020 }
1021 1021
1022 /////////////////////////////////////////////////////////////////////////////// 1022 ///////////////////////////////////////////////////////////////////////////////
1023 // Browser, TabStripModelObserver implementation: 1023 // Browser, TabStripModelObserver implementation:
1024 1024
1025 void Browser::TabInsertedAt(TabContents* contents, 1025 void Browser::TabInsertedAt(TabContents* contents,
1026 int index, 1026 int index,
1027 bool foreground) { 1027 bool foreground) {
1028 SetAsDelegate(contents, this); 1028 SetAsDelegate(contents, this);
1029 contents->restore_tab_helper()->SetWindowID(session_id()); 1029 contents->session_tab_helper()->SetWindowID(session_id());
1030 1030
1031 SyncHistoryWithTabs(index); 1031 SyncHistoryWithTabs(index);
1032 1032
1033 // Make sure the loading state is updated correctly, otherwise the throbber 1033 // Make sure the loading state is updated correctly, otherwise the throbber
1034 // won't start if the page is loading. 1034 // won't start if the page is loading.
1035 LoadingStateChanged(contents->web_contents()); 1035 LoadingStateChanged(contents->web_contents());
1036 1036
1037 registrar_.Add(this, content::NOTIFICATION_INTERSTITIAL_ATTACHED, 1037 registrar_.Add(this, content::NOTIFICATION_INTERSTITIAL_ATTACHED,
1038 content::Source<WebContents>(contents->web_contents())); 1038 content::Source<WebContents>(contents->web_contents()));
1039 1039
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
1177 content::DevToolsManager::GetInstance()->ContentsReplaced( 1177 content::DevToolsManager::GetInstance()->ContentsReplaced(
1178 old_contents->web_contents(), new_contents->web_contents()); 1178 old_contents->web_contents(), new_contents->web_contents());
1179 } 1179 }
1180 1180
1181 void Browser::TabPinnedStateChanged(TabContents* contents, int index) { 1181 void Browser::TabPinnedStateChanged(TabContents* contents, int index) {
1182 SessionService* session_service = 1182 SessionService* session_service =
1183 SessionServiceFactory::GetForProfileIfExisting(profile()); 1183 SessionServiceFactory::GetForProfileIfExisting(profile());
1184 if (session_service) { 1184 if (session_service) {
1185 session_service->SetPinnedState( 1185 session_service->SetPinnedState(
1186 session_id(), 1186 session_id(),
1187 chrome::GetTabContentsAt(this, index)->restore_tab_helper()-> 1187 chrome::GetTabContentsAt(this, index)->session_tab_helper()->
1188 session_id(), 1188 session_id(),
1189 tab_strip_model_->IsTabPinned(index)); 1189 tab_strip_model_->IsTabPinned(index));
1190 } 1190 }
1191 } 1191 }
1192 1192
1193 void Browser::TabStripEmpty() { 1193 void Browser::TabStripEmpty() {
1194 // Close the frame after we return to the message loop (not immediately, 1194 // Close the frame after we return to the message loop (not immediately,
1195 // otherwise it will destroy this object before the stack has a chance to 1195 // otherwise it will destroy this object before the stack has a chance to
1196 // cleanly unwind.) 1196 // cleanly unwind.)
1197 // Note: This will be called several times if TabStripEmpty is called several 1197 // Note: This will be called several times if TabStripEmpty is called several
(...skipping 876 matching lines...) Expand 10 before | Expand all | Expand 10 after
2074 // Browser, Session restore functions (private): 2074 // Browser, Session restore functions (private):
2075 2075
2076 void Browser::SyncHistoryWithTabs(int index) { 2076 void Browser::SyncHistoryWithTabs(int index) {
2077 SessionService* session_service = 2077 SessionService* session_service =
2078 SessionServiceFactory::GetForProfileIfExisting(profile()); 2078 SessionServiceFactory::GetForProfileIfExisting(profile());
2079 if (session_service) { 2079 if (session_service) {
2080 for (int i = index; i < tab_count(); ++i) { 2080 for (int i = index; i < tab_count(); ++i) {
2081 TabContents* tab = chrome::GetTabContentsAt(this, i); 2081 TabContents* tab = chrome::GetTabContentsAt(this, i);
2082 if (tab) { 2082 if (tab) {
2083 session_service->SetTabIndexInWindow( 2083 session_service->SetTabIndexInWindow(
2084 session_id(), tab->restore_tab_helper()->session_id(), i); 2084 session_id(), tab->session_tab_helper()->session_id(), i);
2085 session_service->SetPinnedState( 2085 session_service->SetPinnedState(
2086 session_id(), 2086 session_id(),
2087 tab->restore_tab_helper()->session_id(), 2087 tab->session_tab_helper()->session_id(),
2088 tab_strip_model_->IsTabPinned(i)); 2088 tab_strip_model_->IsTabPinned(i));
2089 } 2089 }
2090 } 2090 }
2091 } 2091 }
2092 } 2092 }
2093 2093
2094 /////////////////////////////////////////////////////////////////////////////// 2094 ///////////////////////////////////////////////////////////////////////////////
2095 // Browser, In-progress download termination handling (private): 2095 // Browser, In-progress download termination handling (private):
2096 2096
2097 bool Browser::CanCloseWithInProgressDownloads() { 2097 bool Browser::CanCloseWithInProgressDownloads() {
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
2313 if (contents && !allow_js_access) { 2313 if (contents && !allow_js_access) {
2314 contents->web_contents()->GetController().LoadURL( 2314 contents->web_contents()->GetController().LoadURL(
2315 target_url, 2315 target_url,
2316 content::Referrer(), 2316 content::Referrer(),
2317 content::PAGE_TRANSITION_LINK, 2317 content::PAGE_TRANSITION_LINK,
2318 std::string()); // No extra headers. 2318 std::string()); // No extra headers.
2319 } 2319 }
2320 2320
2321 return contents != NULL; 2321 return contents != NULL;
2322 } 2322 }
OLDNEW
« no previous file with comments | « chrome/browser/sessions/session_tab_helper.cc ('k') | chrome/browser/ui/cocoa/applescript/tab_applescript.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698