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

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

Issue 1540543002: Uniquify profile shortcut name. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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 <set>
9
8 #include "base/callback.h" 10 #include "base/callback.h"
9 #include "chrome/browser/profiles/profile_shortcut_manager.h" 11 #include "chrome/browser/profiles/profile_shortcut_manager.h"
10 #include "content/public/browser/notification_observer.h" 12 #include "content/public/browser/notification_observer.h"
11 #include "content/public/browser/notification_registrar.h" 13 #include "content/public/browser/notification_registrar.h"
12 14
13 class BrowserDistribution; 15 class BrowserDistribution;
14 16
15 // Internal free-standing functions that are exported here for testing. 17 // Internal free-standing functions that are exported here for testing.
16 namespace profiles { 18 namespace profiles {
17 namespace internal { 19 namespace internal {
18 20
19 // Returns the full path to the profile icon file. 21 // Returns the full path to the profile icon file.
20 base::FilePath GetProfileIconPath(const base::FilePath& profile_path); 22 base::FilePath GetProfileIconPath(const base::FilePath& profile_path);
21 23
22 // Returns the default shortcut filename for the given profile name, 24 // Returns the default shortcut filename for the given profile name,
23 // given |distribution|. Returns a filename appropriate for a 25 // given |distribution|. Returns a filename appropriate for a
24 // single-user installation if |profile_name| is empty. 26 // single-user installation if |profile_name| is empty.
25 base::string16 GetShortcutFilenameForProfile(const base::string16& profile_name, 27 base::string16 GetShortcutFilenameForProfile(const base::string16& profile_name,
26 BrowserDistribution* distribution); 28 BrowserDistribution* distribution);
27 29
30 // The same as above but uniqueness is guaranteed.
anthonyvd 2016/01/04 16:30:18 nit: maybe name the function directly so this comm
31 base::string16 GetShortcutUniqueFilenameForProfile(
Alexei Svitkine (slow) 2016/01/05 19:55:22 Nit: GetUniqueShortcutFilenameForProfile().
32 const base::string16& profile_name,
33 BrowserDistribution* distribution,
34 const std::set<base::FilePath>& excludes);
35
36 class ShortcutFilenameMatcher {
Alexei Svitkine (slow) 2016/01/05 19:55:22 Add a comment about the purpose of this class.
37 public:
38 ShortcutFilenameMatcher(const base::string16& profile_name,
39 BrowserDistribution* distribution);
40
41 // Check that shortcut filename has a name given by us (by
42 // GetShortcutFilenameForProfile or GetShortcutUniqueFilenameForProfile).
43 bool IsCanonical(const base::string16& filename) const;
44
45 private:
46 const base::string16 profile_shortcut_filename_;
47 const base::StringPiece16 lnk_ext_;
48 base::StringPiece16 profile_shortcut_name_;
49 };
Alexei Svitkine (slow) 2016/01/05 19:55:22 Nit: DISALLOW_COPY_AND_ASSIGN()
50
28 // Returns the command-line flags to launch Chrome with the given profile. 51 // Returns the command-line flags to launch Chrome with the given profile.
29 base::string16 CreateProfileShortcutFlags(const base::FilePath& profile_path); 52 base::string16 CreateProfileShortcutFlags(const base::FilePath& profile_path);
30 53
31 } // namespace internal 54 } // namespace internal
32 } // namespace profiles 55 } // namespace profiles
33 56
34 class ProfileShortcutManagerWin : public ProfileShortcutManager, 57 class ProfileShortcutManagerWin : public ProfileShortcutManager,
35 public ProfileInfoCacheObserver, 58 public ProfileInfoCacheObserver,
36 public content::NotificationObserver { 59 public content::NotificationObserver {
37 public: 60 public:
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 NonProfileShortcutAction action); 113 NonProfileShortcutAction action);
91 114
92 ProfileManager* profile_manager_; 115 ProfileManager* profile_manager_;
93 116
94 content::NotificationRegistrar registrar_; 117 content::NotificationRegistrar registrar_;
95 118
96 DISALLOW_COPY_AND_ASSIGN(ProfileShortcutManagerWin); 119 DISALLOW_COPY_AND_ASSIGN(ProfileShortcutManagerWin);
97 }; 120 };
98 121
99 #endif // CHROME_BROWSER_PROFILES_PROFILE_SHORTCUT_MANAGER_WIN_H_ 122 #endif // CHROME_BROWSER_PROFILES_PROFILE_SHORTCUT_MANAGER_WIN_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698