Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(10)

Side by Side Diff: apps/shortcut_manager.h

Issue 17261016: When app shortcuts are enabled, do a once-off creation of all shortcuts. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments. Fix tests. Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « apps/prefs.cc ('k') | apps/shortcut_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 APPS_SHORTCUT_MANAGER_H_ 5 #ifndef APPS_SHORTCUT_MANAGER_H_
6 #define APPS_SHORTCUT_MANAGER_H_ 6 #define APPS_SHORTCUT_MANAGER_H_
7 7
8 #include "base/memory/weak_ptr.h" 8 #include "base/memory/weak_ptr.h"
9 #include "chrome/common/extensions/extension.h" 9 #include "chrome/common/extensions/extension.h"
10 #include "components/browser_context_keyed_service/browser_context_keyed_service .h" 10 #include "components/browser_context_keyed_service/browser_context_keyed_service .h"
11 #include "content/public/browser/notification_observer.h" 11 #include "content/public/browser/notification_observer.h"
12 #include "content/public/browser/notification_registrar.h" 12 #include "content/public/browser/notification_registrar.h"
13 13
14 class PrefService;
14 class Profile; 15 class Profile;
15 16
16 namespace apps { 17 namespace apps {
17 18
18 // This class manages the installation of shortcuts for platform apps. 19 // This class manages the installation of shortcuts for platform apps.
19 class ShortcutManager : public BrowserContextKeyedService, 20 class ShortcutManager : public BrowserContextKeyedService,
20 public content::NotificationObserver { 21 public content::NotificationObserver {
21 public: 22 public:
22 explicit ShortcutManager(Profile* profile); 23 explicit ShortcutManager(Profile* profile);
23 24
24 virtual ~ShortcutManager(); 25 virtual ~ShortcutManager();
25 26
26 // content::NotificationObserver 27 // content::NotificationObserver
27 virtual void Observe(int type, 28 virtual void Observe(int type,
28 const content::NotificationSource& source, 29 const content::NotificationSource& source,
29 const content::NotificationDetails& details) OVERRIDE; 30 const content::NotificationDetails& details) OVERRIDE;
30 31
31 private: 32 private:
33 // Checks if kShortcutsEnabled is set in prefs. If not, this sets it and
34 // creates shortcuts for all apps.
35 void OnceOffCreateShortcuts();
36
32 void DeleteApplicationShortcuts(const extensions::Extension* extension); 37 void DeleteApplicationShortcuts(const extensions::Extension* extension);
33 38
34 content::NotificationRegistrar registrar_; 39 content::NotificationRegistrar registrar_;
35 Profile* profile_; 40 Profile* profile_;
41 PrefService* prefs_;
36 42
37 // Fields used when installing application shortcuts. 43 // Fields used when installing application shortcuts.
38 base::WeakPtrFactory<ShortcutManager> weak_factory_; 44 base::WeakPtrFactory<ShortcutManager> weak_factory_;
39 45
40 DISALLOW_COPY_AND_ASSIGN(ShortcutManager); 46 DISALLOW_COPY_AND_ASSIGN(ShortcutManager);
41 }; 47 };
42 48
43 } // namespace apps 49 } // namespace apps
44 50
45 #endif // APPS_SHORTCUT_MANAGER_H_ 51 #endif // APPS_SHORTCUT_MANAGER_H_
OLDNEW
« no previous file with comments | « apps/prefs.cc ('k') | apps/shortcut_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698