Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / apps / shortcut_manager.h
blobe5cfc14099645c404424aff4ade44e8806b2bd42
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 "base/memory/weak_ptr.h"
9 #include "chrome/browser/profiles/profile_info_cache_observer.h"
10 #include "components/browser_context_keyed_service/browser_context_keyed_service.h"
11 #include "content/public/browser/notification_observer.h"
12 #include "content/public/browser/notification_registrar.h"
13 #include "extensions/common/extension.h"
15 class PrefService;
16 class Profile;
18 namespace user_prefs {
19 class PrefRegistrySyncable;
22 // This class manages the installation of shortcuts for platform apps.
23 class AppShortcutManager : public BrowserContextKeyedService,
24 public content::NotificationObserver,
25 public ProfileInfoCacheObserver {
26 public:
27 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry);
29 explicit AppShortcutManager(Profile* profile);
31 virtual ~AppShortcutManager();
33 // Checks if kShortcutsEnabled is set in prefs. If not, this sets it and
34 // creates shortcuts for all apps.
35 void OnceOffCreateShortcuts();
37 // content::NotificationObserver
38 virtual void Observe(int type,
39 const content::NotificationSource& source,
40 const content::NotificationDetails& details) OVERRIDE;
42 // ProfileInfoCacheObserver
43 virtual void OnProfileWillBeRemoved(
44 const base::FilePath& profile_path) OVERRIDE;
46 private:
47 void DeleteApplicationShortcuts(const extensions::Extension* extension);
49 content::NotificationRegistrar registrar_;
50 Profile* profile_;
51 bool is_profile_info_cache_observer_;
52 PrefService* prefs_;
54 // Fields used when installing application shortcuts.
55 base::WeakPtrFactory<AppShortcutManager> weak_factory_;
57 DISALLOW_COPY_AND_ASSIGN(AppShortcutManager);
60 #endif // CHROME_BROWSER_APPS_SHORTCUT_MANAGER_H_