| OLD | NEW |
| 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 "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "chrome/browser/profiles/profile_shortcut_manager.h" | 9 #include "chrome/browser/profiles/profile_shortcut_manager.h" |
| 10 #include "content/public/browser/notification_observer.h" | 10 #include "content/public/browser/notification_observer.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 CREATE_WHEN_NONE_FOUND, | 43 CREATE_WHEN_NONE_FOUND, |
| 44 CREATE_OR_UPDATE_ICON_ONLY, | 44 CREATE_OR_UPDATE_ICON_ONLY, |
| 45 }; | 45 }; |
| 46 // Specifies whether non-profile shortcuts should be updated. | 46 // Specifies whether non-profile shortcuts should be updated. |
| 47 enum NonProfileShortcutAction { | 47 enum NonProfileShortcutAction { |
| 48 IGNORE_NON_PROFILE_SHORTCUTS, | 48 IGNORE_NON_PROFILE_SHORTCUTS, |
| 49 UPDATE_NON_PROFILE_SHORTCUTS, | 49 UPDATE_NON_PROFILE_SHORTCUTS, |
| 50 }; | 50 }; |
| 51 | 51 |
| 52 explicit ProfileShortcutManagerWin(ProfileManager* manager); | 52 explicit ProfileShortcutManagerWin(ProfileManager* manager); |
| 53 virtual ~ProfileShortcutManagerWin(); | 53 ~ProfileShortcutManagerWin() override; |
| 54 | 54 |
| 55 // ProfileShortcutManager implementation: | 55 // ProfileShortcutManager implementation: |
| 56 virtual void CreateOrUpdateProfileIcon( | 56 void CreateOrUpdateProfileIcon(const base::FilePath& profile_path) override; |
| 57 const base::FilePath& profile_path) override; | 57 void CreateProfileShortcut(const base::FilePath& profile_path) override; |
| 58 virtual void CreateProfileShortcut( | 58 void RemoveProfileShortcuts(const base::FilePath& profile_path) override; |
| 59 const base::FilePath& profile_path) override; | 59 void HasProfileShortcuts(const base::FilePath& profile_path, |
| 60 virtual void RemoveProfileShortcuts( | 60 const base::Callback<void(bool)>& callback) override; |
| 61 const base::FilePath& profile_path) override; | 61 void GetShortcutProperties(const base::FilePath& profile_path, |
| 62 virtual void HasProfileShortcuts( | 62 base::CommandLine* command_line, |
| 63 const base::FilePath& profile_path, | 63 base::string16* name, |
| 64 const base::Callback<void(bool)>& callback) override; | 64 base::FilePath* icon_path) override; |
| 65 virtual void GetShortcutProperties(const base::FilePath& profile_path, | |
| 66 base::CommandLine* command_line, | |
| 67 base::string16* name, | |
| 68 base::FilePath* icon_path) override; | |
| 69 | 65 |
| 70 // ProfileInfoCacheObserver implementation: | 66 // ProfileInfoCacheObserver implementation: |
| 71 virtual void OnProfileAdded(const base::FilePath& profile_path) override; | 67 void OnProfileAdded(const base::FilePath& profile_path) override; |
| 72 virtual void OnProfileWasRemoved( | 68 void OnProfileWasRemoved(const base::FilePath& profile_path, |
| 73 const base::FilePath& profile_path, | 69 const base::string16& profile_name) override; |
| 74 const base::string16& profile_name) override; | 70 void OnProfileNameChanged(const base::FilePath& profile_path, |
| 75 virtual void OnProfileNameChanged( | 71 const base::string16& old_profile_name) override; |
| 76 const base::FilePath& profile_path, | 72 void OnProfileAvatarChanged(const base::FilePath& profile_path) override; |
| 77 const base::string16& old_profile_name) override; | |
| 78 virtual void OnProfileAvatarChanged( | |
| 79 const base::FilePath& profile_path) override; | |
| 80 | 73 |
| 81 // content::NotificationObserver implementation: | 74 // content::NotificationObserver implementation: |
| 82 virtual void Observe(int type, | 75 void Observe(int type, |
| 83 const content::NotificationSource& source, | 76 const content::NotificationSource& source, |
| 84 const content::NotificationDetails& details) override; | 77 const content::NotificationDetails& details) override; |
| 85 | 78 |
| 86 private: | 79 private: |
| 87 // Gives the profile path of an alternate profile than |profile_path|. | 80 // Gives the profile path of an alternate profile than |profile_path|. |
| 88 // Must only be called when the number profiles is 2. | 81 // Must only be called when the number profiles is 2. |
| 89 base::FilePath GetOtherProfilePath(const base::FilePath& profile_path); | 82 base::FilePath GetOtherProfilePath(const base::FilePath& profile_path); |
| 90 | 83 |
| 91 // Creates or updates shortcuts for the profile at |profile_path| according | 84 // Creates or updates shortcuts for the profile at |profile_path| according |
| 92 // to the specified |create_mode| and |action|. This will always involve | 85 // to the specified |create_mode| and |action|. This will always involve |
| 93 // creating or updating the icon file for this profile. | 86 // creating or updating the icon file for this profile. |
| 94 void CreateOrUpdateShortcutsForProfileAtPath( | 87 void CreateOrUpdateShortcutsForProfileAtPath( |
| 95 const base::FilePath& profile_path, | 88 const base::FilePath& profile_path, |
| 96 CreateOrUpdateMode create_mode, | 89 CreateOrUpdateMode create_mode, |
| 97 NonProfileShortcutAction action); | 90 NonProfileShortcutAction action); |
| 98 | 91 |
| 99 ProfileManager* profile_manager_; | 92 ProfileManager* profile_manager_; |
| 100 | 93 |
| 101 content::NotificationRegistrar registrar_; | 94 content::NotificationRegistrar registrar_; |
| 102 | 95 |
| 103 DISALLOW_COPY_AND_ASSIGN(ProfileShortcutManagerWin); | 96 DISALLOW_COPY_AND_ASSIGN(ProfileShortcutManagerWin); |
| 104 }; | 97 }; |
| 105 | 98 |
| 106 #endif // CHROME_BROWSER_PROFILES_PROFILE_SHORTCUT_MANAGER_WIN_H_ | 99 #endif // CHROME_BROWSER_PROFILES_PROFILE_SHORTCUT_MANAGER_WIN_H_ |
| OLD | NEW |