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

Side by Side Diff: chrome/browser/profiles/profile_manager.cc

Issue 8093016: Show sync promo at startup (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix build error Created 9 years, 2 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/chromeos/login/login_utils.cc ('k') | chrome/browser/ui/browser_browsertest.cc » ('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 <set> 5 #include <set>
6 6
7 #include "chrome/browser/profiles/profile_manager.h" 7 #include "chrome/browser/profiles/profile_manager.h"
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/file_path.h" 10 #include "base/file_path.h"
11 #include "base/file_util.h" 11 #include "base/file_util.h"
12 #include "base/stl_util.h" 12 #include "base/stl_util.h"
13 #include "base/string_number_conversions.h" 13 #include "base/string_number_conversions.h"
14 #include "base/string_util.h" 14 #include "base/string_util.h"
15 #include "base/utf_string_conversions.h" 15 #include "base/utf_string_conversions.h"
16 #include "chrome/browser/browser_process.h" 16 #include "chrome/browser/browser_process.h"
17 #include "chrome/browser/prefs/pref_service.h" 17 #include "chrome/browser/prefs/pref_service.h"
18 #include "chrome/browser/prefs/scoped_user_pref_update.h" 18 #include "chrome/browser/prefs/scoped_user_pref_update.h"
19 #include "chrome/browser/profiles/profile_info_cache.h" 19 #include "chrome/browser/profiles/profile_info_cache.h"
20 #include "chrome/browser/sessions/session_service_factory.h" 20 #include "chrome/browser/sessions/session_service_factory.h"
21 #include "chrome/browser/sync/profile_sync_service.h" 21 #include "chrome/browser/sync/profile_sync_service.h"
22 #include "chrome/browser/ui/browser_init.h"
22 #include "chrome/browser/ui/browser_window.h" 23 #include "chrome/browser/ui/browser_window.h"
24 #include "chrome/browser/ui/webui/sync_promo_ui.h"
23 #include "chrome/common/chrome_notification_types.h" 25 #include "chrome/common/chrome_notification_types.h"
24 #include "chrome/common/chrome_constants.h" 26 #include "chrome/common/chrome_constants.h"
25 #include "chrome/common/chrome_switches.h" 27 #include "chrome/common/chrome_switches.h"
26 #include "chrome/common/logging_chrome.h" 28 #include "chrome/common/logging_chrome.h"
27 #include "chrome/common/pref_names.h" 29 #include "chrome/common/pref_names.h"
28 #include "chrome/common/url_constants.h" 30 #include "chrome/common/url_constants.h"
29 #include "content/browser/browser_thread.h" 31 #include "content/browser/browser_thread.h"
30 #include "content/common/notification_service.h" 32 #include "content/common/notification_service.h"
31 #include "grit/generated_resources.h" 33 #include "grit/generated_resources.h"
32 #include "net/http/http_transaction_factory.h" 34 #include "net/http/http_transaction_factory.h"
(...skipping 25 matching lines...) Expand all
58 60
59 // The NewProfileLauncher class is created when to wait for a multi-profile 61 // The NewProfileLauncher class is created when to wait for a multi-profile
60 // to be created asynchronously. Upon completion of profile creation, the 62 // to be created asynchronously. Upon completion of profile creation, the
61 // NPL takes care of launching a new browser window and signing the user 63 // NPL takes care of launching a new browser window and signing the user
62 // in to their Google account. 64 // in to their Google account.
63 class NewProfileLauncher : public ProfileManagerObserver { 65 class NewProfileLauncher : public ProfileManagerObserver {
64 public: 66 public:
65 virtual void OnProfileCreated(Profile* profile, Status status) { 67 virtual void OnProfileCreated(Profile* profile, Status status) {
66 if (status == STATUS_INITIALIZED) { 68 if (status == STATUS_INITIALIZED) {
67 DCHECK(profile); 69 DCHECK(profile);
68 Browser* browser = Browser::Create(profile); 70 CommandLine command_line(CommandLine::NO_PROGRAM);
69 browser->AddSelectedTabWithURL(GURL(chrome::kChromeUINewTabURL), 71 int return_code;
70 PageTransition::LINK); 72 BrowserInit browser_init;
71 browser->window()->Show(); 73 browser_init.LaunchBrowser(
74 command_line, profile, FilePath(), BrowserInit::IS_PROCESS_STARTUP,
75 BrowserInit::IS_FIRST_RUN, &return_code);
72 } 76 }
73 } 77 }
74 78
75 virtual bool DeleteAfter() OVERRIDE { return true; } 79 virtual bool DeleteAfter() OVERRIDE { return true; }
76 }; 80 };
77 81
78 // static 82 // static
79 void ProfileManager::ShutdownSessionServices() { 83 void ProfileManager::ShutdownSessionServices() {
80 ProfileManager* pm = g_browser_process->profile_manager(); 84 ProfileManager* pm = g_browser_process->profile_manager();
81 if (!pm) // Is NULL when running unit tests. 85 if (!pm) // Is NULL when running unit tests.
(...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after
580 ProfileManagerWithoutInit::ProfileManagerWithoutInit( 584 ProfileManagerWithoutInit::ProfileManagerWithoutInit(
581 const FilePath& user_data_dir) : ProfileManager(user_data_dir) { 585 const FilePath& user_data_dir) : ProfileManager(user_data_dir) {
582 } 586 }
583 587
584 void ProfileManager::RegisterTestingProfile(Profile* profile, 588 void ProfileManager::RegisterTestingProfile(Profile* profile,
585 bool add_to_cache) { 589 bool add_to_cache) {
586 RegisterProfile(profile, true); 590 RegisterProfile(profile, true);
587 if (add_to_cache) 591 if (add_to_cache)
588 AddProfileToCache(profile); 592 AddProfileToCache(profile);
589 } 593 }
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/login_utils.cc ('k') | chrome/browser/ui/browser_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698