| 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 #ifndef CHROME_BROWSER_PROFILES_PROFILE_SHORTCUT_MANAGER_WIN_H_ | 5 #ifndef CHROME_BROWSER_PROFILES_PROFILE_SHORTCUT_MANAGER_WIN_H_ |
| 6 #define CHROME_BROWSER_PROFILES_PROFILE_SHORTCUT_MANAGER_WIN_H_ | 6 #define CHROME_BROWSER_PROFILES_PROFILE_SHORTCUT_MANAGER_WIN_H_ |
| 7 | 7 |
| 8 #include "chrome/browser/profiles/profile_shortcut_manager.h" | 8 #include "chrome/browser/profiles/profile_shortcut_manager.h" |
| 9 | 9 |
| 10 class BrowserDistribution; | 10 class BrowserDistribution; |
| 11 | 11 |
| 12 // Internal free-standing functions that are exported here for testing. | 12 // Internal free-standing functions that are exported here for testing. |
| 13 namespace profiles { | 13 namespace profiles { |
| 14 namespace internal { | 14 namespace internal { |
| 15 | 15 |
| 16 // Returns the default shortcut filename for the given profile name, | 16 // Returns the default shortcut filename for the given profile name, |
| 17 // given |distribution|. Returns a filename appropriate for a | 17 // given |distribution|. Returns a filename appropriate for a |
| 18 // single-user installation if |profile_name| is empty. | 18 // single-user installation if |profile_name| is empty. |
| 19 string16 GetShortcutFilenameForProfile(const string16& profile_name, | 19 string16 GetShortcutFilenameForProfile(const string16& profile_name, |
| 20 BrowserDistribution* distribution); | 20 BrowserDistribution* distribution); |
| 21 | 21 |
| 22 // Returns the command-line flags to launch Chrome with the given profile. |
| 23 string16 CreateProfileShortcutFlags(const FilePath& profile_path); |
| 24 |
| 22 } // namespace internal | 25 } // namespace internal |
| 23 } // namespace profiles | 26 } // namespace profiles |
| 24 | 27 |
| 25 class ProfileShortcutManagerWin : public ProfileShortcutManager, | 28 class ProfileShortcutManagerWin : public ProfileShortcutManager, |
| 26 public ProfileInfoCacheObserver { | 29 public ProfileInfoCacheObserver { |
| 27 public: | 30 public: |
| 28 explicit ProfileShortcutManagerWin(ProfileManager* manager); | 31 explicit ProfileShortcutManagerWin(ProfileManager* manager); |
| 29 virtual ~ProfileShortcutManagerWin(); | 32 virtual ~ProfileShortcutManagerWin(); |
| 30 | 33 |
| 31 // ProfileShortcutManager implementation: | 34 // ProfileShortcutManager implementation: |
| 32 virtual void CreateProfileShortcut(const FilePath& profile_path) OVERRIDE; | 35 virtual void CreateProfileShortcut(const FilePath& profile_path) OVERRIDE; |
| 33 | 36 |
| 34 // ProfileInfoCacheObserver implementation: | 37 // ProfileInfoCacheObserver implementation: |
| 35 virtual void OnProfileAdded(const FilePath& profile_path) OVERRIDE; | 38 virtual void OnProfileAdded(const FilePath& profile_path) OVERRIDE; |
| 36 virtual void OnProfileWillBeRemoved(const FilePath& profile_path) OVERRIDE; | 39 virtual void OnProfileWillBeRemoved(const FilePath& profile_path) OVERRIDE; |
| 37 virtual void OnProfileWasRemoved(const FilePath& profile_path, | 40 virtual void OnProfileWasRemoved(const FilePath& profile_path, |
| 38 const string16& profile_name) OVERRIDE; | 41 const string16& profile_name) OVERRIDE; |
| 39 virtual void OnProfileNameChanged(const FilePath& profile_path, | 42 virtual void OnProfileNameChanged(const FilePath& profile_path, |
| 40 const string16& old_profile_name) OVERRIDE; | 43 const string16& old_profile_name) OVERRIDE; |
| 41 virtual void OnProfileAvatarChanged(const FilePath& profile_path) OVERRIDE; | 44 virtual void OnProfileAvatarChanged(const FilePath& profile_path) OVERRIDE; |
| 42 | 45 |
| 43 private: | 46 private: |
| 44 void StartProfileShortcutNameChange(const FilePath& profile_path, | 47 void StartProfileShortcutNameChange(const FilePath& profile_path, |
| 45 const string16& old_profile_name); | 48 const string16& old_profile_name); |
| 49 |
| 46 // Gives the profile path of an alternate profile than |profile_path|. | 50 // Gives the profile path of an alternate profile than |profile_path|. |
| 47 // Must only be called when the number profiles is 2. | 51 // Must only be called when the number profiles is 2. |
| 48 FilePath GetOtherProfilePath(const FilePath& profile_path); | 52 FilePath GetOtherProfilePath(const FilePath& profile_path); |
| 53 |
| 54 enum CreateOrUpdateMode { |
| 55 UPDATE_EXISTING_ONLY, |
| 56 CREATE_WHEN_NONE_FOUND, |
| 57 }; |
| 58 enum NonProfileShortcutAction { |
| 59 IGNORE_NON_PROFILE_SHORTCUTS, |
| 60 UPDATE_NON_PROFILE_SHORTCUTS, |
| 61 }; |
| 49 void UpdateShortcutsForProfileAtPath(const FilePath& profile_path, | 62 void UpdateShortcutsForProfileAtPath(const FilePath& profile_path, |
| 50 bool create_always); | 63 CreateOrUpdateMode create_mode, |
| 64 NonProfileShortcutAction action); |
| 51 | 65 |
| 52 ProfileManager* profile_manager_; | 66 ProfileManager* profile_manager_; |
| 53 | 67 |
| 54 DISALLOW_COPY_AND_ASSIGN(ProfileShortcutManagerWin); | 68 DISALLOW_COPY_AND_ASSIGN(ProfileShortcutManagerWin); |
| 55 }; | 69 }; |
| 56 | 70 |
| 57 #endif // CHROME_BROWSER_PROFILES_PROFILE_SHORTCUT_MANAGER_WIN_H_ | 71 #endif // CHROME_BROWSER_PROFILES_PROFILE_SHORTCUT_MANAGER_WIN_H_ |
| OLD | NEW |