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

Side by Side Diff: chrome/browser/dom_ui/app_launcher_handler.h

Issue 6162006: Changes to default apps promo per ui leads: (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review comments Created 9 years, 11 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 | « chrome/app/generated_resources.grd ('k') | chrome/browser/dom_ui/app_launcher_handler.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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 CHROME_BROWSER_DOM_UI_APP_LAUNCHER_HANDLER_H_ 5 #ifndef CHROME_BROWSER_DOM_UI_APP_LAUNCHER_HANDLER_H_
6 #define CHROME_BROWSER_DOM_UI_APP_LAUNCHER_HANDLER_H_ 6 #define CHROME_BROWSER_DOM_UI_APP_LAUNCHER_HANDLER_H_
7 #pragma once 7 #pragma once
8 8
9 #include "base/scoped_ptr.h" 9 #include "base/scoped_ptr.h"
10 #include "chrome/browser/dom_ui/dom_ui.h" 10 #include "chrome/browser/dom_ui/dom_ui.h"
11 #include "chrome/browser/extensions/extension_install_ui.h" 11 #include "chrome/browser/extensions/extension_install_ui.h"
12 #include "chrome/browser/prefs/pref_change_registrar.h" 12 #include "chrome/browser/prefs/pref_change_registrar.h"
13 #include "chrome/common/notification_observer.h" 13 #include "chrome/common/notification_observer.h"
14 #include "chrome/common/notification_registrar.h" 14 #include "chrome/common/notification_registrar.h"
15 15
16 class Extension; 16 class Extension;
17 class ExtensionPrefs; 17 class ExtensionPrefs;
18 class ExtensionService; 18 class ExtensionService;
19 class NotificationRegistrar; 19 class NotificationRegistrar;
20 class PrefChangeRegistrar; 20 class PrefChangeRegistrar;
21 class Profile;
21 22
22 namespace gfx { 23 namespace gfx {
23 class Rect; 24 class Rect;
24 } 25 }
25 26
26 // The handler for Javascript messages related to the "apps" view. 27 // The handler for Javascript messages related to the "apps" view.
27 class AppLauncherHandler 28 class AppLauncherHandler
28 : public DOMMessageHandler, 29 : public DOMMessageHandler,
29 public ExtensionInstallUI::Delegate, 30 public ExtensionInstallUI::Delegate,
30 public NotificationObserver { 31 public NotificationObserver {
31 public: 32 public:
32 explicit AppLauncherHandler(ExtensionService* extension_service); 33 explicit AppLauncherHandler(ExtensionService* extension_service);
33 virtual ~AppLauncherHandler(); 34 virtual ~AppLauncherHandler();
34 35
35 // Populate a dictionary with the information from an extension. 36 // Populate a dictionary with the information from an extension.
36 static void CreateAppInfo(const Extension* extension, 37 static void CreateAppInfo(const Extension* extension,
37 ExtensionPrefs* extension_prefs, 38 ExtensionPrefs* extension_prefs,
38 DictionaryValue* value); 39 DictionaryValue* value);
39 40
40 // Callback for pings related to launching apps on the NTP. 41 // Callback for pings related to launching apps on the NTP.
41 static bool HandlePing(const std::string& path); 42 static bool HandlePing(Profile* profile, const std::string& path);
42 43
43 // DOMMessageHandler implementation. 44 // DOMMessageHandler implementation.
44 virtual DOMMessageHandler* Attach(DOMUI* dom_ui); 45 virtual DOMMessageHandler* Attach(DOMUI* dom_ui);
45 virtual void RegisterMessages(); 46 virtual void RegisterMessages();
46 47
47 // NotificationObserver 48 // NotificationObserver
48 virtual void Observe(NotificationType type, 49 virtual void Observe(NotificationType type,
49 const NotificationSource& source, 50 const NotificationSource& source,
50 const NotificationDetails& details); 51 const NotificationDetails& details);
51 52
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 virtual void InstallUIProceed(); 85 virtual void InstallUIProceed();
85 virtual void InstallUIAbort(); 86 virtual void InstallUIAbort();
86 87
87 // Returns the ExtensionInstallUI object for this class, creating it if 88 // Returns the ExtensionInstallUI object for this class, creating it if
88 // needed. 89 // needed.
89 ExtensionInstallUI* GetExtensionInstallUI(); 90 ExtensionInstallUI* GetExtensionInstallUI();
90 91
91 // Starts the animation of the app icon. 92 // Starts the animation of the app icon.
92 void AnimateAppIcon(const Extension* extension, const gfx::Rect& rect); 93 void AnimateAppIcon(const Extension* extension, const gfx::Rect& rect);
93 94
95 // Helper that uninstalls all the default apps.
96 void UninstallDefaultApps();
97
94 // The apps are represented in the extensions model. 98 // The apps are represented in the extensions model.
95 scoped_refptr<ExtensionService> extensions_service_; 99 scoped_refptr<ExtensionService> extensions_service_;
96 100
97 // We monitor changes to the extension system so that we can reload the apps 101 // We monitor changes to the extension system so that we can reload the apps
98 // when necessary. 102 // when necessary.
99 NotificationRegistrar registrar_; 103 NotificationRegistrar registrar_;
100 104
101 // Monitor extension preference changes so that the DOM UI can be notified. 105 // Monitor extension preference changes so that the DOM UI can be notified.
102 PrefChangeRegistrar pref_change_registrar_; 106 PrefChangeRegistrar pref_change_registrar_;
103 107
104 // Used to show confirmation UI for uninstalling/enabling extensions in 108 // Used to show confirmation UI for uninstalling/enabling extensions in
105 // incognito mode. 109 // incognito mode.
106 scoped_ptr<ExtensionInstallUI> install_ui_; 110 scoped_ptr<ExtensionInstallUI> install_ui_;
107 111
108 // The id of the extension we are prompting the user about. 112 // The id of the extension we are prompting the user about.
109 std::string extension_id_prompting_; 113 std::string extension_id_prompting_;
110 114
111 // Whether the promo is currently being shown. 115 // Whether the promo is currently being shown.
112 bool promo_active_; 116 bool promo_active_;
113 117
118 // When true, we ignore changes to the underlying data rather than immediately
119 // refreshing. This is useful when making many batch updates to avoid flicker.
120 bool ignore_changes_;
121
114 DISALLOW_COPY_AND_ASSIGN(AppLauncherHandler); 122 DISALLOW_COPY_AND_ASSIGN(AppLauncherHandler);
115 }; 123 };
116 124
117 #endif // CHROME_BROWSER_DOM_UI_APP_LAUNCHER_HANDLER_H_ 125 #endif // CHROME_BROWSER_DOM_UI_APP_LAUNCHER_HANDLER_H_
OLDNEW
« no previous file with comments | « chrome/app/generated_resources.grd ('k') | chrome/browser/dom_ui/app_launcher_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698