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

Side by Side Diff: chrome/browser/extensions/crx_installer.h

Issue 10375021: Move Extension into extensions namespace (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Take 6 Created 8 years, 7 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
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 CHROME_BROWSER_EXTENSIONS_CRX_INSTALLER_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_CRX_INSTALLER_H_
6 #define CHROME_BROWSER_EXTENSIONS_CRX_INSTALLER_H_ 6 #define CHROME_BROWSER_EXTENSIONS_CRX_INSTALLER_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 10
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 virtual void InstallUIAbort(bool user_initiated) OVERRIDE; 83 virtual void InstallUIAbort(bool user_initiated) OVERRIDE;
84 84
85 int creation_flags() const { return creation_flags_; } 85 int creation_flags() const { return creation_flags_; }
86 void set_creation_flags(int val) { creation_flags_ = val; } 86 void set_creation_flags(int val) { creation_flags_ = val; }
87 87
88 const GURL& download_url() const { return download_url_; } 88 const GURL& download_url() const { return download_url_; }
89 void set_download_url(const GURL& val) { download_url_ = val; } 89 void set_download_url(const GURL& val) { download_url_ = val; }
90 90
91 const FilePath& source_file() const { return source_file_; } 91 const FilePath& source_file() const { return source_file_; }
92 92
93 Extension::Location install_source() const { return install_source_; } 93 extensions::Extension::Location install_source() const {
94 void set_install_source(Extension::Location source) { 94 return install_source_;
95 }
96 void set_install_source(extensions::Extension::Location source) {
95 install_source_ = source; 97 install_source_ = source;
96 } 98 }
97 99
98 const std::string& expected_id() const { return expected_id_; } 100 const std::string& expected_id() const { return expected_id_; }
99 void set_expected_id(const std::string& val) { expected_id_ = val; } 101 void set_expected_id(const std::string& val) { expected_id_ = val; }
100 102
101 void set_expected_version(const Version& val) { 103 void set_expected_version(const Version& val) {
102 expected_version_.reset(val.Clone()); 104 expected_version_.reset(val.Clone());
103 } 105 }
104 106
105 bool delete_source() const { return delete_source_; } 107 bool delete_source() const { return delete_source_; }
106 void set_delete_source(bool val) { delete_source_ = val; } 108 void set_delete_source(bool val) { delete_source_ = val; }
107 109
108 bool allow_silent_install() const { return allow_silent_install_; } 110 bool allow_silent_install() const { return allow_silent_install_; }
109 void set_allow_silent_install(bool val) { allow_silent_install_ = val; } 111 void set_allow_silent_install(bool val) { allow_silent_install_ = val; }
110 112
111 bool is_gallery_install() const { 113 bool is_gallery_install() const {
112 return (creation_flags_ & Extension::FROM_WEBSTORE) > 0; 114 return (creation_flags_ & extensions::Extension::FROM_WEBSTORE) > 0;
113 } 115 }
114 void set_is_gallery_install(bool val) { 116 void set_is_gallery_install(bool val) {
115 if (val) 117 if (val)
116 creation_flags_ |= Extension::FROM_WEBSTORE; 118 creation_flags_ |= extensions::Extension::FROM_WEBSTORE;
117 else 119 else
118 creation_flags_ &= ~Extension::FROM_WEBSTORE; 120 creation_flags_ &= ~extensions::Extension::FROM_WEBSTORE;
119 } 121 }
120 122
121 // The original download URL should be set when the WebstoreInstaller is 123 // The original download URL should be set when the WebstoreInstaller is
122 // tracking the installation. The WebstoreInstaller uses this URL to match 124 // tracking the installation. The WebstoreInstaller uses this URL to match
123 // failure notifications to the extension. 125 // failure notifications to the extension.
124 const GURL& original_download_url() const { return original_download_url_; } 126 const GURL& original_download_url() const { return original_download_url_; }
125 void set_original_download_url(const GURL& url) { 127 void set_original_download_url(const GURL& url) {
126 original_download_url_ = url; 128 original_download_url_ = url;
127 } 129 }
128 130
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 virtual ~CrxInstaller(); 162 virtual ~CrxInstaller();
161 163
162 // Converts the source user script to an extension. 164 // Converts the source user script to an extension.
163 void ConvertUserScriptOnFileThread(); 165 void ConvertUserScriptOnFileThread();
164 166
165 // Converts the source web app to an extension. 167 // Converts the source web app to an extension.
166 void ConvertWebAppOnFileThread(const WebApplicationInfo& web_app); 168 void ConvertWebAppOnFileThread(const WebApplicationInfo& web_app);
167 169
168 // Called after OnUnpackSuccess as a last check to see whether the install 170 // Called after OnUnpackSuccess as a last check to see whether the install
169 // should complete. 171 // should complete.
170 bool AllowInstall(const Extension* extension, string16* error); 172 bool AllowInstall(const extensions::Extension* extension, string16* error);
171 173
172 // SandboxedExtensionUnpackerClient 174 // SandboxedExtensionUnpackerClient
173 virtual void OnUnpackFailure(const string16& error_message) OVERRIDE; 175 virtual void OnUnpackFailure(const string16& error_message) OVERRIDE;
174 virtual void OnUnpackSuccess(const FilePath& temp_dir, 176 virtual void OnUnpackSuccess(const FilePath& temp_dir,
175 const FilePath& extension_dir, 177 const FilePath& extension_dir,
176 const base::DictionaryValue* original_manifest, 178 const base::DictionaryValue* original_manifest,
177 const Extension* extension) OVERRIDE; 179 const extensions::Extension* extension) OVERRIDE;
178 180
179 // Returns true if we can skip confirmation because the install was 181 // Returns true if we can skip confirmation because the install was
180 // whitelisted. 182 // whitelisted.
181 bool CanSkipConfirmation(); 183 bool CanSkipConfirmation();
182 184
183 // Runs on the UI thread. Confirms with the user (via ExtensionInstallUI) that 185 // Runs on the UI thread. Confirms with the user (via ExtensionInstallUI) that
184 // it is OK to install this extension. 186 // it is OK to install this extension.
185 void ConfirmInstall(); 187 void ConfirmInstall();
186 188
187 // Runs on File thread. Install the unpacked extension into the profile and 189 // Runs on File thread. Install the unpacked extension into the profile and
188 // notify the frontend. 190 // notify the frontend.
189 void CompleteInstall(); 191 void CompleteInstall();
190 192
191 // Result reporting. 193 // Result reporting.
192 void ReportFailureFromFileThread(const string16& error); 194 void ReportFailureFromFileThread(const string16& error);
193 void ReportFailureFromUIThread(const string16& error); 195 void ReportFailureFromUIThread(const string16& error);
194 void ReportSuccessFromFileThread(); 196 void ReportSuccessFromFileThread();
195 void ReportSuccessFromUIThread(); 197 void ReportSuccessFromUIThread();
196 void NotifyCrxInstallComplete(const Extension* extension); 198 void NotifyCrxInstallComplete(const extensions::Extension* extension);
197 199
198 // The file we're installing. 200 // The file we're installing.
199 FilePath source_file_; 201 FilePath source_file_;
200 202
201 // The URL the file was downloaded from. 203 // The URL the file was downloaded from.
202 GURL download_url_; 204 GURL download_url_;
203 205
204 // The directory extensions are installed to. 206 // The directory extensions are installed to.
205 FilePath install_directory_; 207 FilePath install_directory_;
206 208
207 // The location the installation came from (bundled with Chromium, registry, 209 // The location the installation came from (bundled with Chromium, registry,
208 // manual install, etc). This metadata is saved with the installation if 210 // manual install, etc). This metadata is saved with the installation if
209 // successful. Defaults to INTERNAL. 211 // successful. Defaults to INTERNAL.
210 Extension::Location install_source_; 212 extensions::Extension::Location install_source_;
211 213
212 // Indicates whether the user has already approved the extension to be 214 // Indicates whether the user has already approved the extension to be
213 // installed. If true, |expected_manifest_| and |expected_id_| must match 215 // installed. If true, |expected_manifest_| and |expected_id_| must match
214 // those of the CRX. 216 // those of the CRX.
215 bool approved_; 217 bool approved_;
216 218
217 // For updates, external and webstore installs we have an ID we're expecting 219 // For updates, external and webstore installs we have an ID we're expecting
218 // the extension to contain. 220 // the extension to contain.
219 std::string expected_id_; 221 std::string expected_id_;
220 222
(...skipping 20 matching lines...) Expand all
241 // The download URL, before redirects, if this is a gallery install. 243 // The download URL, before redirects, if this is a gallery install.
242 GURL original_download_url_; 244 GURL original_download_url_;
243 245
244 // Whether to create an app shortcut after successful installation. This is 246 // Whether to create an app shortcut after successful installation. This is
245 // set based on the user's selection in the UI and can only ever be true for 247 // set based on the user's selection in the UI and can only ever be true for
246 // apps. 248 // apps.
247 bool create_app_shortcut_; 249 bool create_app_shortcut_;
248 250
249 // The extension we're installing. We own this and either pass it off to 251 // The extension we're installing. We own this and either pass it off to
250 // ExtensionService on success, or delete it on failure. 252 // ExtensionService on success, or delete it on failure.
251 scoped_refptr<const Extension> extension_; 253 scoped_refptr<const extensions::Extension> extension_;
252 254
253 // The ordinal of the NTP apps page |extension_| will be shown on. 255 // The ordinal of the NTP apps page |extension_| will be shown on.
254 StringOrdinal page_ordinal_; 256 StringOrdinal page_ordinal_;
255 257
256 // A parsed copy of the unmodified original manifest, before any 258 // A parsed copy of the unmodified original manifest, before any
257 // transformations like localization have taken place. 259 // transformations like localization have taken place.
258 scoped_ptr<base::DictionaryValue> original_manifest_; 260 scoped_ptr<base::DictionaryValue> original_manifest_;
259 261
260 // If non-empty, contains the current version of the extension we're 262 // If non-empty, contains the current version of the extension we're
261 // installing (for upgrades). 263 // installing (for upgrades).
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 extension_misc::CrxInstallCause install_cause_; 306 extension_misc::CrxInstallCause install_cause_;
305 307
306 // Creation flags to use for the extension. These flags will be used 308 // Creation flags to use for the extension. These flags will be used
307 // when calling Extenion::Create() by the crx installer. 309 // when calling Extenion::Create() by the crx installer.
308 int creation_flags_; 310 int creation_flags_;
309 311
310 DISALLOW_COPY_AND_ASSIGN(CrxInstaller); 312 DISALLOW_COPY_AND_ASSIGN(CrxInstaller);
311 }; 313 };
312 314
313 #endif // CHROME_BROWSER_EXTENSIONS_CRX_INSTALLER_H_ 315 #endif // CHROME_BROWSER_EXTENSIONS_CRX_INSTALLER_H_
OLDNEW
« no previous file with comments | « chrome/browser/extensions/convert_web_app_unittest.cc ('k') | chrome/browser/extensions/crx_installer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698