Chromium Code Reviews| 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. | 16 // Name of the badged icon file generated for a given profile. |
| 17 extern const char kProfileIconFileName[]; | 17 extern const char kProfileIconFileName[]; |
| 18 | 18 |
| 19 // Returns the full path to the profile icon file. | |
| 20 base::FilePath GetProfileIconPath(const base::FilePath& profile_path); | |
| 21 | |
| 19 // Returns the default shortcut filename for the given profile name, | 22 // Returns the default shortcut filename for the given profile name, |
| 20 // given |distribution|. Returns a filename appropriate for a | 23 // given |distribution|. Returns a filename appropriate for a |
| 21 // single-user installation if |profile_name| is empty. | 24 // single-user installation if |profile_name| is empty. |
| 22 string16 GetShortcutFilenameForProfile(const string16& profile_name, | 25 string16 GetShortcutFilenameForProfile(const string16& profile_name, |
| 23 BrowserDistribution* distribution); | 26 BrowserDistribution* distribution); |
| 24 | 27 |
| 25 // Returns the command-line flags to launch Chrome with the given profile. | 28 // Returns the command-line flags to launch Chrome with the given profile. |
| 26 string16 CreateProfileShortcutFlags(const base::FilePath& profile_path); | 29 string16 CreateProfileShortcutFlags(const base::FilePath& profile_path); |
| 27 | 30 |
| 28 } // namespace internal | 31 } // namespace internal |
| 29 } // namespace profiles | 32 } // namespace profiles |
| 30 | 33 |
| 31 class ProfileShortcutManagerWin : public ProfileShortcutManager, | 34 class ProfileShortcutManagerWin : public ProfileShortcutManager, |
| 32 public ProfileInfoCacheObserver { | 35 public ProfileInfoCacheObserver { |
| 33 public: | 36 public: |
| 34 // Specifies whether a new shortcut should be created if none exist. | 37 // Specifies whether the only existing shortcuts should be updated, a new |
|
gab
2013/05/07 12:38:39
s/the only/only the
calamity
2013/05/08 08:15:42
Done.
| |
| 38 // shortcut should be created if none exist, or only the icon for this profile | |
| 39 // should be updated. | |
|
gab
2013/05/07 12:38:39
s/updated./created in the profile directory.
calamity
2013/05/08 08:15:42
Done.
| |
| 35 enum CreateOrUpdateMode { | 40 enum CreateOrUpdateMode { |
| 36 UPDATE_EXISTING_ONLY, | 41 UPDATE_EXISTING_ONLY, |
| 37 CREATE_WHEN_NONE_FOUND, | 42 CREATE_WHEN_NONE_FOUND, |
| 43 CREATE_ICON_ONLY, | |
| 38 }; | 44 }; |
| 39 // Specifies whether non-profile shortcuts should be updated. | 45 // Specifies whether non-profile shortcuts should be updated. |
| 40 enum NonProfileShortcutAction { | 46 enum NonProfileShortcutAction { |
| 41 IGNORE_NON_PROFILE_SHORTCUTS, | 47 IGNORE_NON_PROFILE_SHORTCUTS, |
| 42 UPDATE_NON_PROFILE_SHORTCUTS, | 48 UPDATE_NON_PROFILE_SHORTCUTS, |
| 43 }; | 49 }; |
| 44 | 50 |
| 45 explicit ProfileShortcutManagerWin(ProfileManager* manager); | 51 explicit ProfileShortcutManagerWin(ProfileManager* manager); |
| 46 virtual ~ProfileShortcutManagerWin(); | 52 virtual ~ProfileShortcutManagerWin(); |
| 47 | 53 |
| 48 // ProfileShortcutManager implementation: | 54 // ProfileShortcutManager implementation: |
| 55 virtual void CreateProfileIcon( | |
| 56 const base::FilePath& profile_path) OVERRIDE; | |
|
Alexei Svitkine (slow)
2013/05/03 17:20:47
Please add a unit test for this. (i.e. create a pr
calamity
2013/05/08 08:15:42
Done.
| |
| 49 virtual void CreateProfileShortcut( | 57 virtual void CreateProfileShortcut( |
| 50 const base::FilePath& profile_path) OVERRIDE; | 58 const base::FilePath& profile_path) OVERRIDE; |
| 51 virtual void RemoveProfileShortcuts( | 59 virtual void RemoveProfileShortcuts( |
| 52 const base::FilePath& profile_path) OVERRIDE; | 60 const base::FilePath& profile_path) OVERRIDE; |
| 53 virtual void HasProfileShortcuts( | 61 virtual void HasProfileShortcuts( |
| 54 const base::FilePath& profile_path, | 62 const base::FilePath& profile_path, |
| 55 const base::Callback<void(bool)>& callback) OVERRIDE; | 63 const base::Callback<void(bool)>& callback) OVERRIDE; |
| 56 | 64 |
| 57 // ProfileInfoCacheObserver implementation: | 65 // ProfileInfoCacheObserver implementation: |
| 58 virtual void OnProfileAdded(const base::FilePath& profile_path) OVERRIDE; | 66 virtual void OnProfileAdded(const base::FilePath& profile_path) OVERRIDE; |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 74 const base::FilePath& profile_path, | 82 const base::FilePath& profile_path, |
| 75 CreateOrUpdateMode create_mode, | 83 CreateOrUpdateMode create_mode, |
| 76 NonProfileShortcutAction action); | 84 NonProfileShortcutAction action); |
| 77 | 85 |
| 78 ProfileManager* profile_manager_; | 86 ProfileManager* profile_manager_; |
| 79 | 87 |
| 80 DISALLOW_COPY_AND_ASSIGN(ProfileShortcutManagerWin); | 88 DISALLOW_COPY_AND_ASSIGN(ProfileShortcutManagerWin); |
| 81 }; | 89 }; |
| 82 | 90 |
| 83 #endif // CHROME_BROWSER_PROFILES_PROFILE_SHORTCUT_MANAGER_WIN_H_ | 91 #endif // CHROME_BROWSER_PROFILES_PROFILE_SHORTCUT_MANAGER_WIN_H_ |
| OLD | NEW |