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, | |
|
Mattias Nissler (ping if slow)
2012/06/08 09:38:22
nit: I'd rename this to OffStoreInstallAllowedByPr
| |
| 62 OffStoreInstallAllowedInTest, | |
| 63 NumOffStoreInstallAllowReasons | |
|
Mattias Nissler (ping if slow)
2012/06/08 09:38:22
Style guide says "Though the Google C++ Style Guid
| |
| 64 }; | |
| 65 | |
| 57 // Extensions will be installed into frontend->install_directory(), | 66 // Extensions will be installed into frontend->install_directory(), |
| 58 // then registered with |frontend|. Any install UI will be displayed | 67 // then registered with |frontend|. Any install UI will be displayed |
| 59 // using |client|. Pass NULL for |client| for silent install | 68 // using |client|. Pass NULL for |client| for silent install |
| 60 static scoped_refptr<CrxInstaller> Create( | 69 static scoped_refptr<CrxInstaller> Create( |
| 61 ExtensionService* frontend, | 70 ExtensionService* frontend, |
| 62 ExtensionInstallUI* client); | 71 ExtensionInstallUI* client); |
| 63 | 72 |
| 64 // Same as the previous method, except use the |approval| to bypass the | 73 // Same as the previous method, except use the |approval| to bypass the |
| 65 // prompt. Note that the caller retains ownership of |approval|. | 74 // prompt. Note that the caller retains ownership of |approval|. |
| 66 static scoped_refptr<CrxInstaller> Create( | 75 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; | 148 original_mime_type_ = original_mime_type; |
| 140 } | 149 } |
| 141 | 150 |
| 142 extension_misc::CrxInstallCause install_cause() const { | 151 extension_misc::CrxInstallCause install_cause() const { |
| 143 return install_cause_; | 152 return install_cause_; |
| 144 } | 153 } |
| 145 void set_install_cause(extension_misc::CrxInstallCause install_cause) { | 154 void set_install_cause(extension_misc::CrxInstallCause install_cause) { |
| 146 install_cause_ = install_cause; | 155 install_cause_ = install_cause; |
| 147 } | 156 } |
| 148 | 157 |
| 149 bool allow_off_store_install() const { return allow_off_store_install_; } | 158 OffStoreInstallAllowReason off_store_install_allow_reason() const { |
| 150 void set_allow_off_store_install(bool val) { allow_off_store_install_ = val; } | 159 return off_store_install_allow_reason_; |
| 160 } | |
| 161 void set_off_store_install_allow_reason(OffStoreInstallAllowReason reason) { | |
| 162 off_store_install_allow_reason_ = reason; | |
| 163 } | |
| 151 | 164 |
| 152 void set_page_ordinal(const StringOrdinal& page_ordinal) { | 165 void set_page_ordinal(const StringOrdinal& page_ordinal) { |
| 153 page_ordinal_ = page_ordinal; | 166 page_ordinal_ = page_ordinal; |
| 154 } | 167 } |
| 155 | 168 |
| 156 Profile* profile() { return profile_; } | 169 Profile* profile() { return profile_; } |
| 157 | 170 |
| 158 private: | 171 private: |
| 159 friend class extensions::ExtensionUpdaterTest; | 172 friend class extensions::ExtensionUpdaterTest; |
| 160 | 173 |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 305 | 318 |
| 306 // What caused this install? Used only for histograms that report | 319 // What caused this install? Used only for histograms that report |
| 307 // on failure rates, broken down by the cause of the install. | 320 // on failure rates, broken down by the cause of the install. |
| 308 extension_misc::CrxInstallCause install_cause_; | 321 extension_misc::CrxInstallCause install_cause_; |
| 309 | 322 |
| 310 // Creation flags to use for the extension. These flags will be used | 323 // Creation flags to use for the extension. These flags will be used |
| 311 // when calling Extenion::Create() by the crx installer. | 324 // when calling Extenion::Create() by the crx installer. |
| 312 int creation_flags_; | 325 int creation_flags_; |
| 313 | 326 |
| 314 // Whether to allow off store installation. | 327 // Whether to allow off store installation. |
| 315 bool allow_off_store_install_; | 328 OffStoreInstallAllowReason off_store_install_allow_reason_; |
| 316 | 329 |
| 317 DISALLOW_COPY_AND_ASSIGN(CrxInstaller); | 330 DISALLOW_COPY_AND_ASSIGN(CrxInstaller); |
| 318 }; | 331 }; |
| 319 | 332 |
| 320 #endif // CHROME_BROWSER_EXTENSIONS_CRX_INSTALLER_H_ | 333 #endif // CHROME_BROWSER_EXTENSIONS_CRX_INSTALLER_H_ |
| OLD | NEW |