Chromium Code Reviews| 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 <memory> | |
| 8 #include <string> | 9 #include <string> |
| 9 #include <vector> | 10 #include <vector> |
| 10 | 11 |
| 11 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 12 #include "base/files/file_path.h" | 13 #include "base/files/file_path.h" |
| 13 #include "base/macros.h" | 14 #include "base/macros.h" |
| 14 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
| 15 #include "base/memory/weak_ptr.h" | 16 #include "base/memory/weak_ptr.h" |
| 16 #include "base/version.h" | 17 #include "base/version.h" |
| 17 #include "chrome/browser/extensions/extension_install_checker.h" | 18 #include "chrome/browser/extensions/extension_install_checker.h" |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 193 | 194 |
| 194 void set_install_immediately(bool val) { | 195 void set_install_immediately(bool val) { |
| 195 set_install_flag(kInstallFlagInstallImmediately, val); | 196 set_install_flag(kInstallFlagInstallImmediately, val); |
| 196 } | 197 } |
| 197 void set_do_not_sync(bool val) { | 198 void set_do_not_sync(bool val) { |
| 198 set_install_flag(kInstallFlagDoNotSync, val); | 199 set_install_flag(kInstallFlagDoNotSync, val); |
| 199 } | 200 } |
| 200 | 201 |
| 201 bool did_handle_successfully() const { return did_handle_successfully_; } | 202 bool did_handle_successfully() const { return did_handle_successfully_; } |
| 202 | 203 |
| 203 Profile* profile() { return install_checker_.profile(); } | 204 Profile* profile() { return profile_; } |
| 204 | 205 |
| 205 const Extension* extension() { return install_checker_.extension().get(); } | 206 const Extension* extension() { return extension_.get(); } |
| 206 | 207 |
| 207 // The currently installed version of the extension, for updates. Will be | 208 // The currently installed version of the extension, for updates. Will be |
| 208 // invalid if this isn't an update. | 209 // invalid if this isn't an update. |
| 209 const base::Version& current_version() const { return current_version_; } | 210 const base::Version& current_version() const { return current_version_; } |
| 210 | 211 |
| 211 private: | 212 private: |
| 212 friend class ::ExtensionServiceTest; | 213 friend class ::ExtensionServiceTest; |
| 213 friend class ExtensionUpdaterTest; | 214 friend class ExtensionUpdaterTest; |
| 214 friend class ExtensionCrxInstallerTest; | 215 friend class ExtensionCrxInstallerTest; |
| 215 | 216 |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 281 // and needs additional permissions. | 282 // and needs additional permissions. |
| 282 void ConfirmReEnable(); | 283 void ConfirmReEnable(); |
| 283 | 284 |
| 284 void set_install_flag(int flag, bool val) { | 285 void set_install_flag(int flag, bool val) { |
| 285 if (val) | 286 if (val) |
| 286 install_flags_ |= flag; | 287 install_flags_ |= flag; |
| 287 else | 288 else |
| 288 install_flags_ &= ~flag; | 289 install_flags_ &= ~flag; |
| 289 } | 290 } |
| 290 | 291 |
| 292 // The Profile the extension is being installed in. | |
| 293 Profile* profile_; | |
| 294 | |
| 295 // The extension being installed. | |
| 296 scoped_refptr<const Extension> extension_; | |
| 297 | |
| 291 // The file we're installing. | 298 // The file we're installing. |
| 292 base::FilePath source_file_; | 299 base::FilePath source_file_; |
| 293 | 300 |
| 294 // The URL the file was downloaded from. | 301 // The URL the file was downloaded from. |
| 295 GURL download_url_; | 302 GURL download_url_; |
| 296 | 303 |
| 297 // The directory extensions are installed to. | 304 // The directory extensions are installed to. |
| 298 const base::FilePath install_directory_; | 305 const base::FilePath install_directory_; |
| 299 | 306 |
| 300 // The location the installation came from (bundled with Chromium, registry, | 307 // The location the installation came from (bundled with Chromium, registry, |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 431 ExtensionInstallPrompt::ShowDialogCallback show_dialog_callback_; | 438 ExtensionInstallPrompt::ShowDialogCallback show_dialog_callback_; |
| 432 | 439 |
| 433 // Whether the update is initiated by the user from the extension settings | 440 // Whether the update is initiated by the user from the extension settings |
| 434 // page. | 441 // page. |
| 435 bool update_from_settings_page_; | 442 bool update_from_settings_page_; |
| 436 | 443 |
| 437 // The flags for ExtensionService::OnExtensionInstalled. | 444 // The flags for ExtensionService::OnExtensionInstalled. |
| 438 int install_flags_; | 445 int install_flags_; |
| 439 | 446 |
| 440 // Performs requirements, policy and blacklist checks on the extension. | 447 // Performs requirements, policy and blacklist checks on the extension. |
| 441 ExtensionInstallChecker install_checker_; | 448 std::unique_ptr<ExtensionInstallChecker> install_checker_; |
|
Devlin
2017/03/16 19:29:40
optional: Truthfully, given the (lack of) complexi
michaelpg
2017/03/17 04:25:22
I checked when I was considering using base::Optio
| |
| 442 | 449 |
| 443 DISALLOW_COPY_AND_ASSIGN(CrxInstaller); | 450 DISALLOW_COPY_AND_ASSIGN(CrxInstaller); |
| 444 }; | 451 }; |
| 445 | 452 |
| 446 } // namespace extensions | 453 } // namespace extensions |
| 447 | 454 |
| 448 #endif // CHROME_BROWSER_EXTENSIONS_CRX_INSTALLER_H_ | 455 #endif // CHROME_BROWSER_EXTENSIONS_CRX_INSTALLER_H_ |
| OLD | NEW |