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

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

Issue 8741023: Do not create shortcuts on Windows if the "no-first-run" switch is on. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: addressed comments Created 9 years 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 | no next file » | 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"
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 registrar_.Add( 207 registrar_.Add(
208 this, 208 this,
209 chrome::NOTIFICATION_LOGIN_USER_CHANGED, 209 chrome::NOTIFICATION_LOGIN_USER_CHANGED,
210 content::NotificationService::AllSources()); 210 content::NotificationService::AllSources());
211 #endif 211 #endif
212 } 212 }
213 213
214 ProfileManager::~ProfileManager() { 214 ProfileManager::~ProfileManager() {
215 BrowserList::RemoveObserver(this); 215 BrowserList::RemoveObserver(this);
216 #if defined(OS_WIN) 216 #if defined(OS_WIN)
217 profile_info_cache_->RemoveObserver(profile_shortcut_manager_.get()); 217 if (profile_shortcut_manager_.get())
218 profile_info_cache_->RemoveObserver(profile_shortcut_manager_.get());
218 #endif 219 #endif
219 } 220 }
220 221
221 FilePath ProfileManager::GetDefaultProfileDir( 222 FilePath ProfileManager::GetDefaultProfileDir(
222 const FilePath& user_data_dir) { 223 const FilePath& user_data_dir) {
223 FilePath default_profile_dir(user_data_dir); 224 FilePath default_profile_dir(user_data_dir);
224 default_profile_dir = 225 default_profile_dir =
225 default_profile_dir.AppendASCII(chrome::kInitialProfile); 226 default_profile_dir.AppendASCII(chrome::kInitialProfile);
226 return default_profile_dir; 227 return default_profile_dir;
227 } 228 }
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
586 } else { 587 } else {
587 return pair1.first < pair2.first; 588 return pair1.first < pair2.first;
588 } 589 }
589 } 590 }
590 591
591 ProfileInfoCache& ProfileManager::GetProfileInfoCache() { 592 ProfileInfoCache& ProfileManager::GetProfileInfoCache() {
592 if (!profile_info_cache_.get()) { 593 if (!profile_info_cache_.get()) {
593 profile_info_cache_.reset(new ProfileInfoCache( 594 profile_info_cache_.reset(new ProfileInfoCache(
594 g_browser_process->local_state(), user_data_dir_)); 595 g_browser_process->local_state(), user_data_dir_));
595 #if defined(OS_WIN) 596 #if defined(OS_WIN)
596 profile_shortcut_manager_.reset(new ProfileShortcutManagerWin()); 597 const CommandLine& command_line = *CommandLine::ForCurrentProcess();
597 profile_info_cache_->AddObserver(profile_shortcut_manager_.get()); 598 if (!command_line.HasSwitch(switches::kNoFirstRun)) {
599 profile_shortcut_manager_.reset(new ProfileShortcutManagerWin());
600 profile_info_cache_->AddObserver(profile_shortcut_manager_.get());
601 }
598 #endif 602 #endif
599 } 603 }
600 return *profile_info_cache_.get(); 604 return *profile_info_cache_.get();
601 } 605 }
602 606
603 void ProfileManager::AddProfileToCache(Profile* profile) { 607 void ProfileManager::AddProfileToCache(Profile* profile) {
604 ProfileInfoCache& cache = GetProfileInfoCache(); 608 ProfileInfoCache& cache = GetProfileInfoCache();
605 if (profile->GetPath().DirName() != cache.GetUserDataDir()) 609 if (profile->GetPath().DirName() != cache.GetUserDataDir())
606 return; 610 return;
607 611
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
705 RegisterProfile(profile, true); 709 RegisterProfile(profile, true);
706 if (add_to_cache) 710 if (add_to_cache)
707 AddProfileToCache(profile); 711 AddProfileToCache(profile);
708 } 712 }
709 713
710 #if defined(OS_WIN) 714 #if defined(OS_WIN)
711 void ProfileManager::RemoveProfileShortcutManagerForTesting() { 715 void ProfileManager::RemoveProfileShortcutManagerForTesting() {
712 profile_info_cache_->RemoveObserver(profile_shortcut_manager_.get()); 716 profile_info_cache_->RemoveObserver(profile_shortcut_manager_.get());
713 } 717 }
714 #endif 718 #endif
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698