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

Unified 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: rebase Created 7 years, 5 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 fa627a4064c78faeef04479dc55955c2f2f3bafc..4ecbfecad395b83ed7633834b5aa1ce1d383491c 100644
--- a/chrome/browser/profiles/profile_shortcut_manager_win.h
+++ b/chrome/browser/profiles/profile_shortcut_manager_win.h
@@ -5,7 +5,10 @@
#ifndef CHROME_BROWSER_PROFILES_PROFILE_SHORTCUT_MANAGER_WIN_H_
#define CHROME_BROWSER_PROFILES_PROFILE_SHORTCUT_MANAGER_WIN_H_
+#include "base/callback.h"
#include "chrome/browser/profiles/profile_shortcut_manager.h"
+#include "content/public/browser/notification_observer.h"
+#include "content/public/browser/notification_registrar.h"
class BrowserDistribution;
@@ -13,8 +16,8 @@ class BrowserDistribution;
namespace profiles {
namespace internal {
-// Name of the badged icon file generated for a given profile.
-extern const char kProfileIconFileName[];
+// Returns the full path to the profile icon file.
+base::FilePath GetProfileIconPath(const base::FilePath& profile_path);
// Returns the default shortcut filename for the given profile name,
// given |distribution|. Returns a filename appropriate for a
@@ -29,12 +32,16 @@ string16 CreateProfileShortcutFlags(const base::FilePath& profile_path);
} // namespace profiles
class ProfileShortcutManagerWin : public ProfileShortcutManager,
- public ProfileInfoCacheObserver {
+ public ProfileInfoCacheObserver,
+ public content::NotificationObserver {
public:
- // Specifies whether a new shortcut should be created if none exist.
+ // Specifies whether only the existing shortcut should be updated, a new
+ // shortcut should be created if none exist, or only the icon for this profile
+ // should be created in the profile directory.
enum CreateOrUpdateMode {
UPDATE_EXISTING_ONLY,
CREATE_WHEN_NONE_FOUND,
+ CREATE_OR_UPDATE_ICON_ONLY,
};
// Specifies whether non-profile shortcuts should be updated.
enum NonProfileShortcutAction {
@@ -46,6 +53,9 @@ class ProfileShortcutManagerWin : public ProfileShortcutManager,
virtual ~ProfileShortcutManagerWin();
// ProfileShortcutManager implementation:
+ virtual void CreateOrUpdateProfileIcon(
+ const base::FilePath& profile_path,
+ const base::Closure& callback) OVERRIDE;
virtual void CreateProfileShortcut(
const base::FilePath& profile_path) OVERRIDE;
virtual void RemoveProfileShortcuts(
@@ -63,18 +73,30 @@ class ProfileShortcutManagerWin : public ProfileShortcutManager,
virtual void OnProfileAvatarChanged(
const base::FilePath& profile_path) OVERRIDE;
+ // content::NotificationObserver implementation:
+ virtual void Observe(int type,
+ const content::NotificationSource& source,
+ const content::NotificationDetails& details) OVERRIDE;
+
private:
// Gives the profile path of an alternate profile than |profile_path|.
// Must only be called when the number profiles is 2.
base::FilePath GetOtherProfilePath(const base::FilePath& profile_path);
+ // Creates or updates shortcuts for the profile at |profile_path| according
+ // to the specified |create_mode| and |action|. This will always involve
+ // creating or updating the icon file for this profile.
+ // Calls |callback| on successful icon creation.
void CreateOrUpdateShortcutsForProfileAtPath(
const base::FilePath& profile_path,
CreateOrUpdateMode create_mode,
- NonProfileShortcutAction action);
+ NonProfileShortcutAction action,
+ const base::Closure& callback);
ProfileManager* profile_manager_;
+ content::NotificationRegistrar registrar_;
+
DISALLOW_COPY_AND_ASSIGN(ProfileShortcutManagerWin);
};

Powered by Google App Engine
This is Rietveld 408576698