| 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 <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "chrome/browser/profiles/profile_attributes_storage.h" |
| 12 #include "chrome/browser/profiles/profile_shortcut_manager.h" | 13 #include "chrome/browser/profiles/profile_shortcut_manager.h" |
| 13 #include "content/public/browser/notification_observer.h" | 14 #include "content/public/browser/notification_observer.h" |
| 14 #include "content/public/browser/notification_registrar.h" | 15 #include "content/public/browser/notification_registrar.h" |
| 15 | 16 |
| 16 class BrowserDistribution; | 17 class BrowserDistribution; |
| 17 | 18 |
| 18 // Internal free-standing functions that are exported here for testing. | 19 // Internal free-standing functions that are exported here for testing. |
| 19 namespace profiles { | 20 namespace profiles { |
| 20 namespace internal { | 21 namespace internal { |
| 21 | 22 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 DISALLOW_COPY_AND_ASSIGN(ShortcutFilenameMatcher); | 54 DISALLOW_COPY_AND_ASSIGN(ShortcutFilenameMatcher); |
| 54 }; | 55 }; |
| 55 | 56 |
| 56 // Returns the command-line flags to launch Chrome with the given profile. | 57 // Returns the command-line flags to launch Chrome with the given profile. |
| 57 base::string16 CreateProfileShortcutFlags(const base::FilePath& profile_path); | 58 base::string16 CreateProfileShortcutFlags(const base::FilePath& profile_path); |
| 58 | 59 |
| 59 } // namespace internal | 60 } // namespace internal |
| 60 } // namespace profiles | 61 } // namespace profiles |
| 61 | 62 |
| 62 class ProfileShortcutManagerWin : public ProfileShortcutManager, | 63 class ProfileShortcutManagerWin : public ProfileShortcutManager, |
| 63 public ProfileInfoCacheObserver, | 64 public ProfileAttributesStorage::Observer, |
| 64 public content::NotificationObserver { | 65 public content::NotificationObserver { |
| 65 public: | 66 public: |
| 66 // Specifies whether only the existing shortcut should be updated, a new | 67 // Specifies whether only the existing shortcut should be updated, a new |
| 67 // shortcut should be created if none exist, or only the icon for this profile | 68 // shortcut should be created if none exist, or only the icon for this profile |
| 68 // should be created in the profile directory. | 69 // should be created in the profile directory. |
| 69 enum CreateOrUpdateMode { | 70 enum CreateOrUpdateMode { |
| 70 UPDATE_EXISTING_ONLY, | 71 UPDATE_EXISTING_ONLY, |
| 71 CREATE_WHEN_NONE_FOUND, | 72 CREATE_WHEN_NONE_FOUND, |
| 72 CREATE_OR_UPDATE_ICON_ONLY, | 73 CREATE_OR_UPDATE_ICON_ONLY, |
| 73 }; | 74 }; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 84 void CreateOrUpdateProfileIcon(const base::FilePath& profile_path) override; | 85 void CreateOrUpdateProfileIcon(const base::FilePath& profile_path) override; |
| 85 void CreateProfileShortcut(const base::FilePath& profile_path) override; | 86 void CreateProfileShortcut(const base::FilePath& profile_path) override; |
| 86 void RemoveProfileShortcuts(const base::FilePath& profile_path) override; | 87 void RemoveProfileShortcuts(const base::FilePath& profile_path) override; |
| 87 void HasProfileShortcuts(const base::FilePath& profile_path, | 88 void HasProfileShortcuts(const base::FilePath& profile_path, |
| 88 const base::Callback<void(bool)>& callback) override; | 89 const base::Callback<void(bool)>& callback) override; |
| 89 void GetShortcutProperties(const base::FilePath& profile_path, | 90 void GetShortcutProperties(const base::FilePath& profile_path, |
| 90 base::CommandLine* command_line, | 91 base::CommandLine* command_line, |
| 91 base::string16* name, | 92 base::string16* name, |
| 92 base::FilePath* icon_path) override; | 93 base::FilePath* icon_path) override; |
| 93 | 94 |
| 94 // ProfileInfoCacheObserver implementation: | 95 // ProfileAttributesStorage::Observer implementation: |
| 95 void OnProfileAdded(const base::FilePath& profile_path) override; | 96 void OnProfileAdded(const base::FilePath& profile_path) override; |
| 96 void OnProfileWasRemoved(const base::FilePath& profile_path, | 97 void OnProfileWasRemoved(const base::FilePath& profile_path, |
| 97 const base::string16& profile_name) override; | 98 const base::string16& profile_name) override; |
| 98 void OnProfileNameChanged(const base::FilePath& profile_path, | 99 void OnProfileNameChanged(const base::FilePath& profile_path, |
| 99 const base::string16& old_profile_name) override; | 100 const base::string16& old_profile_name) override; |
| 100 void OnProfileAvatarChanged(const base::FilePath& profile_path) override; | 101 void OnProfileAvatarChanged(const base::FilePath& profile_path) override; |
| 101 | 102 |
| 102 // content::NotificationObserver implementation: | 103 // content::NotificationObserver implementation: |
| 103 void Observe(int type, | 104 void Observe(int type, |
| 104 const content::NotificationSource& source, | 105 const content::NotificationSource& source, |
| (...skipping 13 matching lines...) Expand all Loading... |
| 118 NonProfileShortcutAction action); | 119 NonProfileShortcutAction action); |
| 119 | 120 |
| 120 ProfileManager* profile_manager_; | 121 ProfileManager* profile_manager_; |
| 121 | 122 |
| 122 content::NotificationRegistrar registrar_; | 123 content::NotificationRegistrar registrar_; |
| 123 | 124 |
| 124 DISALLOW_COPY_AND_ASSIGN(ProfileShortcutManagerWin); | 125 DISALLOW_COPY_AND_ASSIGN(ProfileShortcutManagerWin); |
| 125 }; | 126 }; |
| 126 | 127 |
| 127 #endif // CHROME_BROWSER_PROFILES_PROFILE_SHORTCUT_MANAGER_WIN_H_ | 128 #endif // CHROME_BROWSER_PROFILES_PROFILE_SHORTCUT_MANAGER_WIN_H_ |
| OLD | NEW |