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

Side by Side Diff: chrome/browser/extensions/extensions_ui.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_EXTENSIONS_EXTENSIONS_UI_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSIONS_UI_H_
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSIONS_UI_H_ 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSIONS_UI_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "chrome/browser/extensions/extension_uninstall_dialog.h" 13 #include "chrome/browser/extensions/extension_uninstall_ui.h"
14 #include "chrome/browser/extensions/pack_extension_job.h" 14 #include "chrome/browser/extensions/pack_extension_job.h"
15 #include "chrome/browser/ui/shell_dialogs.h" 15 #include "chrome/browser/ui/shell_dialogs.h"
16 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" 16 #include "chrome/browser/ui/webui/chrome_url_data_manager.h"
17 #include "chrome/browser/ui/webui/chrome_web_ui.h" 17 #include "chrome/browser/ui/webui/chrome_web_ui.h"
18 #include "chrome/common/extensions/extension_resource.h" 18 #include "chrome/common/extensions/extension_resource.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 #include "googleurl/src/gurl.h" 21 #include "googleurl/src/gurl.h"
22 22
23 class Extension; 23 class Extension;
(...skipping 19 matching lines...) Expand all
43 int render_process_id; 43 int render_process_id;
44 int render_view_id; 44 int render_view_id;
45 bool incognito; 45 bool incognito;
46 }; 46 };
47 47
48 // The handler for JavaScript messages related to the "extensions" view. 48 // The handler for JavaScript messages related to the "extensions" view.
49 class ExtensionsDOMHandler : public WebUIMessageHandler, 49 class ExtensionsDOMHandler : public WebUIMessageHandler,
50 public NotificationObserver, 50 public NotificationObserver,
51 public PackExtensionJob::Client, 51 public PackExtensionJob::Client,
52 public SelectFileDialog::Listener, 52 public SelectFileDialog::Listener,
53 public ExtensionUninstallDialog::Delegate { 53 public ExtensionUninstallUI::Delegate {
54 public: 54 public:
55 explicit ExtensionsDOMHandler(ExtensionService* extension_service); 55 explicit ExtensionsDOMHandler(ExtensionService* extension_service);
56 virtual ~ExtensionsDOMHandler(); 56 virtual ~ExtensionsDOMHandler();
57 57
58 // WebUIMessageHandler implementation. 58 // WebUIMessageHandler implementation.
59 virtual void RegisterMessages() OVERRIDE; 59 virtual void RegisterMessages() OVERRIDE;
60 60
61 // Extension Detail JSON Struct for page. (static for ease of testing). 61 // Extension Detail JSON Struct for page. (static for ease of testing).
62 // Note: service can be NULL in unit tests. 62 // Note: service can be NULL in unit tests.
63 static base::DictionaryValue* CreateExtensionDetailValue( 63 static base::DictionaryValue* CreateExtensionDetailValue(
64 ExtensionService* service, 64 ExtensionService* service,
65 const Extension* extension, 65 const Extension* extension,
66 const std::vector<ExtensionPage>& pages, 66 const std::vector<ExtensionPage>& pages,
67 bool enabled, 67 bool enabled,
68 bool terminated); 68 bool terminated);
69 69
70 // ExtensionPackJob::Client 70 // ExtensionPackJob::Client
71 virtual void OnPackSuccess(const FilePath& crx_file, 71 virtual void OnPackSuccess(const FilePath& crx_file,
72 const FilePath& key_file) OVERRIDE; 72 const FilePath& key_file) OVERRIDE;
73 73
74 virtual void OnPackFailure(const std::string& error) OVERRIDE; 74 virtual void OnPackFailure(const std::string& error) OVERRIDE;
75 75
76 // ExtensionUninstallDialog::Delegate: 76 // ExtensionUninstallDialog::Delegate:
77 virtual void ExtensionDialogAccepted() OVERRIDE; 77 virtual void ExtensionUninstallAccepted() OVERRIDE;
78 virtual void ExtensionDialogCanceled() OVERRIDE; 78 virtual void ExtensionUninstallCanceled() OVERRIDE;
79 79
80 private: 80 private:
81 // Callback for "requestExtensionsData" message. 81 // Callback for "requestExtensionsData" message.
82 void HandleRequestExtensionsData(const base::ListValue* args); 82 void HandleRequestExtensionsData(const base::ListValue* args);
83 83
84 // Callback for "toggleDeveloperMode" message. 84 // Callback for "toggleDeveloperMode" message.
85 void HandleToggleDeveloperMode(const base::ListValue* args); 85 void HandleToggleDeveloperMode(const base::ListValue* args);
86 86
87 // Callback for "inspect" message. 87 // Callback for "inspect" message.
88 void HandleInspectMessage(const base::ListValue* args); 88 void HandleInspectMessage(const base::ListValue* args);
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 const NotificationDetails& details) OVERRIDE; 145 const NotificationDetails& details) OVERRIDE;
146 146
147 // Helper that lists the current active html pages for an extension. 147 // Helper that lists the current active html pages for an extension.
148 std::vector<ExtensionPage> GetActivePagesForExtension( 148 std::vector<ExtensionPage> GetActivePagesForExtension(
149 const Extension* extension); 149 const Extension* extension);
150 void GetActivePagesForExtensionProcess( 150 void GetActivePagesForExtensionProcess(
151 RenderProcessHost* process, 151 RenderProcessHost* process,
152 const Extension* extension, 152 const Extension* extension,
153 std::vector<ExtensionPage> *result); 153 std::vector<ExtensionPage> *result);
154 154
155 // Returns the ExtensionUninstallDialog object for this class, creating it if 155 // Returns the ExtensionUninstallUI object for this class, creating it if
156 // needed. 156 // needed.
157 ExtensionUninstallDialog* GetExtensionUninstallDialog(); 157 ExtensionUninstallUI* GetExtensionUninstallUI();
158 158
159 // Our model. Outlives us since it's owned by our containing profile. 159 // Our model. Outlives us since it's owned by our containing profile.
160 ExtensionService* const extension_service_; 160 ExtensionService* const extension_service_;
161 161
162 // Used to pick the directory when loading an extension. 162 // Used to pick the directory when loading an extension.
163 scoped_refptr<SelectFileDialog> load_extension_dialog_; 163 scoped_refptr<SelectFileDialog> load_extension_dialog_;
164 164
165 // Used to package the extension. 165 // Used to package the extension.
166 scoped_refptr<PackExtensionJob> pack_job_; 166 scoped_refptr<PackExtensionJob> pack_job_;
167 167
168 // Used to show confirmation UI for uninstalling extensions in incognito mode. 168 // Used to show confirmation UI for uninstalling extensions in incognito mode.
169 scoped_ptr<ExtensionUninstallDialog> extension_uninstall_dialog_; 169 scoped_ptr<ExtensionUninstallUI> extension_uninstall_ui_;
170 170
171 // The id of the extension we are prompting the user about. 171 // The id of the extension we are prompting the user about.
172 std::string extension_id_prompting_; 172 std::string extension_id_prompting_;
173 173
174 // We monitor changes to the extension system so that we can reload when 174 // We monitor changes to the extension system so that we can reload when
175 // necessary. 175 // necessary.
176 NotificationRegistrar registrar_; 176 NotificationRegistrar registrar_;
177 177
178 // If true, we will ignore notifications in ::Observe(). This is needed 178 // If true, we will ignore notifications in ::Observe(). This is needed
179 // to prevent reloading the page when we were the cause of the 179 // to prevent reloading the page when we were the cause of the
(...skipping 16 matching lines...) Expand all
196 196
197 static RefCountedMemory* GetFaviconResourceBytes(); 197 static RefCountedMemory* GetFaviconResourceBytes();
198 198
199 static void RegisterUserPrefs(PrefService* prefs); 199 static void RegisterUserPrefs(PrefService* prefs);
200 200
201 private: 201 private:
202 DISALLOW_COPY_AND_ASSIGN(ExtensionsUI); 202 DISALLOW_COPY_AND_ASSIGN(ExtensionsUI);
203 }; 203 };
204 204
205 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSIONS_UI_H_ 205 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSIONS_UI_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698