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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 47 // working with it, eg: | 47 // working with it, eg: |
| 48 // | 48 // |
| 49 // scoped_refptr<CrxInstaller> installer(new CrxInstaller(...)); | 49 // scoped_refptr<CrxInstaller> installer(new CrxInstaller(...)); |
| 50 // installer->set_foo(); | 50 // installer->set_foo(); |
| 51 // installer->set_bar(); | 51 // installer->set_bar(); |
| 52 // installer->InstallCrx(...); | 52 // installer->InstallCrx(...); |
| 53 class CrxInstaller | 53 class CrxInstaller |
| 54 : public SandboxedExtensionUnpackerClient, | 54 : public SandboxedExtensionUnpackerClient, |
| 55 public ExtensionInstallUI::Delegate { | 55 public ExtensionInstallUI::Delegate { |
| 56 public: | 56 public: |
| 57 // Used in histograms; do not change order. | |
| 58 enum OffStoreInstallAllowReason { | |
| 59 OffStoreInstallDisallowed, | |
| 60 OffStoreInstallAllowedFromSettingsPage, | |
| 61 OffStoreInstallAllowedBecausePref, | |
| 62 NumOffStoreInstallAllowReasons | |
| 63 }; | |
| 64 | |
| 57 // Extensions will be installed into frontend->install_directory(), | 65 // Extensions will be installed into frontend->install_directory(), |
| 58 // then registered with |frontend|. Any install UI will be displayed | 66 // then registered with |frontend|. Any install UI will be displayed |
| 59 // using |client|. Pass NULL for |client| for silent install | 67 // using |client|. Pass NULL for |client| for silent install |
| 60 static scoped_refptr<CrxInstaller> Create( | 68 static scoped_refptr<CrxInstaller> Create( |
| 61 ExtensionService* frontend, | 69 ExtensionService* frontend, |
| 62 ExtensionInstallUI* client); | 70 ExtensionInstallUI* client); |
| 63 | 71 |
| 64 // Same as the previous method, except use the |approval| to bypass the | 72 // Same as the previous method, except use the |approval| to bypass the |
| 65 // prompt. Note that the caller retains ownership of |approval|. | 73 // prompt. Note that the caller retains ownership of |approval|. |
| 66 static scoped_refptr<CrxInstaller> Create( | 74 static scoped_refptr<CrxInstaller> Create( |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 139 original_mime_type_ = original_mime_type; | 147 original_mime_type_ = original_mime_type; |
| 140 } | 148 } |
| 141 | 149 |
| 142 extension_misc::CrxInstallCause install_cause() const { | 150 extension_misc::CrxInstallCause install_cause() const { |
| 143 return install_cause_; | 151 return install_cause_; |
| 144 } | 152 } |
| 145 void set_install_cause(extension_misc::CrxInstallCause install_cause) { | 153 void set_install_cause(extension_misc::CrxInstallCause install_cause) { |
| 146 install_cause_ = install_cause; | 154 install_cause_ = install_cause; |
| 147 } | 155 } |
| 148 | 156 |
| 149 bool allow_off_store_install() const { return allow_off_store_install_; } | 157 OffStoreInstallAllowReason off_store_install_allow_reason() const { |
| 150 void set_allow_off_store_install(bool val) { allow_off_store_install_ = val; } | 158 return off_store_install_allow_reason_; |
|
Yoyo Zhou
2012/06/07 19:19:15
You need to change all the other callers of this (
Aaron Boodman
2012/06/07 22:37:11
Fussy, fussy.
| |
| 159 } | |
| 160 void set_off_store_install_allow_reason(OffStoreInstallAllowReason reason) { | |
| 161 off_store_install_allow_reason_ = reason; | |
| 162 } | |
| 151 | 163 |
| 152 void set_page_ordinal(const StringOrdinal& page_ordinal) { | 164 void set_page_ordinal(const StringOrdinal& page_ordinal) { |
| 153 page_ordinal_ = page_ordinal; | 165 page_ordinal_ = page_ordinal; |
| 154 } | 166 } |
| 155 | 167 |
| 156 Profile* profile() { return profile_; } | 168 Profile* profile() { return profile_; } |
| 157 | 169 |
| 158 private: | 170 private: |
| 159 friend class extensions::ExtensionUpdaterTest; | 171 friend class extensions::ExtensionUpdaterTest; |
| 160 | 172 |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 305 | 317 |
| 306 // What caused this install? Used only for histograms that report | 318 // What caused this install? Used only for histograms that report |
| 307 // on failure rates, broken down by the cause of the install. | 319 // on failure rates, broken down by the cause of the install. |
| 308 extension_misc::CrxInstallCause install_cause_; | 320 extension_misc::CrxInstallCause install_cause_; |
| 309 | 321 |
| 310 // Creation flags to use for the extension. These flags will be used | 322 // Creation flags to use for the extension. These flags will be used |
| 311 // when calling Extenion::Create() by the crx installer. | 323 // when calling Extenion::Create() by the crx installer. |
| 312 int creation_flags_; | 324 int creation_flags_; |
| 313 | 325 |
| 314 // Whether to allow off store installation. | 326 // Whether to allow off store installation. |
| 315 bool allow_off_store_install_; | 327 OffStoreInstallAllowReason off_store_install_allow_reason_; |
| 316 | 328 |
| 317 DISALLOW_COPY_AND_ASSIGN(CrxInstaller); | 329 DISALLOW_COPY_AND_ASSIGN(CrxInstaller); |
| 318 }; | 330 }; |
| 319 | 331 |
| 320 #endif // CHROME_BROWSER_EXTENSIONS_CRX_INSTALLER_H_ | 332 #endif // CHROME_BROWSER_EXTENSIONS_CRX_INSTALLER_H_ |
| OLD | NEW |