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 748 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
759 size_t current_profile_index = cache.GetIndexOfProfileWithPath(profile_path); | 759 size_t current_profile_index = cache.GetIndexOfProfileWithPath(profile_path); |
760 size_t other_profile_index = (current_profile_index == 0) ? 1 : 0; | 760 size_t other_profile_index = (current_profile_index == 0) ? 1 : 0; |
761 return cache.GetPathOfProfileAtIndex(other_profile_index); | 761 return cache.GetPathOfProfileAtIndex(other_profile_index); |
762 } | 762 } |
763 | 763 |
764 void ProfileShortcutManagerWin::CreateOrUpdateShortcutsForProfileAtPath( | 764 void ProfileShortcutManagerWin::CreateOrUpdateShortcutsForProfileAtPath( |
765 const base::FilePath& profile_path, | 765 const base::FilePath& profile_path, |
766 CreateOrUpdateMode create_mode, | 766 CreateOrUpdateMode create_mode, |
767 NonProfileShortcutAction action, | 767 NonProfileShortcutAction action, |
768 const base::Closure& callback) { | 768 const base::Closure& callback) { |
769 DCHECK(!BrowserThread::IsWellKnownThread(BrowserThread::UI) || | 769 DCHECK(!BrowserThread::IsThreadInitialized(BrowserThread::UI) || |
770 BrowserThread::CurrentlyOn(BrowserThread::UI)); | 770 BrowserThread::CurrentlyOn(BrowserThread::UI)); |
771 CreateOrUpdateShortcutsParams params(profile_path, create_mode, action); | 771 CreateOrUpdateShortcutsParams params(profile_path, create_mode, action); |
772 | 772 |
773 ProfileInfoCache* cache = &profile_manager_->GetProfileInfoCache(); | 773 ProfileInfoCache* cache = &profile_manager_->GetProfileInfoCache(); |
774 size_t profile_index = cache->GetIndexOfProfileWithPath(profile_path); | 774 size_t profile_index = cache->GetIndexOfProfileWithPath(profile_path); |
775 if (profile_index == std::string::npos) | 775 if (profile_index == std::string::npos) |
776 return; | 776 return; |
777 bool remove_badging = cache->GetNumberOfProfiles() == 1; | 777 bool remove_badging = cache->GetNumberOfProfiles() == 1; |
778 | 778 |
779 params.old_profile_name = | 779 params.old_profile_name = |
780 cache->GetShortcutNameOfProfileAtIndex(profile_index); | 780 cache->GetShortcutNameOfProfileAtIndex(profile_index); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
826 profile->GetPath(), | 826 profile->GetPath(), |
827 base::Bind(&OnProfileIconCreateSuccess, profile->GetPath())); | 827 base::Bind(&OnProfileIconCreateSuccess, profile->GetPath())); |
828 } | 828 } |
829 break; | 829 break; |
830 } | 830 } |
831 default: | 831 default: |
832 NOTREACHED(); | 832 NOTREACHED(); |
833 break; | 833 break; |
834 } | 834 } |
835 } | 835 } |
OLD | NEW |