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

Unified 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: Fix review notes. Created 4 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/profiles/profile_shortcut_manager_win.h
diff --git a/chrome/browser/profiles/profile_shortcut_manager_win.h b/chrome/browser/profiles/profile_shortcut_manager_win.h
index 7645b8d425c6d5b42edca5ef0bb9ef660ee80248..c303b556f014f87a873b3fbb97fb45cab2eeb29e 100644
--- a/chrome/browser/profiles/profile_shortcut_manager_win.h
+++ b/chrome/browser/profiles/profile_shortcut_manager_win.h
@@ -5,6 +5,8 @@
#ifndef CHROME_BROWSER_PROFILES_PROFILE_SHORTCUT_MANAGER_WIN_H_
#define CHROME_BROWSER_PROFILES_PROFILE_SHORTCUT_MANAGER_WIN_H_
+#include <set>
+
#include "base/callback.h"
#include "chrome/browser/profiles/profile_shortcut_manager.h"
#include "content/public/browser/notification_observer.h"
@@ -25,6 +27,30 @@ base::FilePath GetProfileIconPath(const base::FilePath& profile_path);
base::string16 GetShortcutFilenameForProfile(const base::string16& profile_name,
BrowserDistribution* distribution);
+// The same as GetShortcutFilenameForProfile but uniqueness is guaranteed.
+base::string16 GetUniqueShortcutFilenameForProfile(
+ const base::string16& profile_name,
+ BrowserDistribution* distribution,
+ const std::set<base::FilePath>& excludes);
+
+// This class checks that shortcut filename matches certain profile.
+class ShortcutFilenameMatcher {
+ public:
+ ShortcutFilenameMatcher(const base::string16& profile_name,
+ BrowserDistribution* distribution);
+
+ // Check that shortcut filename has a name given by us (by
+ // GetShortcutFilenameForProfile or GetUniqueShortcutFilenameForProfile).
+ bool IsCanonical(const base::string16& filename) const;
+
+ private:
+ const base::string16 profile_shortcut_filename_;
+ const base::StringPiece16 lnk_ext_;
+ base::StringPiece16 profile_shortcut_name_;
+
+ DISALLOW_COPY_AND_ASSIGN(ShortcutFilenameMatcher);
+};
+
// Returns the command-line flags to launch Chrome with the given profile.
base::string16 CreateProfileShortcutFlags(const base::FilePath& profile_path);

Powered by Google App Engine
This is Rietveld 408576698