| 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 <shlobj.h> // For SHChangeNotify(). | 7 #include <shlobj.h> // For SHChangeNotify(). |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 636 base::ASCIIToUTF16( | 636 base::ASCIIToUTF16( |
| 637 switches::kProfileDirectory).c_str(), | 637 switches::kProfileDirectory).c_str(), |
| 638 profile_path.BaseName().value().c_str()); | 638 profile_path.BaseName().value().c_str()); |
| 639 } | 639 } |
| 640 | 640 |
| 641 } // namespace internal | 641 } // namespace internal |
| 642 } // namespace profiles | 642 } // namespace profiles |
| 643 | 643 |
| 644 // static | 644 // static |
| 645 bool ProfileShortcutManager::IsFeatureEnabled() { | 645 bool ProfileShortcutManager::IsFeatureEnabled() { |
| 646 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 646 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
| 647 return command_line->HasSwitch(switches::kEnableProfileShortcutManager) || | 647 return command_line->HasSwitch(switches::kEnableProfileShortcutManager) || |
| 648 (BrowserDistribution::GetDistribution()->CanCreateDesktopShortcuts() && | 648 (BrowserDistribution::GetDistribution()->CanCreateDesktopShortcuts() && |
| 649 !command_line->HasSwitch(switches::kUserDataDir)); | 649 !command_line->HasSwitch(switches::kUserDataDir)); |
| 650 } | 650 } |
| 651 | 651 |
| 652 // static | 652 // static |
| 653 ProfileShortcutManager* ProfileShortcutManager::Create( | 653 ProfileShortcutManager* ProfileShortcutManager::Create( |
| 654 ProfileManager* manager) { | 654 ProfileManager* manager) { |
| 655 return new ProfileShortcutManagerWin(manager); | 655 return new ProfileShortcutManagerWin(manager); |
| 656 } | 656 } |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 694 void ProfileShortcutManagerWin::HasProfileShortcuts( | 694 void ProfileShortcutManagerWin::HasProfileShortcuts( |
| 695 const base::FilePath& profile_path, | 695 const base::FilePath& profile_path, |
| 696 const base::Callback<void(bool)>& callback) { | 696 const base::Callback<void(bool)>& callback) { |
| 697 BrowserThread::PostTaskAndReplyWithResult( | 697 BrowserThread::PostTaskAndReplyWithResult( |
| 698 BrowserThread::FILE, FROM_HERE, | 698 BrowserThread::FILE, FROM_HERE, |
| 699 base::Bind(&HasAnyProfileShortcuts, profile_path), callback); | 699 base::Bind(&HasAnyProfileShortcuts, profile_path), callback); |
| 700 } | 700 } |
| 701 | 701 |
| 702 void ProfileShortcutManagerWin::GetShortcutProperties( | 702 void ProfileShortcutManagerWin::GetShortcutProperties( |
| 703 const base::FilePath& profile_path, | 703 const base::FilePath& profile_path, |
| 704 CommandLine* command_line, | 704 base::CommandLine* command_line, |
| 705 base::string16* name, | 705 base::string16* name, |
| 706 base::FilePath* icon_path) { | 706 base::FilePath* icon_path) { |
| 707 base::FilePath chrome_exe; | 707 base::FilePath chrome_exe; |
| 708 if (!PathService::Get(base::FILE_EXE, &chrome_exe)) { | 708 if (!PathService::Get(base::FILE_EXE, &chrome_exe)) { |
| 709 NOTREACHED(); | 709 NOTREACHED(); |
| 710 return; | 710 return; |
| 711 } | 711 } |
| 712 | 712 |
| 713 const ProfileInfoCache& cache = profile_manager_->GetProfileInfoCache(); | 713 const ProfileInfoCache& cache = profile_manager_->GetProfileInfoCache(); |
| 714 size_t profile_index = cache.GetIndexOfProfileWithPath(profile_path); | 714 size_t profile_index = cache.GetIndexOfProfileWithPath(profile_path); |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 865 // Ensure the profile's icon file has been created. | 865 // Ensure the profile's icon file has been created. |
| 866 CreateOrUpdateProfileIcon(profile->GetPath()); | 866 CreateOrUpdateProfileIcon(profile->GetPath()); |
| 867 } | 867 } |
| 868 break; | 868 break; |
| 869 } | 869 } |
| 870 default: | 870 default: |
| 871 NOTREACHED(); | 871 NOTREACHED(); |
| 872 break; | 872 break; |
| 873 } | 873 } |
| 874 } | 874 } |
| OLD | NEW |