| 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 584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 595 void ProfileShortcutManagerWin::HasProfileShortcuts( | 595 void ProfileShortcutManagerWin::HasProfileShortcuts( |
| 596 const base::FilePath& profile_path, | 596 const base::FilePath& profile_path, |
| 597 const base::Callback<void(bool)>& callback) { | 597 const base::Callback<void(bool)>& callback) { |
| 598 BrowserThread::PostTaskAndReplyWithResult( | 598 BrowserThread::PostTaskAndReplyWithResult( |
| 599 BrowserThread::FILE, FROM_HERE, | 599 BrowserThread::FILE, FROM_HERE, |
| 600 base::Bind(&HasAnyProfileShortcuts, profile_path), callback); | 600 base::Bind(&HasAnyProfileShortcuts, profile_path), callback); |
| 601 } | 601 } |
| 602 | 602 |
| 603 void ProfileShortcutManagerWin::OnProfileAdded( | 603 void ProfileShortcutManagerWin::OnProfileAdded( |
| 604 const base::FilePath& profile_path) { | 604 const base::FilePath& profile_path) { |
| 605 const size_t profile_count = | 605 if (profile_manager_->GetProfileInfoCache().GetNumberOfProfiles() == 2) { |
| 606 profile_manager_->GetProfileInfoCache().GetNumberOfProfiles(); | 606 // When the second profile is added, make existing non-profile shortcuts |
| 607 if (profile_count == 1) { | 607 // point to the first profile and be badged/named appropriately. |
| 608 CreateOrUpdateShortcutsForProfileAtPath(profile_path, | |
| 609 CREATE_WHEN_NONE_FOUND, | |
| 610 UPDATE_NON_PROFILE_SHORTCUTS); | |
| 611 } else if (profile_count == 2) { | |
| 612 CreateOrUpdateShortcutsForProfileAtPath(GetOtherProfilePath(profile_path), | 608 CreateOrUpdateShortcutsForProfileAtPath(GetOtherProfilePath(profile_path), |
| 613 UPDATE_EXISTING_ONLY, | 609 UPDATE_EXISTING_ONLY, |
| 614 UPDATE_NON_PROFILE_SHORTCUTS); | 610 UPDATE_NON_PROFILE_SHORTCUTS); |
| 615 } | 611 } |
| 616 } | 612 } |
| 617 | 613 |
| 618 void ProfileShortcutManagerWin::OnProfileWillBeRemoved( | 614 void ProfileShortcutManagerWin::OnProfileWillBeRemoved( |
| 619 const base::FilePath& profile_path) { | 615 const base::FilePath& profile_path) { |
| 620 } | 616 } |
| 621 | 617 |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 704 BrowserThread::PostTask( | 700 BrowserThread::PostTask( |
| 705 BrowserThread::FILE, FROM_HERE, | 701 BrowserThread::FILE, FROM_HERE, |
| 706 base::Bind(&CreateOrUpdateDesktopShortcutsForProfile, profile_path, | 702 base::Bind(&CreateOrUpdateDesktopShortcutsForProfile, profile_path, |
| 707 old_shortcut_appended_name, new_shortcut_appended_name, | 703 old_shortcut_appended_name, new_shortcut_appended_name, |
| 708 avatar_bitmap_copy_1x, avatar_bitmap_copy_2x, create_mode, | 704 avatar_bitmap_copy_1x, avatar_bitmap_copy_2x, create_mode, |
| 709 action)); | 705 action)); |
| 710 | 706 |
| 711 cache->SetShortcutNameOfProfileAtIndex(profile_index, | 707 cache->SetShortcutNameOfProfileAtIndex(profile_index, |
| 712 new_shortcut_appended_name); | 708 new_shortcut_appended_name); |
| 713 } | 709 } |
| OLD | NEW |