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

Unified Diff: chrome/browser/profiles/profile_shortcut_manager_win.cc

Issue 11633041: Show a delete shortcut checkbox when editing a profile that has a shortcut. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 7 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.cc
===================================================================
--- chrome/browser/profiles/profile_shortcut_manager_win.cc (revision 175855)
+++ chrome/browser/profiles/profile_shortcut_manager_win.cc (working copy)
@@ -346,6 +346,25 @@
}
}
+// Returns true if profile at |profile_path| has any shortcuts. Does not
+// consider non-profile shortcuts. Must be called on the FILE thread.
+bool HasAnyProfileShortcuts(const FilePath& profile_path) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
+
+ FilePath chrome_exe;
+ if (!PathService::Get(base::FILE_EXE, &chrome_exe)) {
+ NOTREACHED();
+ return false;
+ }
+
+ const string16 command_line =
+ profiles::internal::CreateProfileShortcutFlags(profile_path);
+ std::vector<FilePath> shortcuts;
+ ListDesktopShortcutsWithCommandLine(chrome_exe, command_line, false,
+ &shortcuts);
+ return !shortcuts.empty();
+}
+
// Replaces any reserved characters with spaces, and trims the resulting string
// to prevent any leading and trailing spaces. Also makes sure that the
// resulting filename doesn't exceed |kMaxProfileShortcutFileNameLength|.
@@ -421,6 +440,21 @@
IGNORE_NON_PROFILE_SHORTCUTS);
}
+void ProfileShortcutManagerWin::RemoveProfileShortcuts(
+ const FilePath& profile_path) {
+ BrowserThread::PostTask(
+ BrowserThread::FILE, FROM_HERE,
+ base::Bind(&DeleteDesktopShortcutsAndIconFile, profile_path, false));
+}
+
+void ProfileShortcutManagerWin::HasProfileShortcuts(
+ const FilePath& profile_path,
+ const base::Callback<void(bool)>& callback) {
+ BrowserThread::PostTaskAndReplyWithResult(
+ BrowserThread::FILE, FROM_HERE,
+ base::Bind(&HasAnyProfileShortcuts, profile_path), callback);
+}
+
void ProfileShortcutManagerWin::OnProfileAdded(const FilePath& profile_path) {
const size_t profile_count =
profile_manager_->GetProfileInfoCache().GetNumberOfProfiles();
« no previous file with comments | « chrome/browser/profiles/profile_shortcut_manager_win.h ('k') | chrome/browser/resources/options/manage_profile_overlay.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698