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