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

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

Issue 8785006: Badge Windows profile shortcuts with multi-user avatar. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: addressed sail's comment. removed fix for crbug.com/106261 Created 9 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #pragma once 7 #pragma once
8 8
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/callback_forward.h" 11 #include "base/callback_forward.h"
12 #include "base/compiler_specific.h" 12 #include "base/compiler_specific.h"
13 #include "base/string16.h" 13 #include "base/string16.h"
14 #include "chrome/browser/profiles/profile_info_cache_observer.h" 14 #include "chrome/browser/profiles/profile_info_cache_observer.h"
15 15
16 class FilePath;
17
16 // This class observes the ProfileInfoCache, and makes corresponding changes 18 // This class observes the ProfileInfoCache, and makes corresponding changes
17 // to shortcuts on the user's desktop in Windows systems. 19 // to shortcuts on the user's desktop in Windows systems.
18 class ProfileShortcutManagerWin : public ProfileInfoCacheObserver { 20 class ProfileShortcutManagerWin : public ProfileInfoCacheObserver {
19 public: 21 public:
20 ProfileShortcutManagerWin(); 22 ProfileShortcutManagerWin();
21 virtual ~ProfileShortcutManagerWin(); 23 virtual ~ProfileShortcutManagerWin();
22 24
23 // ProfileInfoCacheObserver: 25 // ProfileInfoCacheObserver:
24 virtual void OnProfileAdded( 26 virtual void OnProfileAdded(
25 const string16& profile_name, 27 const string16& profile_name,
26 const string16& profile_base_dir) OVERRIDE; 28 const string16& profile_base_dir,
29 const string16& profile_path,
30 const gfx::Image* avatar_image) OVERRIDE;
27 virtual void OnProfileRemoved( 31 virtual void OnProfileRemoved(
28 const string16& profile_name) OVERRIDE; 32 const string16& profile_name) OVERRIDE;
29 virtual void OnProfileNameChanged( 33 virtual void OnProfileNameChanged(
30 const string16& old_profile_name, 34 const string16& old_profile_name,
31 const string16& new_profile_name) OVERRIDE; 35 const string16& new_profile_name) OVERRIDE;
36 virtual void OnProfileAvatarChanged(
37 const string16& profile_name,
38 const string16& profile_base_dir,
39 const string16& profile_path,
40 const gfx::Image* avatar_image) OVERRIDE;
32 41
33 // Takes a vector of profile names (for example: "Sparky") and generates a 42 // Takes a vector of profile names (for example: "Sparky") and generates a
34 // vector of shortcut link names (for example: "Chromium (Sparky).lnk"). 43 // vector of shortcut link names (for example: "Chromium (Sparky).lnk").
35 static std::vector<string16> GenerateShortcutsFromProfiles( 44 static std::vector<string16> GenerateShortcutsFromProfiles(
36 const std::vector<string16>& profile_names); 45 const std::vector<string16>& profile_names);
37 46
38 private: 47 private:
SteveT 2011/12/03 03:19:15 robertshield: This isn't new to this CL, but these
39 // Creates a desktop shortcut to open Chrome with the given profile name and 48 // Creates a desktop shortcut to open Chrome with the given profile name and
40 // directory. Iff |create|, create shortcut if it doesn't already exist. Must 49 // base directory. Iff |create|, create shortcut if it doesn't already exist.
41 // be called on the FILE thread. 50 // Must be called on the FILE thread. This method retains ownership of
51 // |avatar_image| and will delete it when it is done with it.
42 static void CreateChromeDesktopShortcutForProfile( 52 static void CreateChromeDesktopShortcutForProfile(
43 const string16& profile_name, 53 const string16& profile_name,
44 const string16& directory, 54 const string16& profile_base_dir,
55 const string16& profile_path,
56 const gfx::Image* avatar_image,
45 bool create); 57 bool create);
46 58
47 // Renames an existing Chrome desktop profile shortcut. Must be called on the 59 // Renames an existing Chrome desktop profile shortcut. Must be called on the
48 // FILE thread. 60 // FILE thread.
49 static void RenameChromeDesktopShortcutForProfile( 61 static void RenameChromeDesktopShortcutForProfile(
50 const string16& old_profile_name, 62 const string16& old_profile_name,
51 const string16& new_profile_name); 63 const string16& new_profile_name);
52 64
53 // Updates the arguments to a Chrome desktop shortcut for a profile. Must be 65 // Updates the arguments to a Chrome desktop shortcut for a profile. Must be
54 // called on the FILE thread. 66 // called on the FILE thread. This method retains ownership of |avatar_image|
67 // and will delete it when it is done with it.
55 static void UpdateChromeDesktopShortcutForProfile( 68 static void UpdateChromeDesktopShortcutForProfile(
56 const string16& shortcut, 69 const string16& shortcut,
57 const string16& arguments); 70 const string16& arguments,
71 const string16& profile_path,
72 const gfx::Image* avatar_image);
73
74 // Creates a desktop shortcut icon file (.ico) on the disk for a given
75 // profile, badging the browser distribution icon with the profile avatar.
76 // |profile_base_dir| is the base directory (and key) of the profile. Returns
77 // a path to the shortcut icon file on disk, which is empty if this fails.
78 // Use index 0 when assigning the resulting file as the icon.
79 static FilePath CreateChromeDesktopShortcutIconForProfile(
80 const string16& profile_path,
81 const gfx::Image* avatar_image);
58 82
59 DISALLOW_COPY_AND_ASSIGN(ProfileShortcutManagerWin); 83 DISALLOW_COPY_AND_ASSIGN(ProfileShortcutManagerWin);
60 }; 84 };
61 85
62 #endif // CHROME_BROWSER_PROFILES_PROFILE_SHORTCUT_MANAGER_WIN_H_ 86 #endif // CHROME_BROWSER_PROFILES_PROFILE_SHORTCUT_MANAGER_WIN_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698