| OLD | NEW |
| 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 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| 11 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
| 12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
| 14 #include "base/version.h" | 14 #include "base/version.h" |
| 15 #include "chrome/browser/extensions/blacklist.h" | 15 #include "chrome/browser/extensions/blacklist.h" |
| 16 #include "chrome/browser/extensions/extension_install_prompt.h" | 16 #include "chrome/browser/extensions/extension_install_prompt.h" |
| 17 #include "chrome/browser/extensions/extension_installer.h" | 17 #include "chrome/browser/extensions/extension_installer.h" |
| 18 #include "chrome/browser/extensions/extension_service.h" |
| 18 #include "chrome/browser/extensions/sandboxed_unpacker.h" | 19 #include "chrome/browser/extensions/sandboxed_unpacker.h" |
| 19 #include "chrome/browser/extensions/webstore_installer.h" | 20 #include "chrome/browser/extensions/webstore_installer.h" |
| 20 #include "chrome/common/extensions/extension_constants.h" | 21 #include "chrome/common/extensions/extension_constants.h" |
| 22 #include "extensions/browser/install_flag.h" |
| 21 #include "extensions/common/extension.h" | 23 #include "extensions/common/extension.h" |
| 22 #include "extensions/common/manifest.h" | 24 #include "extensions/common/manifest.h" |
| 23 #include "sync/api/string_ordinal.h" | 25 #include "sync/api/string_ordinal.h" |
| 24 | 26 |
| 25 class ExtensionService; | 27 class ExtensionService; |
| 26 class ExtensionServiceTest; | 28 class ExtensionServiceTest; |
| 27 class SkBitmap; | 29 class SkBitmap; |
| 28 struct WebApplicationInfo; | 30 struct WebApplicationInfo; |
| 29 | 31 |
| 30 namespace base { | 32 namespace base { |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 } | 175 } |
| 174 | 176 |
| 175 void set_page_ordinal(const syncer::StringOrdinal& page_ordinal) { | 177 void set_page_ordinal(const syncer::StringOrdinal& page_ordinal) { |
| 176 page_ordinal_ = page_ordinal; | 178 page_ordinal_ = page_ordinal; |
| 177 } | 179 } |
| 178 | 180 |
| 179 void set_error_on_unsupported_requirements(bool val) { | 181 void set_error_on_unsupported_requirements(bool val) { |
| 180 error_on_unsupported_requirements_ = val; | 182 error_on_unsupported_requirements_ = val; |
| 181 } | 183 } |
| 182 | 184 |
| 183 void set_install_wait_for_idle(bool val) { | 185 void set_install_immediately(bool val) { |
| 184 install_wait_for_idle_ = val; | 186 if (val) |
| 187 install_flags_ |= kInstallFlagInstallImmediately; |
| 188 else |
| 189 install_flags_ &= ~kInstallFlagInstallImmediately; |
| 185 } | 190 } |
| 186 | 191 |
| 187 void set_is_ephemeral(bool val) { | 192 void set_is_ephemeral(bool val) { |
| 188 is_ephemeral_ = val; | 193 if (val) |
| 194 install_flags_ |= kInstallFlagIsEphemeral; |
| 195 else |
| 196 install_flags_ &= ~kInstallFlagIsEphemeral; |
| 189 } | 197 } |
| 190 | 198 |
| 191 bool did_handle_successfully() const { return did_handle_successfully_; } | 199 bool did_handle_successfully() const { return did_handle_successfully_; } |
| 192 | 200 |
| 193 Profile* profile() { return installer_.profile(); } | 201 Profile* profile() { return installer_.profile(); } |
| 194 | 202 |
| 195 const Extension* extension() { return installer_.extension().get(); } | 203 const Extension* extension() { return installer_.extension().get(); } |
| 196 | 204 |
| 197 private: | 205 private: |
| 198 friend class ::ExtensionServiceTest; | 206 friend class ::ExtensionServiceTest; |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 384 // initiating the installation can be removed. This is different than whether | 392 // initiating the installation can be removed. This is different than whether |
| 385 // there was an error; if there was an error that rejects installation we | 393 // there was an error; if there was an error that rejects installation we |
| 386 // still consider the installation 'handled'. | 394 // still consider the installation 'handled'. |
| 387 bool did_handle_successfully_; | 395 bool did_handle_successfully_; |
| 388 | 396 |
| 389 // Whether we should produce an error if the manifest declares requirements | 397 // Whether we should produce an error if the manifest declares requirements |
| 390 // that are not met. If false and there is an unmet requirement, the install | 398 // that are not met. If false and there is an unmet requirement, the install |
| 391 // will continue but the extension will be distabled. | 399 // will continue but the extension will be distabled. |
| 392 bool error_on_unsupported_requirements_; | 400 bool error_on_unsupported_requirements_; |
| 393 | 401 |
| 394 bool has_requirement_errors_; | |
| 395 | |
| 396 extensions::BlacklistState blacklist_state_; | |
| 397 | |
| 398 bool install_wait_for_idle_; | |
| 399 | |
| 400 // Sequenced task runner where file I/O operations will be performed. | 402 // Sequenced task runner where file I/O operations will be performed. |
| 401 scoped_refptr<base::SequencedTaskRunner> installer_task_runner_; | 403 scoped_refptr<base::SequencedTaskRunner> installer_task_runner_; |
| 402 | 404 |
| 403 // Used to show the install dialog. | 405 // Used to show the install dialog. |
| 404 ExtensionInstallPrompt::ShowDialogCallback show_dialog_callback_; | 406 ExtensionInstallPrompt::ShowDialogCallback show_dialog_callback_; |
| 405 | 407 |
| 406 // Whether the update is initiated by the user from the extension settings | 408 // Whether the update is initiated by the user from the extension settings |
| 407 // page. | 409 // page. |
| 408 bool update_from_settings_page_; | 410 bool update_from_settings_page_; |
| 409 | 411 |
| 410 // True if an ephemeral app is being installed. | 412 // The flags for ExtensionService::OnExtensionInstalled. |
| 411 bool is_ephemeral_; | 413 int install_flags_; |
| 412 | 414 |
| 413 // Gives access to common methods and data of an extension installer. | 415 // Gives access to common methods and data of an extension installer. |
| 414 ExtensionInstaller installer_; | 416 ExtensionInstaller installer_; |
| 415 | 417 |
| 416 DISALLOW_COPY_AND_ASSIGN(CrxInstaller); | 418 DISALLOW_COPY_AND_ASSIGN(CrxInstaller); |
| 417 }; | 419 }; |
| 418 | 420 |
| 419 } // namespace extensions | 421 } // namespace extensions |
| 420 | 422 |
| 421 #endif // CHROME_BROWSER_EXTENSIONS_CRX_INSTALLER_H_ | 423 #endif // CHROME_BROWSER_EXTENSIONS_CRX_INSTALLER_H_ |
| OLD | NEW |