| 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 // Name of the badged icon file generated for a given profile. |
| 17 extern const char kProfileIconFileName[]; |
| 18 |
| 16 // Returns the default shortcut filename for the given profile name, | 19 // Returns the default shortcut filename for the given profile name, |
| 17 // given |distribution|. Returns a filename appropriate for a | 20 // given |distribution|. Returns a filename appropriate for a |
| 18 // single-user installation if |profile_name| is empty. | 21 // single-user installation if |profile_name| is empty. |
| 19 string16 GetShortcutFilenameForProfile(const string16& profile_name, | 22 string16 GetShortcutFilenameForProfile(const string16& profile_name, |
| 20 BrowserDistribution* distribution); | 23 BrowserDistribution* distribution); |
| 21 | 24 |
| 25 // Returns the command-line flags to launch Chrome with the given profile. |
| 26 string16 CreateProfileShortcutFlags(const FilePath& profile_path); |
| 27 |
| 22 } // namespace internal | 28 } // namespace internal |
| 23 } // namespace profiles | 29 } // namespace profiles |
| 24 | 30 |
| 25 class ProfileShortcutManagerWin : public ProfileShortcutManager, | 31 class ProfileShortcutManagerWin : public ProfileShortcutManager, |
| 26 public ProfileInfoCacheObserver { | 32 public ProfileInfoCacheObserver { |
| 27 public: | 33 public: |
| 34 // Specifies whether a new shortcut should be created if none exist. |
| 35 enum CreateOrUpdateMode { |
| 36 UPDATE_EXISTING_ONLY, |
| 37 CREATE_WHEN_NONE_FOUND, |
| 38 }; |
| 39 // Specifies whether non-profile shortcuts should be updated. |
| 40 enum NonProfileShortcutAction { |
| 41 IGNORE_NON_PROFILE_SHORTCUTS, |
| 42 UPDATE_NON_PROFILE_SHORTCUTS, |
| 43 }; |
| 44 |
| 28 explicit ProfileShortcutManagerWin(ProfileManager* manager); | 45 explicit ProfileShortcutManagerWin(ProfileManager* manager); |
| 29 virtual ~ProfileShortcutManagerWin(); | 46 virtual ~ProfileShortcutManagerWin(); |
| 30 | 47 |
| 31 // ProfileShortcutManager implementation: | 48 // ProfileShortcutManager implementation: |
| 32 virtual void CreateProfileShortcut(const FilePath& profile_path) OVERRIDE; | 49 virtual void CreateProfileShortcut(const FilePath& profile_path) OVERRIDE; |
| 33 | 50 |
| 34 // ProfileInfoCacheObserver implementation: | 51 // ProfileInfoCacheObserver implementation: |
| 35 virtual void OnProfileAdded(const FilePath& profile_path) OVERRIDE; | 52 virtual void OnProfileAdded(const FilePath& profile_path) OVERRIDE; |
| 36 virtual void OnProfileWillBeRemoved(const FilePath& profile_path) OVERRIDE; | 53 virtual void OnProfileWillBeRemoved(const FilePath& profile_path) OVERRIDE; |
| 37 virtual void OnProfileWasRemoved(const FilePath& profile_path, | 54 virtual void OnProfileWasRemoved(const FilePath& profile_path, |
| 38 const string16& profile_name) OVERRIDE; | 55 const string16& profile_name) OVERRIDE; |
| 39 virtual void OnProfileNameChanged(const FilePath& profile_path, | 56 virtual void OnProfileNameChanged(const FilePath& profile_path, |
| 40 const string16& old_profile_name) OVERRIDE; | 57 const string16& old_profile_name) OVERRIDE; |
| 41 virtual void OnProfileAvatarChanged(const FilePath& profile_path) OVERRIDE; | 58 virtual void OnProfileAvatarChanged(const FilePath& profile_path) OVERRIDE; |
| 42 | 59 |
| 43 private: | 60 private: |
| 44 void StartProfileShortcutNameChange(const FilePath& profile_path, | 61 void StartProfileShortcutNameChange(const FilePath& profile_path, |
| 45 const string16& old_profile_name); | 62 const string16& old_profile_name); |
| 63 |
| 46 // Gives the profile path of an alternate profile than |profile_path|. | 64 // Gives the profile path of an alternate profile than |profile_path|. |
| 47 // Must only be called when the number profiles is 2. | 65 // Must only be called when the number profiles is 2. |
| 48 FilePath GetOtherProfilePath(const FilePath& profile_path); | 66 FilePath GetOtherProfilePath(const FilePath& profile_path); |
| 49 void UpdateShortcutsForProfileAtPath(const FilePath& profile_path, | 67 |
| 50 bool create_always); | 68 void CreateOrUpdateShortcutsForProfileAtPath(const FilePath& profile_path, |
| 69 CreateOrUpdateMode create_mode, |
| 70 NonProfileShortcutAction action); |
| 51 | 71 |
| 52 ProfileManager* profile_manager_; | 72 ProfileManager* profile_manager_; |
| 53 | 73 |
| 54 DISALLOW_COPY_AND_ASSIGN(ProfileShortcutManagerWin); | 74 DISALLOW_COPY_AND_ASSIGN(ProfileShortcutManagerWin); |
| 55 }; | 75 }; |
| 56 | 76 |
| 57 #endif // CHROME_BROWSER_PROFILES_PROFILE_SHORTCUT_MANAGER_WIN_H_ | 77 #endif // CHROME_BROWSER_PROFILES_PROFILE_SHORTCUT_MANAGER_WIN_H_ |
| OLD | NEW |