Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(90)

Side by Side Diff: chrome/browser/profiles/profile_shortcut_manager_win.h

Issue 14137032: Create profile .ico file on profile creation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rework Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 // Returns the full path to the profile icon file.
17 extern const char kProfileIconFileName[]; 17 base::FilePath GetProfileIconPath(const base::FilePath& profile_path);
18 18
19 // Returns the default shortcut filename for the given profile name, 19 // Returns the default shortcut filename for the given profile name,
20 // given |distribution|. Returns a filename appropriate for a 20 // given |distribution|. Returns a filename appropriate for a
21 // single-user installation if |profile_name| is empty. 21 // single-user installation if |profile_name| is empty.
22 string16 GetShortcutFilenameForProfile(const string16& profile_name, 22 string16 GetShortcutFilenameForProfile(const string16& profile_name,
23 BrowserDistribution* distribution); 23 BrowserDistribution* distribution);
24 24
25 // Returns the command-line flags to launch Chrome with the given profile. 25 // Returns the command-line flags to launch Chrome with the given profile.
26 string16 CreateProfileShortcutFlags(const base::FilePath& profile_path); 26 string16 CreateProfileShortcutFlags(const base::FilePath& profile_path);
27 27
28 } // namespace internal 28 } // namespace internal
29 } // namespace profiles 29 } // namespace profiles
30 30
31 class ProfileShortcutManagerWin : public ProfileShortcutManager, 31 class ProfileShortcutManagerWin : public ProfileShortcutManager,
32 public ProfileInfoCacheObserver { 32 public ProfileInfoCacheObserver {
33 public: 33 public:
34 // Specifies whether a new shortcut should be created if none exist. 34 // Specifies whether only the existing shortcuts should be updated, a new
35 // shortcut should be created if none exist, or only the icon for this profile
36 // should be created in the profile directory.
35 enum CreateOrUpdateMode { 37 enum CreateOrUpdateMode {
36 UPDATE_EXISTING_ONLY, 38 UPDATE_EXISTING_ONLY,
37 CREATE_WHEN_NONE_FOUND, 39 CREATE_WHEN_NONE_FOUND,
40 CREATE_ICON_ONLY,
38 }; 41 };
39 // Specifies whether non-profile shortcuts should be updated. 42 // Specifies whether non-profile shortcuts should be updated.
40 enum NonProfileShortcutAction { 43 enum NonProfileShortcutAction {
41 IGNORE_NON_PROFILE_SHORTCUTS, 44 IGNORE_NON_PROFILE_SHORTCUTS,
42 UPDATE_NON_PROFILE_SHORTCUTS, 45 UPDATE_NON_PROFILE_SHORTCUTS,
43 }; 46 };
44 47
45 explicit ProfileShortcutManagerWin(ProfileManager* manager); 48 explicit ProfileShortcutManagerWin(ProfileManager* manager);
46 virtual ~ProfileShortcutManagerWin(); 49 virtual ~ProfileShortcutManagerWin();
47 50
48 // ProfileShortcutManager implementation: 51 // ProfileShortcutManager implementation:
52 virtual void CreateProfileIcon(const base::FilePath& profile_path) OVERRIDE;
49 virtual void CreateProfileShortcut( 53 virtual void CreateProfileShortcut(
50 const base::FilePath& profile_path) OVERRIDE; 54 const base::FilePath& profile_path) OVERRIDE;
51 virtual void RemoveProfileShortcuts( 55 virtual void RemoveProfileShortcuts(
52 const base::FilePath& profile_path) OVERRIDE; 56 const base::FilePath& profile_path) OVERRIDE;
53 virtual void HasProfileShortcuts( 57 virtual void HasProfileShortcuts(
54 const base::FilePath& profile_path, 58 const base::FilePath& profile_path,
55 const base::Callback<void(bool)>& callback) OVERRIDE; 59 const base::Callback<void(bool)>& callback) OVERRIDE;
56 60
57 // ProfileInfoCacheObserver implementation: 61 // ProfileInfoCacheObserver implementation:
58 virtual void OnProfileAdded(const base::FilePath& profile_path) OVERRIDE; 62 virtual void OnProfileAdded(const base::FilePath& profile_path) OVERRIDE;
59 virtual void OnProfileWillBeRemoved( 63 virtual void OnProfileWillBeRemoved(
60 const base::FilePath& profile_path) OVERRIDE; 64 const base::FilePath& profile_path) OVERRIDE;
61 virtual void OnProfileWasRemoved(const base::FilePath& profile_path, 65 virtual void OnProfileWasRemoved(const base::FilePath& profile_path,
62 const string16& profile_name) OVERRIDE; 66 const string16& profile_name) OVERRIDE;
63 virtual void OnProfileNameChanged(const base::FilePath& profile_path, 67 virtual void OnProfileNameChanged(const base::FilePath& profile_path,
64 const string16& old_profile_name) OVERRIDE; 68 const string16& old_profile_name) OVERRIDE;
65 virtual void OnProfileAvatarChanged( 69 virtual void OnProfileAvatarChanged(
66 const base::FilePath& profile_path) OVERRIDE; 70 const base::FilePath& profile_path) OVERRIDE;
67 71
68 private: 72 private:
69 // Gives the profile path of an alternate profile than |profile_path|. 73 // Gives the profile path of an alternate profile than |profile_path|.
70 // Must only be called when the number profiles is 2. 74 // Must only be called when the number profiles is 2.
71 base::FilePath GetOtherProfilePath(const base::FilePath& profile_path); 75 base::FilePath GetOtherProfilePath(const base::FilePath& profile_path);
72 76
77 void UpdateProfileIcon(const base::FilePath& profile_path);
78
73 void CreateOrUpdateShortcutsForProfileAtPath( 79 void CreateOrUpdateShortcutsForProfileAtPath(
74 const base::FilePath& profile_path, 80 const base::FilePath& profile_path,
75 CreateOrUpdateMode create_mode, 81 CreateOrUpdateMode create_mode,
76 NonProfileShortcutAction action); 82 NonProfileShortcutAction action);
77 83
78 ProfileManager* profile_manager_; 84 ProfileManager* profile_manager_;
79 85
80 DISALLOW_COPY_AND_ASSIGN(ProfileShortcutManagerWin); 86 DISALLOW_COPY_AND_ASSIGN(ProfileShortcutManagerWin);
81 }; 87 };
82 88
83 #endif // CHROME_BROWSER_PROFILES_PROFILE_SHORTCUT_MANAGER_WIN_H_ 89 #endif // CHROME_BROWSER_PROFILES_PROFILE_SHORTCUT_MANAGER_WIN_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698