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