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

Side by Side Diff: chrome/browser/ui/webui/ntp/app_launcher_handler.h

Issue 7920023: Fix crashes related to the extension uninstall dialog. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 3 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_UI_WEBUI_NTP_APP_LAUNCHER_HANDLER_H_ 5 #ifndef CHROME_BROWSER_UI_WEBUI_NTP_APP_LAUNCHER_HANDLER_H_
6 #define CHROME_BROWSER_UI_WEBUI_NTP_APP_LAUNCHER_HANDLER_H_ 6 #define CHROME_BROWSER_UI_WEBUI_NTP_APP_LAUNCHER_HANDLER_H_
7 #pragma once 7 #pragma once
8 8
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "chrome/browser/extensions/extension_app_api.h" 10 #include "chrome/browser/extensions/extension_app_api.h"
11 #include "chrome/browser/extensions/extension_install_ui.h" 11 #include "chrome/browser/extensions/extension_install_ui.h"
12 #include "chrome/browser/extensions/extension_uninstall_dialog.h" 12 #include "chrome/browser/extensions/extension_uninstall_ui.h"
13 #include "chrome/browser/favicon/favicon_service.h" 13 #include "chrome/browser/favicon/favicon_service.h"
14 #include "chrome/browser/prefs/pref_change_registrar.h" 14 #include "chrome/browser/prefs/pref_change_registrar.h"
15 #include "chrome/common/extensions/extension.h" 15 #include "chrome/common/extensions/extension.h"
16 #include "chrome/common/extensions/extension_constants.h" 16 #include "chrome/common/extensions/extension_constants.h"
17 #include "content/browser/cancelable_request.h" 17 #include "content/browser/cancelable_request.h"
18 #include "content/browser/webui/web_ui.h" 18 #include "content/browser/webui/web_ui.h"
19 #include "content/common/notification_observer.h" 19 #include "content/common/notification_observer.h"
20 #include "content/common/notification_registrar.h" 20 #include "content/common/notification_registrar.h"
21 21
22 class ExtensionPrefs; 22 class ExtensionPrefs;
23 class ExtensionService; 23 class ExtensionService;
24 class PrefChangeRegistrar; 24 class PrefChangeRegistrar;
25 class PrefsService; 25 class PrefsService;
26 class Profile; 26 class Profile;
27 struct WebApplicationInfo; 27 struct WebApplicationInfo;
28 28
29 namespace gfx { 29 namespace gfx {
30 class Rect; 30 class Rect;
31 } 31 }
32 32
33 // The handler for Javascript messages related to the "apps" view. 33 // The handler for Javascript messages related to the "apps" view.
34 class AppLauncherHandler : public WebUIMessageHandler, 34 class AppLauncherHandler : public WebUIMessageHandler,
35 public ExtensionUninstallDialog::Delegate, 35 public ExtensionUninstallUI::Delegate,
36 public ExtensionInstallUI::Delegate, 36 public ExtensionInstallUI::Delegate,
37 public NotificationObserver { 37 public NotificationObserver {
38 public: 38 public:
39 explicit AppLauncherHandler(ExtensionService* extension_service); 39 explicit AppLauncherHandler(ExtensionService* extension_service);
40 virtual ~AppLauncherHandler(); 40 virtual ~AppLauncherHandler();
41 41
42 // Whether the app should be excluded from the "apps" list because 42 // Whether the app should be excluded from the "apps" list because
43 // it is special (such as the Web Store app). 43 // it is special (such as the Web Store app).
44 static bool IsAppExcludedFromList(const Extension* extension); 44 static bool IsAppExcludedFromList(const Extension* extension);
45 45
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 133
134 // Records an app launch in the corresponding |bucket| of the app launch 134 // Records an app launch in the corresponding |bucket| of the app launch
135 // histogram if the |escaped_url| corresponds to an installed app. 135 // histogram if the |escaped_url| corresponds to an installed app.
136 static void RecordAppLaunchByURL(Profile* profile, 136 static void RecordAppLaunchByURL(Profile* profile,
137 std::string escaped_url, 137 std::string escaped_url,
138 extension_misc::AppLaunchBucket bucket); 138 extension_misc::AppLaunchBucket bucket);
139 139
140 // Prompts the user to re-enable the app for |extension_id|. 140 // Prompts the user to re-enable the app for |extension_id|.
141 void PromptToEnableApp(const std::string& extension_id); 141 void PromptToEnableApp(const std::string& extension_id);
142 142
143 // ExtensionUninstallDialog::Delegate: 143 // ExtensionUninstallUI::Delegate:
144 virtual void ExtensionDialogAccepted() OVERRIDE; 144 virtual void ExtensionUninstallAccepted() OVERRIDE;
145 virtual void ExtensionDialogCanceled() OVERRIDE; 145 virtual void ExtensionUninstallCanceled() OVERRIDE;
146 146
147 // ExtensionInstallUI::Delegate: 147 // ExtensionInstallUI::Delegate:
148 virtual void InstallUIProceed() OVERRIDE; 148 virtual void InstallUIProceed() OVERRIDE;
149 virtual void InstallUIAbort(bool user_initiated) OVERRIDE; 149 virtual void InstallUIAbort(bool user_initiated) OVERRIDE;
150 150
151 // Returns the ExtensionUninstallDialog object for this class, creating it if 151 // Returns the ExtensionUninstallUI object for this class, creating it if
152 // needed. 152 // needed.
153 ExtensionUninstallDialog* GetExtensionUninstallDialog(); 153 ExtensionUninstallUI* GetExtensionUninstallUI();
154 154
155 // Returns the ExtensionInstallUI object for this class, creating it if 155 // Returns the ExtensionInstallUI object for this class, creating it if
156 // needed. 156 // needed.
157 ExtensionInstallUI* GetExtensionInstallUI(); 157 ExtensionInstallUI* GetExtensionInstallUI();
158 158
159 // Helper that uninstalls all the default apps. 159 // Helper that uninstalls all the default apps.
160 void UninstallDefaultApps(); 160 void UninstallDefaultApps();
161 161
162 // Continuation for installing a bookmark app after favicon lookup. 162 // Continuation for installing a bookmark app after favicon lookup.
163 void OnFaviconForApp(FaviconService::Handle handle, 163 void OnFaviconForApp(FaviconService::Handle handle,
164 history::FaviconData data); 164 history::FaviconData data);
165 165
166 // Sends |highlight_app_id_| to the js. 166 // Sends |highlight_app_id_| to the js.
167 void SetAppToBeHighlighted(); 167 void SetAppToBeHighlighted();
168 168
169 // The apps are represented in the extensions model, which 169 // The apps are represented in the extensions model, which
170 // outlives us since it's owned by our containing profile. 170 // outlives us since it's owned by our containing profile.
171 ExtensionService* const extension_service_; 171 ExtensionService* const extension_service_;
172 172
173 // We monitor changes to the extension system so that we can reload the apps 173 // We monitor changes to the extension system so that we can reload the apps
174 // when necessary. 174 // when necessary.
175 NotificationRegistrar registrar_; 175 NotificationRegistrar registrar_;
176 176
177 // Monitor extension preference changes so that the Web UI can be notified. 177 // Monitor extension preference changes so that the Web UI can be notified.
178 PrefChangeRegistrar pref_change_registrar_; 178 PrefChangeRegistrar pref_change_registrar_;
179 179
180 // Used to show confirmation UI for uninstalling extensions in incognito mode. 180 // Used to show confirmation UI for uninstalling extensions in incognito mode.
181 scoped_ptr<ExtensionUninstallDialog> extension_uninstall_dialog_; 181 scoped_ptr<ExtensionUninstallUI> extension_uninstall_ui_;
182 182
183 // Used to show confirmation UI for enabling extensions in incognito mode. 183 // Used to show confirmation UI for enabling extensions in incognito mode.
184 scoped_ptr<ExtensionInstallUI> extension_install_ui_; 184 scoped_ptr<ExtensionInstallUI> extension_install_ui_;
185 185
186 // The id of the extension we are prompting the user about. 186 // The id of the extension we are prompting the user about.
187 std::string extension_id_prompting_; 187 std::string extension_id_prompting_;
188 188
189 // Whether the promo is currently being shown. 189 // Whether the promo is currently being shown.
190 bool promo_active_; 190 bool promo_active_;
191 191
(...skipping 13 matching lines...) Expand all
205 // when the app is added to the page (via getAppsCallback or appAdded). 205 // when the app is added to the page (via getAppsCallback or appAdded).
206 std::string highlight_app_id_; 206 std::string highlight_app_id_;
207 207
208 // Hold state for favicon requests. 208 // Hold state for favicon requests.
209 CancelableRequestConsumerTSimple<AppInstallInfo*> favicon_consumer_; 209 CancelableRequestConsumerTSimple<AppInstallInfo*> favicon_consumer_;
210 210
211 DISALLOW_COPY_AND_ASSIGN(AppLauncherHandler); 211 DISALLOW_COPY_AND_ASSIGN(AppLauncherHandler);
212 }; 212 };
213 213
214 #endif // CHROME_BROWSER_UI_WEBUI_NTP_APP_LAUNCHER_HANDLER_H_ 214 #endif // CHROME_BROWSER_UI_WEBUI_NTP_APP_LAUNCHER_HANDLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698