| 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_EXTENSIONS_APP_SHORTCUT_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_APP_SHORTCUT_MANAGER_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_APP_SHORTCUT_MANAGER_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_APP_SHORTCUT_MANAGER_H_ |
| 7 | 7 |
| 8 #include "base/memory/weak_ptr.h" |
| 8 #include "chrome/browser/extensions/image_loading_tracker.h" | 9 #include "chrome/browser/extensions/image_loading_tracker.h" |
| 9 #include "chrome/browser/shell_integration.h" | 10 #include "chrome/browser/shell_integration.h" |
| 10 #include "chrome/common/extensions/extension.h" | 11 #include "chrome/common/extensions/extension.h" |
| 11 #include "content/public/browser/notification_observer.h" | 12 #include "content/public/browser/notification_observer.h" |
| 12 #include "content/public/browser/notification_registrar.h" | 13 #include "content/public/browser/notification_registrar.h" |
| 13 | 14 |
| 14 class Profile; | 15 class Profile; |
| 15 | 16 |
| 16 namespace extensions { | 17 namespace extensions { |
| 17 | 18 |
| 18 // This class manages the installation of shortcuts for platform apps. | 19 // This class manages the installation of shortcuts for platform apps. |
| 19 class AppShortcutManager : public ImageLoadingTracker::Observer, | 20 class AppShortcutManager : public ImageLoadingTracker::Observer, |
| 20 public content::NotificationObserver { | 21 public content::NotificationObserver { |
| 21 public: | 22 public: |
| 22 explicit AppShortcutManager(Profile* profile); | 23 explicit AppShortcutManager(Profile* profile); |
| 23 | 24 |
| 25 virtual ~AppShortcutManager(); |
| 26 |
| 24 // Implement ImageLoadingTracker::Observer. |tracker_| is used to | 27 // Implement ImageLoadingTracker::Observer. |tracker_| is used to |
| 25 // load the application's icon, which is done when we start creating an | 28 // load the application's icon, which is done when we start creating an |
| 26 // application's shortcuts. This method receives the icon, and completes | 29 // application's shortcuts. This method receives the icon, and completes |
| 27 // the process of installing the shortcuts. | 30 // the process of installing the shortcuts. |
| 28 virtual void OnImageLoaded(const gfx::Image& image, | 31 virtual void OnImageLoaded(const gfx::Image& image, |
| 29 const std::string& extension_id, | 32 const std::string& extension_id, |
| 30 int index) OVERRIDE; | 33 int index) OVERRIDE; |
| 31 | 34 |
| 32 // content::NotificationObserver | 35 // content::NotificationObserver |
| 33 virtual void Observe(int type, | 36 virtual void Observe(int type, |
| 34 const content::NotificationSource& source, | 37 const content::NotificationSource& source, |
| 35 const content::NotificationDetails& details) OVERRIDE; | 38 const content::NotificationDetails& details) OVERRIDE; |
| 36 | 39 |
| 37 private: | 40 private: |
| 38 void UpdateApplicationShortcuts(const Extension* extension); | 41 void UpdateApplicationShortcuts(const Extension* extension); |
| 42 |
| 43 #if defined(OS_WIN) |
| 44 void OnAppHostInstallationComplete(const Extension* extension, |
| 45 bool app_host_install_success); |
| 46 #endif |
| 47 |
| 39 void DeleteApplicationShortcuts(const Extension* extension); | 48 void DeleteApplicationShortcuts(const Extension* extension); |
| 40 | 49 |
| 41 content::NotificationRegistrar registrar_; | 50 content::NotificationRegistrar registrar_; |
| 42 Profile* profile_; | 51 Profile* profile_; |
| 43 | 52 |
| 44 // Fields used when installing application shortcuts. | 53 // Fields used when installing application shortcuts. |
| 45 ShellIntegration::ShortcutInfo shortcut_info_; | 54 ShellIntegration::ShortcutInfo shortcut_info_; |
| 46 ImageLoadingTracker tracker_; | 55 ImageLoadingTracker tracker_; |
| 47 | 56 |
| 57 base::WeakPtrFactory<AppShortcutManager> weak_factory_; |
| 58 |
| 48 DISALLOW_COPY_AND_ASSIGN(AppShortcutManager); | 59 DISALLOW_COPY_AND_ASSIGN(AppShortcutManager); |
| 49 }; | 60 }; |
| 50 | 61 |
| 51 } // namespace extensions | 62 } // namespace extensions |
| 52 | 63 |
| 53 #endif // CHROME_BROWSER_EXTENSIONS_APP_SHORTCUT_MANAGER_H_ | 64 #endif // CHROME_BROWSER_EXTENSIONS_APP_SHORTCUT_MANAGER_H_ |
| OLD | NEW |