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

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

Issue 1794353003: Refactor ProfileInfoCache in c/b/profiles (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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 "base/callback.h" 8 #include "base/callback.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "chrome/browser/profiles/profile_attributes_storage.h"
10 #include "chrome/browser/profiles/profile_shortcut_manager.h" 11 #include "chrome/browser/profiles/profile_shortcut_manager.h"
11 #include "content/public/browser/notification_observer.h" 12 #include "content/public/browser/notification_observer.h"
12 #include "content/public/browser/notification_registrar.h" 13 #include "content/public/browser/notification_registrar.h"
13 14
14 class BrowserDistribution; 15 class BrowserDistribution;
15 16
16 // Internal free-standing functions that are exported here for testing. 17 // Internal free-standing functions that are exported here for testing.
17 namespace profiles { 18 namespace profiles {
18 namespace internal { 19 namespace internal {
19 20
20 // Returns the full path to the profile icon file. 21 // Returns the full path to the profile icon file.
21 base::FilePath GetProfileIconPath(const base::FilePath& profile_path); 22 base::FilePath GetProfileIconPath(const base::FilePath& profile_path);
22 23
23 // Returns the default shortcut filename for the given profile name, 24 // Returns the default shortcut filename for the given profile name,
24 // given |distribution|. Returns a filename appropriate for a 25 // given |distribution|. Returns a filename appropriate for a
25 // single-user installation if |profile_name| is empty. 26 // single-user installation if |profile_name| is empty.
26 base::string16 GetShortcutFilenameForProfile(const base::string16& profile_name, 27 base::string16 GetShortcutFilenameForProfile(const base::string16& profile_name,
27 BrowserDistribution* distribution); 28 BrowserDistribution* distribution);
28 29
29 // Returns the command-line flags to launch Chrome with the given profile. 30 // Returns the command-line flags to launch Chrome with the given profile.
30 base::string16 CreateProfileShortcutFlags(const base::FilePath& profile_path); 31 base::string16 CreateProfileShortcutFlags(const base::FilePath& profile_path);
31 32
32 } // namespace internal 33 } // namespace internal
33 } // namespace profiles 34 } // namespace profiles
34 35
35 class ProfileShortcutManagerWin : public ProfileShortcutManager, 36 class ProfileShortcutManagerWin : public ProfileShortcutManager,
36 public ProfileInfoCacheObserver, 37 public ProfileAttributesStorage::Observer,
37 public content::NotificationObserver { 38 public content::NotificationObserver {
38 public: 39 public:
39 // Specifies whether only the existing shortcut should be updated, a new 40 // Specifies whether only the existing shortcut should be updated, a new
40 // shortcut should be created if none exist, or only the icon for this profile 41 // shortcut should be created if none exist, or only the icon for this profile
41 // should be created in the profile directory. 42 // should be created in the profile directory.
42 enum CreateOrUpdateMode { 43 enum CreateOrUpdateMode {
43 UPDATE_EXISTING_ONLY, 44 UPDATE_EXISTING_ONLY,
44 CREATE_WHEN_NONE_FOUND, 45 CREATE_WHEN_NONE_FOUND,
45 CREATE_OR_UPDATE_ICON_ONLY, 46 CREATE_OR_UPDATE_ICON_ONLY,
46 }; 47 };
(...skipping 10 matching lines...) Expand all
57 void CreateOrUpdateProfileIcon(const base::FilePath& profile_path) override; 58 void CreateOrUpdateProfileIcon(const base::FilePath& profile_path) override;
58 void CreateProfileShortcut(const base::FilePath& profile_path) override; 59 void CreateProfileShortcut(const base::FilePath& profile_path) override;
59 void RemoveProfileShortcuts(const base::FilePath& profile_path) override; 60 void RemoveProfileShortcuts(const base::FilePath& profile_path) override;
60 void HasProfileShortcuts(const base::FilePath& profile_path, 61 void HasProfileShortcuts(const base::FilePath& profile_path,
61 const base::Callback<void(bool)>& callback) override; 62 const base::Callback<void(bool)>& callback) override;
62 void GetShortcutProperties(const base::FilePath& profile_path, 63 void GetShortcutProperties(const base::FilePath& profile_path,
63 base::CommandLine* command_line, 64 base::CommandLine* command_line,
64 base::string16* name, 65 base::string16* name,
65 base::FilePath* icon_path) override; 66 base::FilePath* icon_path) override;
66 67
67 // ProfileInfoCacheObserver implementation: 68 // ProfileAttributesStorage::Observer implementation:
68 void OnProfileAdded(const base::FilePath& profile_path) override; 69 void OnProfileAdded(const base::FilePath& profile_path) override;
69 void OnProfileWasRemoved(const base::FilePath& profile_path, 70 void OnProfileWasRemoved(const base::FilePath& profile_path,
70 const base::string16& profile_name) override; 71 const base::string16& profile_name) override;
71 void OnProfileNameChanged(const base::FilePath& profile_path, 72 void OnProfileNameChanged(const base::FilePath& profile_path,
72 const base::string16& old_profile_name) override; 73 const base::string16& old_profile_name) override;
73 void OnProfileAvatarChanged(const base::FilePath& profile_path) override; 74 void OnProfileAvatarChanged(const base::FilePath& profile_path) override;
74 75
75 // content::NotificationObserver implementation: 76 // content::NotificationObserver implementation:
76 void Observe(int type, 77 void Observe(int type,
77 const content::NotificationSource& source, 78 const content::NotificationSource& source,
(...skipping 13 matching lines...) Expand all
91 NonProfileShortcutAction action); 92 NonProfileShortcutAction action);
92 93
93 ProfileManager* profile_manager_; 94 ProfileManager* profile_manager_;
94 95
95 content::NotificationRegistrar registrar_; 96 content::NotificationRegistrar registrar_;
96 97
97 DISALLOW_COPY_AND_ASSIGN(ProfileShortcutManagerWin); 98 DISALLOW_COPY_AND_ASSIGN(ProfileShortcutManagerWin);
98 }; 99 };
99 100
100 #endif // CHROME_BROWSER_PROFILES_PROFILE_SHORTCUT_MANAGER_WIN_H_ 101 #endif // CHROME_BROWSER_PROFILES_PROFILE_SHORTCUT_MANAGER_WIN_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698