1 // Copyright 2013 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.
5 #ifndef CHROME_BROWSER_APPS_SHORTCUT_MANAGER_H_
6 #define CHROME_BROWSER_APPS_SHORTCUT_MANAGER_H_
8 #include "chrome/browser/profiles/profile_info_cache_observer.h"
9 #include "components/keyed_service/core/keyed_service.h"
10 #include "content/public/browser/notification_observer.h"
11 #include "content/public/browser/notification_registrar.h"
12 #include "extensions/common/extension.h"
17 namespace user_prefs
{
18 class PrefRegistrySyncable
;
21 // This class manages the installation of shortcuts for platform apps.
22 class AppShortcutManager
: public KeyedService
,
23 public content::NotificationObserver
,
24 public ProfileInfoCacheObserver
{
26 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable
* registry
);
28 explicit AppShortcutManager(Profile
* profile
);
30 virtual ~AppShortcutManager();
32 // Checks if kShortcutsEnabled is set in prefs. If not, this sets it and
33 // creates shortcuts for all apps.
34 void OnceOffCreateShortcuts();
36 // content::NotificationObserver
37 virtual void Observe(int type
,
38 const content::NotificationSource
& source
,
39 const content::NotificationDetails
& details
) OVERRIDE
;
41 // ProfileInfoCacheObserver
42 virtual void OnProfileWillBeRemoved(
43 const base::FilePath
& profile_path
) OVERRIDE
;
46 void DeleteApplicationShortcuts(const extensions::Extension
* extension
);
48 content::NotificationRegistrar registrar_
;
50 bool is_profile_info_cache_observer_
;
53 DISALLOW_COPY_AND_ASSIGN(AppShortcutManager
);
56 #endif // CHROME_BROWSER_APPS_SHORTCUT_MANAGER_H_