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

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: comments 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 | « no previous file | chrome/browser/ui/browser_init.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_window.h" 22 #include "chrome/browser/ui/browser_window.h"
23 #include "chrome/browser/ui/webui/sync_promo_ui.h"
23 #include "chrome/common/chrome_notification_types.h" 24 #include "chrome/common/chrome_notification_types.h"
24 #include "chrome/common/chrome_constants.h" 25 #include "chrome/common/chrome_constants.h"
25 #include "chrome/common/chrome_switches.h" 26 #include "chrome/common/chrome_switches.h"
26 #include "chrome/common/logging_chrome.h" 27 #include "chrome/common/logging_chrome.h"
27 #include "chrome/common/pref_names.h" 28 #include "chrome/common/pref_names.h"
28 #include "chrome/common/url_constants.h" 29 #include "chrome/common/url_constants.h"
29 #include "content/browser/browser_thread.h" 30 #include "content/browser/browser_thread.h"
30 #include "content/common/notification_service.h" 31 #include "content/common/notification_service.h"
31 #include "grit/generated_resources.h" 32 #include "grit/generated_resources.h"
32 #include "net/http/http_transaction_factory.h" 33 #include "net/http/http_transaction_factory.h"
(...skipping 26 matching lines...) Expand all
59 // The NewProfileLauncher class is created when to wait for a multi-profile 60 // The NewProfileLauncher class is created when to wait for a multi-profile
60 // to be created asynchronously. Upon completion of profile creation, the 61 // to be created asynchronously. Upon completion of profile creation, the
61 // NPL takes care of launching a new browser window and signing the user 62 // NPL takes care of launching a new browser window and signing the user
62 // in to their Google account. 63 // in to their Google account.
63 class NewProfileLauncher : public ProfileManagerObserver { 64 class NewProfileLauncher : public ProfileManagerObserver {
64 public: 65 public:
65 virtual void OnProfileCreated(Profile* profile, Status status) { 66 virtual void OnProfileCreated(Profile* profile, Status status) {
66 if (status == STATUS_INITIALIZED) { 67 if (status == STATUS_INITIALIZED) {
67 DCHECK(profile); 68 DCHECK(profile);
68 Browser* browser = Browser::Create(profile); 69 Browser* browser = Browser::Create(profile);
69 browser->AddSelectedTabWithURL(GURL(chrome::kChromeUINewTabURL), 70 GURL url;
sky 2011/10/01 20:32:42 This doesn't seem right. Shouldn't we be calling i
sail 2011/10/01 21:37:34 This code is only called if the user adds a new pr
70 PageTransition::LINK); 71 if (SyncPromoUI::ShouldShowSyncPromoAtStartup(profile, true)) {
72 SyncPromoUI::DidShowSyncPromoAtStartup(profile);
73 url = GURL(chrome::kChromeUISyncPromoURL);
74 } else {
75 url = GURL(chrome::kChromeUINewTabURL);
76 }
77 browser->AddSelectedTabWithURL(url, PageTransition::LINK);
71 browser->window()->Show(); 78 browser->window()->Show();
72 } 79 }
73 } 80 }
74 81
75 virtual bool DeleteAfter() OVERRIDE { return true; } 82 virtual bool DeleteAfter() OVERRIDE { return true; }
76 }; 83 };
77 84
78 // static 85 // static
79 void ProfileManager::ShutdownSessionServices() { 86 void ProfileManager::ShutdownSessionServices() {
80 ProfileManager* pm = g_browser_process->profile_manager(); 87 ProfileManager* pm = g_browser_process->profile_manager();
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after
580 ProfileManagerWithoutInit::ProfileManagerWithoutInit( 587 ProfileManagerWithoutInit::ProfileManagerWithoutInit(
581 const FilePath& user_data_dir) : ProfileManager(user_data_dir) { 588 const FilePath& user_data_dir) : ProfileManager(user_data_dir) {
582 } 589 }
583 590
584 void ProfileManager::RegisterTestingProfile(Profile* profile, 591 void ProfileManager::RegisterTestingProfile(Profile* profile,
585 bool add_to_cache) { 592 bool add_to_cache) {
586 RegisterProfile(profile, true); 593 RegisterProfile(profile, true);
587 if (add_to_cache) 594 if (add_to_cache)
588 AddProfileToCache(profile); 595 AddProfileToCache(profile);
589 } 596 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/browser_init.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698