| OLD | NEW |
| 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 <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/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 681 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 692 } | 692 } |
| 693 } | 693 } |
| 694 | 694 |
| 695 ProfileInfoCache& ProfileManager::GetProfileInfoCache() { | 695 ProfileInfoCache& ProfileManager::GetProfileInfoCache() { |
| 696 if (!profile_info_cache_.get()) { | 696 if (!profile_info_cache_.get()) { |
| 697 profile_info_cache_.reset(new ProfileInfoCache( | 697 profile_info_cache_.reset(new ProfileInfoCache( |
| 698 g_browser_process->local_state(), user_data_dir_)); | 698 g_browser_process->local_state(), user_data_dir_)); |
| 699 #if defined(OS_WIN) | 699 #if defined(OS_WIN) |
| 700 BrowserDistribution* dist = BrowserDistribution::GetDistribution(); | 700 BrowserDistribution* dist = BrowserDistribution::GetDistribution(); |
| 701 ProfileShortcutManagerWin* shortcut_manager = CreateShortcutManager(); | 701 ProfileShortcutManagerWin* shortcut_manager = CreateShortcutManager(); |
| 702 if (dist && dist->CanCreateDesktopShortcuts() && shortcut_manager) { | 702 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
| 703 if (dist && dist->CanCreateDesktopShortcuts() && shortcut_manager && |
| 704 !command_line.HasSwitch(switches::kDisableDesktopShortcuts)) { |
| 703 profile_shortcut_manager_.reset(shortcut_manager); | 705 profile_shortcut_manager_.reset(shortcut_manager); |
| 704 profile_info_cache_->AddObserver(profile_shortcut_manager_.get()); | 706 profile_info_cache_->AddObserver(profile_shortcut_manager_.get()); |
| 705 } | 707 } |
| 706 #endif | 708 #endif |
| 707 } | 709 } |
| 708 return *profile_info_cache_.get(); | 710 return *profile_info_cache_.get(); |
| 709 } | 711 } |
| 710 | 712 |
| 711 void ProfileManager::AddProfileToCache(Profile* profile) { | 713 void ProfileManager::AddProfileToCache(Profile* profile) { |
| 712 ProfileInfoCache& cache = GetProfileInfoCache(); | 714 ProfileInfoCache& cache = GetProfileInfoCache(); |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 879 AddProfileToCache(profile); | 881 AddProfileToCache(profile); |
| 880 } | 882 } |
| 881 } | 883 } |
| 882 | 884 |
| 883 void ProfileManager::RunCallbacks(const std::vector<CreateCallback>& callbacks, | 885 void ProfileManager::RunCallbacks(const std::vector<CreateCallback>& callbacks, |
| 884 Profile* profile, | 886 Profile* profile, |
| 885 Profile::CreateStatus status) { | 887 Profile::CreateStatus status) { |
| 886 for (size_t i = 0; i < callbacks.size(); ++i) | 888 for (size_t i = 0; i < callbacks.size(); ++i) |
| 887 callbacks[i].Run(profile, status); | 889 callbacks[i].Run(profile, status); |
| 888 } | 890 } |
| OLD | NEW |