Chromium Code Reviews| 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 void set_disable_shortcut_creation(bool val) { | |
|
Mihai Parparita -not on Chrome
2012/02/06 22:35:53
This should have a for_testing suffix so that it's
benwells
2012/02/07 06:57:01
Neat, I didn't know that suffix did that!
Done fo
| |
| 37 disable_shortcut_creation_ = val; | |
| 38 } | |
| 39 private: | |
| 40 // Install the shortcuts for an application. | |
| 41 void InstallApplicationShortcuts(const Extension* extension); | |
| 42 | |
| 43 content::NotificationRegistrar registrar_; | |
| 44 Profile* profile_; | |
| 45 | |
| 46 // Used to disable shortcut creation in tests. | |
| 47 bool disable_shortcut_creation_; | |
| 48 | |
| 49 // Fields used when installing application shortcuts. | |
| 50 ShellIntegration::ShortcutInfo shortcut_info_; | |
| 51 ImageLoadingTracker tracker_; | |
| 52 | |
| 53 DISALLOW_COPY_AND_ASSIGN(AppShortcutManager); | |
| 54 }; | |
| 55 | |
| 56 #endif // CHROME_BROWSER_EXTENSIONS_APP_SHORTCUT_MANAGER_H_ | |
| OLD | NEW |