OLD | NEW |
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_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 |
11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
12 #include "base/file_path.h" | 12 #include "base/file_path.h" |
13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
15 #include "base/version.h" | 15 #include "base/version.h" |
16 #include "chrome/browser/extensions/extension_install_ui.h" | 16 #include "chrome/browser/extensions/extension_install_ui.h" |
17 #include "chrome/browser/extensions/sandboxed_extension_unpacker.h" | 17 #include "chrome/browser/extensions/sandboxed_extension_unpacker.h" |
18 #include "chrome/common/extensions/extension.h" | 18 #include "chrome/common/extensions/extension.h" |
| 19 #include "chrome/common/string_ordinal.h" |
19 #include "chrome/common/web_apps.h" | 20 #include "chrome/common/web_apps.h" |
20 | 21 |
21 class ExtensionService; | 22 class ExtensionService; |
22 class SkBitmap; | 23 class SkBitmap; |
23 | 24 |
24 // This class installs a crx file into a profile. | 25 // This class installs a crx file into a profile. |
25 // | 26 // |
26 // Installing a CRX is a multi-step process, including unpacking the crx, | 27 // Installing a CRX is a multi-step process, including unpacking the crx, |
27 // validating it, prompting the user, and installing. Since many of these | 28 // validating it, prompting the user, and installing. Since many of these |
28 // steps must occur on the file thread, this class contains a copy of all data | 29 // steps must occur on the file thread, this class contains a copy of all data |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 } | 171 } |
171 | 172 |
172 extension_misc::CrxInstallCause install_cause() const { | 173 extension_misc::CrxInstallCause install_cause() const { |
173 return install_cause_; | 174 return install_cause_; |
174 } | 175 } |
175 | 176 |
176 void set_install_cause(extension_misc::CrxInstallCause install_cause) { | 177 void set_install_cause(extension_misc::CrxInstallCause install_cause) { |
177 install_cause_ = install_cause; | 178 install_cause_ = install_cause; |
178 } | 179 } |
179 | 180 |
180 void set_page_index(int page_index) { | 181 void set_page_ordinal(const StringOrdinal& page_ordinal) { |
181 page_index_ = page_index; | 182 page_ordinal_ = page_ordinal; |
182 } | 183 } |
183 | 184 |
184 Profile* profile() { return profile_; } | 185 Profile* profile() { return profile_; } |
185 | 186 |
186 private: | 187 private: |
187 friend class ExtensionUpdaterTest; | 188 friend class ExtensionUpdaterTest; |
188 | 189 |
189 CrxInstaller(base::WeakPtr<ExtensionService> frontend_weak, | 190 CrxInstaller(base::WeakPtr<ExtensionService> frontend_weak, |
190 ExtensionInstallUI* client); | 191 ExtensionInstallUI* client); |
191 virtual ~CrxInstaller(); | 192 virtual ~CrxInstaller(); |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 | 265 |
265 // Whether to create an app shortcut after successful installation. This is | 266 // Whether to create an app shortcut after successful installation. This is |
266 // set based on the user's selection in the UI and can only ever be true for | 267 // set based on the user's selection in the UI and can only ever be true for |
267 // apps. | 268 // apps. |
268 bool create_app_shortcut_; | 269 bool create_app_shortcut_; |
269 | 270 |
270 // The extension we're installing. We own this and either pass it off to | 271 // The extension we're installing. We own this and either pass it off to |
271 // ExtensionService on success, or delete it on failure. | 272 // ExtensionService on success, or delete it on failure. |
272 scoped_refptr<const Extension> extension_; | 273 scoped_refptr<const Extension> extension_; |
273 | 274 |
274 // The index of the NTP apps page |extension_| will be shown on. | 275 // The ordinal of the NTP apps page |extension_| will be shown on. |
275 int page_index_; | 276 StringOrdinal page_ordinal_; |
276 | 277 |
277 // A parsed copy of the unmodified original manifest, before any | 278 // A parsed copy of the unmodified original manifest, before any |
278 // transformations like localization have taken place. | 279 // transformations like localization have taken place. |
279 scoped_ptr<base::DictionaryValue> original_manifest_; | 280 scoped_ptr<base::DictionaryValue> original_manifest_; |
280 | 281 |
281 // If non-empty, contains the current version of the extension we're | 282 // If non-empty, contains the current version of the extension we're |
282 // installing (for upgrades). | 283 // installing (for upgrades). |
283 std::string current_version_; | 284 std::string current_version_; |
284 | 285 |
285 // The icon we will display in the installation UI, if any. | 286 // The icon we will display in the installation UI, if any. |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 extension_misc::CrxInstallCause install_cause_; | 326 extension_misc::CrxInstallCause install_cause_; |
326 | 327 |
327 // Creation flags to use for the extension. These flags will be used | 328 // Creation flags to use for the extension. These flags will be used |
328 // when calling Extenion::Create() by the crx installer. | 329 // when calling Extenion::Create() by the crx installer. |
329 int creation_flags_; | 330 int creation_flags_; |
330 | 331 |
331 DISALLOW_COPY_AND_ASSIGN(CrxInstaller); | 332 DISALLOW_COPY_AND_ASSIGN(CrxInstaller); |
332 }; | 333 }; |
333 | 334 |
334 #endif // CHROME_BROWSER_EXTENSIONS_CRX_INSTALLER_H_ | 335 #endif // CHROME_BROWSER_EXTENSIONS_CRX_INSTALLER_H_ |
OLD | NEW |