| 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 "chrome/browser/profiles/profile_shortcut_manager_win.h" | 5 #include "chrome/browser/profiles/profile_shortcut_manager_win.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| 11 #include "base/command_line.h" |
| 11 #include "base/file_util.h" | 12 #include "base/file_util.h" |
| 12 #include "base/path_service.h" | 13 #include "base/path_service.h" |
| 13 #include "base/string16.h" | 14 #include "base/string16.h" |
| 14 #include "base/stringprintf.h" | 15 #include "base/stringprintf.h" |
| 15 #include "base/utf_string_conversions.h" | 16 #include "base/utf_string_conversions.h" |
| 16 #include "base/win/shortcut.h" | 17 #include "base/win/shortcut.h" |
| 17 #include "chrome/browser/app_icon_win.h" | 18 #include "chrome/browser/app_icon_win.h" |
| 18 #include "chrome/browser/browser_process.h" | 19 #include "chrome/browser/browser_process.h" |
| 19 #include "chrome/browser/profiles/profile_info_cache_observer.h" | 20 #include "chrome/browser/profiles/profile_info_cache_observer.h" |
| 20 #include "chrome/browser/profiles/profile_info_util.h" | 21 #include "chrome/browser/profiles/profile_info_util.h" |
| (...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 return base::StringPrintf(L"--%ls=\"%ls\"", | 301 return base::StringPrintf(L"--%ls=\"%ls\"", |
| 301 ASCIIToUTF16(switches::kProfileDirectory).c_str(), | 302 ASCIIToUTF16(switches::kProfileDirectory).c_str(), |
| 302 profile_path.BaseName().value().c_str()); | 303 profile_path.BaseName().value().c_str()); |
| 303 } | 304 } |
| 304 | 305 |
| 305 } // namespace internal | 306 } // namespace internal |
| 306 } // namespace profiles | 307 } // namespace profiles |
| 307 | 308 |
| 308 // static | 309 // static |
| 309 bool ProfileShortcutManager::IsFeatureEnabled() { | 310 bool ProfileShortcutManager::IsFeatureEnabled() { |
| 310 return BrowserDistribution::GetDistribution()->CanCreateDesktopShortcuts(); | 311 return BrowserDistribution::GetDistribution()->CanCreateDesktopShortcuts() && |
| 312 !CommandLine::ForCurrentProcess()->HasSwitch(switches::kUserDataDir); |
| 311 } | 313 } |
| 312 | 314 |
| 313 // static | 315 // static |
| 314 ProfileShortcutManager* ProfileShortcutManager::Create( | 316 ProfileShortcutManager* ProfileShortcutManager::Create( |
| 315 ProfileManager* manager) { | 317 ProfileManager* manager) { |
| 316 return new ProfileShortcutManagerWin(manager); | 318 return new ProfileShortcutManagerWin(manager); |
| 317 } | 319 } |
| 318 | 320 |
| 319 ProfileShortcutManagerWin::ProfileShortcutManagerWin(ProfileManager* manager) | 321 ProfileShortcutManagerWin::ProfileShortcutManagerWin(ProfileManager* manager) |
| 320 : profile_manager_(manager) { | 322 : profile_manager_(manager) { |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 459 } | 461 } |
| 460 BrowserThread::PostTask( | 462 BrowserThread::PostTask( |
| 461 BrowserThread::FILE, FROM_HERE, | 463 BrowserThread::FILE, FROM_HERE, |
| 462 base::Bind(&CreateOrUpdateDesktopShortcutsForProfile, | 464 base::Bind(&CreateOrUpdateDesktopShortcutsForProfile, |
| 463 profile_path, new_shortcut_appended_name, | 465 profile_path, new_shortcut_appended_name, |
| 464 profile_avatar_bitmap_copy, create_mode, action)); | 466 profile_avatar_bitmap_copy, create_mode, action)); |
| 465 | 467 |
| 466 cache->SetShortcutNameOfProfileAtIndex(profile_index, | 468 cache->SetShortcutNameOfProfileAtIndex(profile_index, |
| 467 new_shortcut_appended_name); | 469 new_shortcut_appended_name); |
| 468 } | 470 } |
| OLD | NEW |