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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "chrome/browser/extensions/image_loading_tracker.h" | 9 #include "chrome/browser/extensions/image_loading_tracker.h" |
10 #include "chrome/browser/shell_integration.h" | 10 #include "chrome/browser/shell_integration.h" |
11 #include "chrome/common/extensions/extension.h" | 11 #include "chrome/common/extensions/extension.h" |
12 #include "content/public/browser/notification_observer.h" | 12 #include "content/public/browser/notification_observer.h" |
13 #include "content/public/browser/notification_registrar.h" | 13 #include "content/public/browser/notification_registrar.h" |
14 | 14 |
15 class Profile; | 15 class Profile; |
16 | 16 |
17 // This class manages the installation of shortcuts for platform apps. | 17 // This class manages the installation of shortcuts for platform apps. |
18 class AppShortcutManager : public ImageLoadingTracker::Observer, | 18 class AppShortcutManager : public ImageLoadingTracker::Observer, |
19 public content::NotificationObserver { | 19 public content::NotificationObserver { |
20 public: | 20 public: |
21 explicit AppShortcutManager(Profile* profile); | 21 explicit AppShortcutManager(Profile* profile); |
22 | 22 |
23 // Implement ImageLoadingTracker::Observer. |tracker_| is used to | 23 // Implement ImageLoadingTracker::Observer. |tracker_| is used to |
24 // load the application's icon, which is done when we start creating an | 24 // load the application's icon, which is done when we start creating an |
25 // application's shortcuts. This method receives the icon, and completes | 25 // application's shortcuts. This method receives the icon, and completes |
26 // the process of installing the shortcuts. | 26 // the process of installing the shortcuts. |
27 virtual void OnImageLoaded(SkBitmap* image, | 27 virtual void OnImageLoaded(const gfx::Image& image, |
28 const ExtensionResource& resource, | 28 const std::string& extension_id, |
29 int index) OVERRIDE; | 29 int index) OVERRIDE; |
30 | 30 |
31 // content::NotificationObserver | 31 // content::NotificationObserver |
32 virtual void Observe(int type, | 32 virtual void Observe(int type, |
33 const content::NotificationSource& source, | 33 const content::NotificationSource& source, |
34 const content::NotificationDetails& details) OVERRIDE; | 34 const content::NotificationDetails& details) OVERRIDE; |
35 | 35 |
36 static void SetShortcutCreationDisabledForTesting(bool disabled); | 36 static void SetShortcutCreationDisabledForTesting(bool disabled); |
37 private: | 37 private: |
38 // Install the shortcuts for an application. | 38 // Install the shortcuts for an application. |
39 void InstallApplicationShortcuts(const Extension* extension); | 39 void InstallApplicationShortcuts(const Extension* extension); |
40 | 40 |
41 content::NotificationRegistrar registrar_; | 41 content::NotificationRegistrar registrar_; |
42 Profile* profile_; | 42 Profile* profile_; |
43 | 43 |
44 // Fields used when installing application shortcuts. | 44 // Fields used when installing application shortcuts. |
45 ShellIntegration::ShortcutInfo shortcut_info_; | 45 ShellIntegration::ShortcutInfo shortcut_info_; |
46 ImageLoadingTracker tracker_; | 46 ImageLoadingTracker tracker_; |
47 | 47 |
48 DISALLOW_COPY_AND_ASSIGN(AppShortcutManager); | 48 DISALLOW_COPY_AND_ASSIGN(AppShortcutManager); |
49 }; | 49 }; |
50 | 50 |
51 #endif // CHROME_BROWSER_EXTENSIONS_APP_SHORTCUT_MANAGER_H_ | 51 #endif // CHROME_BROWSER_EXTENSIONS_APP_SHORTCUT_MANAGER_H_ |
OLD | NEW |