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

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

Issue 6901031: Profile shouldn't own Session/TabRestore services. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase again and hope upload works this time Created 9 years, 7 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
« no previous file with comments | « chrome/browser/ui/browser.cc ('k') | chrome/browser/ui/cocoa/history_menu_bridge.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_init.h" 5 #include "chrome/browser/ui/browser_init.h"
6 6
7 #include <algorithm> // For max(). 7 #include <algorithm> // For max().
8 8
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/environment.h" 10 #include "base/environment.h"
(...skipping 22 matching lines...) Expand all
33 #include "chrome/browser/platform_util.h" 33 #include "chrome/browser/platform_util.h"
34 #include "chrome/browser/prefs/pref_service.h" 34 #include "chrome/browser/prefs/pref_service.h"
35 #include "chrome/browser/prefs/session_startup_pref.h" 35 #include "chrome/browser/prefs/session_startup_pref.h"
36 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service.h" 36 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service.h"
37 #include "chrome/browser/printing/print_dialog_cloud.h" 37 #include "chrome/browser/printing/print_dialog_cloud.h"
38 #include "chrome/browser/profiles/profile.h" 38 #include "chrome/browser/profiles/profile.h"
39 #include "chrome/browser/search_engines/template_url.h" 39 #include "chrome/browser/search_engines/template_url.h"
40 #include "chrome/browser/search_engines/template_url_model.h" 40 #include "chrome/browser/search_engines/template_url_model.h"
41 #include "chrome/browser/sessions/session_restore.h" 41 #include "chrome/browser/sessions/session_restore.h"
42 #include "chrome/browser/sessions/session_service.h" 42 #include "chrome/browser/sessions/session_service.h"
43 #include "chrome/browser/sessions/session_service_factory.h"
43 #include "chrome/browser/shell_integration.h" 44 #include "chrome/browser/shell_integration.h"
44 #include "chrome/browser/tab_contents/confirm_infobar_delegate.h" 45 #include "chrome/browser/tab_contents/confirm_infobar_delegate.h"
45 #include "chrome/browser/tab_contents/simple_alert_infobar_delegate.h" 46 #include "chrome/browser/tab_contents/simple_alert_infobar_delegate.h"
46 #include "chrome/browser/tabs/pinned_tab_codec.h" 47 #include "chrome/browser/tabs/pinned_tab_codec.h"
47 #include "chrome/browser/tabs/tab_strip_model.h" 48 #include "chrome/browser/tabs/tab_strip_model.h"
48 #include "chrome/browser/ui/browser_list.h" 49 #include "chrome/browser/ui/browser_list.h"
49 #include "chrome/browser/ui/browser_navigator.h" 50 #include "chrome/browser/ui/browser_navigator.h"
50 #include "chrome/browser/ui/browser_window.h" 51 #include "chrome/browser/ui/browser_window.h"
51 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" 52 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
52 #include "chrome/common/chrome_constants.h" 53 #include "chrome/common/chrome_constants.h"
(...skipping 794 matching lines...) Expand 10 before | Expand all | Expand 10 after
847 // If we're starting up in "background mode" (no open browser window) then 848 // If we're starting up in "background mode" (no open browser window) then
848 // don't open any browser windows. 849 // don't open any browser windows.
849 if (process_startup && command_line_.HasSwitch(switches::kNoStartupWindow)) 850 if (process_startup && command_line_.HasSwitch(switches::kNoStartupWindow))
850 return; 851 return;
851 852
852 if (process_startup && ProcessStartupURLs(urls_to_open)) { 853 if (process_startup && ProcessStartupURLs(urls_to_open)) {
853 // ProcessStartupURLs processed the urls, nothing else to do. 854 // ProcessStartupURLs processed the urls, nothing else to do.
854 return; 855 return;
855 } 856 }
856 857
857 if (!process_startup && 858 if (!process_startup) {
858 (profile_->GetSessionService() && 859 SessionService* service = SessionServiceFactory::GetForProfile(profile_);
859 profile_->GetSessionService()->RestoreIfNecessary(urls_to_open))) { 860 if (service && service->RestoreIfNecessary(urls_to_open)) {
860 // We're already running and session restore wanted to run. This can happen 861 // We're already running and session restore wanted to run. This can
861 // at various points, such as if there is only an app window running and the 862 // happen at various points, such as if there is only an app window
862 // user double clicked the chrome icon. Return so we don't open the urls. 863 // running and the user double clicked the chrome icon. Return so we don't
863 return; 864 // open the urls.
865 return;
866 }
864 } 867 }
865 868
866 // Session restore didn't occur, open the urls. 869 // Session restore didn't occur, open the urls.
867 870
868 Browser* browser = NULL; 871 Browser* browser = NULL;
869 std::vector<GURL> adjust_urls = urls_to_open; 872 std::vector<GURL> adjust_urls = urls_to_open;
870 if (adjust_urls.empty()) 873 if (adjust_urls.empty())
871 AddStartupURLs(&adjust_urls); 874 AddStartupURLs(&adjust_urls);
872 else if (!command_line_.HasSwitch(switches::kOpenInNewWindow)) 875 else if (!command_line_.HasSwitch(switches::kOpenInNewWindow))
873 browser = BrowserList::GetLastActiveWithProfile(profile_); 876 browser = BrowserList::GetLastActiveWithProfile(profile_);
(...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after
1388 return false; 1391 return false;
1389 automation->SetExpectedTabCount(expected_tabs); 1392 automation->SetExpectedTabCount(expected_tabs);
1390 1393
1391 AutomationProviderList* list = 1394 AutomationProviderList* list =
1392 g_browser_process->InitAutomationProviderList(); 1395 g_browser_process->InitAutomationProviderList();
1393 DCHECK(list); 1396 DCHECK(list);
1394 list->AddProvider(automation); 1397 list->AddProvider(automation);
1395 1398
1396 return true; 1399 return true;
1397 } 1400 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/browser.cc ('k') | chrome/browser/ui/cocoa/history_menu_bridge.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698