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" |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
69 public: | 69 public: |
70 // Used in histograms; do not change order. | 70 // Used in histograms; do not change order. |
71 enum OffStoreInstallAllowReason { | 71 enum OffStoreInstallAllowReason { |
72 OffStoreInstallDisallowed, | 72 OffStoreInstallDisallowed, |
73 OffStoreInstallAllowedFromSettingsPage, | 73 OffStoreInstallAllowedFromSettingsPage, |
74 OffStoreInstallAllowedBecausePref, | 74 OffStoreInstallAllowedBecausePref, |
75 OffStoreInstallAllowedInTest, | 75 OffStoreInstallAllowedInTest, |
76 NumOffStoreInstallAllowReasons | 76 NumOffStoreInstallAllowReasons |
77 }; | 77 }; |
78 | 78 |
79 enum AllowSilent { | |
80 GRANT_AFTER_PROMPT, // No silent install, show a prompt instead. | |
Yoyo Zhou
2014/05/01 22:53:44
I think the "grant" here is superfluous. But as ka
Marijn Kruisselbrink
2014/05/05 20:45:36
Okay, I decided to skip the idea of having an enum
| |
81 GRANT_SILENTLY, // Silently install and grant all permissions. | |
82 SILENTLY_DONT_GRANT // Silently install, but don't grant any permissions. | |
83 }; | |
84 | |
79 // Extensions will be installed into service->install_directory(), then | 85 // Extensions will be installed into service->install_directory(), then |
80 // registered with |service|. This does a silent install - see below for | 86 // registered with |service|. This does a silent install - see below for |
81 // other options. | 87 // other options. |
82 static scoped_refptr<CrxInstaller> CreateSilent(ExtensionService* service); | 88 static scoped_refptr<CrxInstaller> CreateSilent(ExtensionService* service); |
83 | 89 |
84 // Same as above, but use |client| to generate a confirmation prompt. | 90 // Same as above, but use |client| to generate a confirmation prompt. |
85 static scoped_refptr<CrxInstaller> Create( | 91 static scoped_refptr<CrxInstaller> Create( |
86 ExtensionService* service, | 92 ExtensionService* service, |
87 scoped_ptr<ExtensionInstallPrompt> client); | 93 scoped_ptr<ExtensionInstallPrompt> client); |
88 | 94 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
123 void set_expected_id(const std::string& val) { expected_id_ = val; } | 129 void set_expected_id(const std::string& val) { expected_id_ = val; } |
124 | 130 |
125 void set_expected_version(const Version& val) { | 131 void set_expected_version(const Version& val) { |
126 expected_version_.reset(new Version(val)); | 132 expected_version_.reset(new Version(val)); |
127 expected_version_strict_checking_ = true; | 133 expected_version_strict_checking_ = true; |
128 } | 134 } |
129 | 135 |
130 bool delete_source() const { return delete_source_; } | 136 bool delete_source() const { return delete_source_; } |
131 void set_delete_source(bool val) { delete_source_ = val; } | 137 void set_delete_source(bool val) { delete_source_ = val; } |
132 | 138 |
133 bool allow_silent_install() const { return allow_silent_install_; } | 139 AllowSilent allow_silent_install() const { return allow_silent_install_; } |
134 void set_allow_silent_install(bool val) { allow_silent_install_ = val; } | 140 void set_allow_silent_install(AllowSilent val) { |
141 allow_silent_install_ = val; | |
142 } | |
135 | 143 |
136 bool is_gallery_install() const { | 144 bool is_gallery_install() const { |
137 return (creation_flags_ & Extension::FROM_WEBSTORE) > 0; | 145 return (creation_flags_ & Extension::FROM_WEBSTORE) > 0; |
138 } | 146 } |
139 void set_is_gallery_install(bool val) { | 147 void set_is_gallery_install(bool val) { |
140 if (val) | 148 if (val) |
141 creation_flags_ |= Extension::FROM_WEBSTORE; | 149 creation_flags_ |= Extension::FROM_WEBSTORE; |
142 else | 150 else |
143 creation_flags_ &= ~Extension::FROM_WEBSTORE; | 151 creation_flags_ &= ~Extension::FROM_WEBSTORE; |
144 } | 152 } |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
339 // temp_dir_, so we don't have to delete it explicitly. | 347 // temp_dir_, so we don't have to delete it explicitly. |
340 base::FilePath unpacked_extension_root_; | 348 base::FilePath unpacked_extension_root_; |
341 | 349 |
342 // True when the CRX being installed was just downloaded. | 350 // True when the CRX being installed was just downloaded. |
343 // Used to trigger extra checks before installing. | 351 // Used to trigger extra checks before installing. |
344 bool apps_require_extension_mime_type_; | 352 bool apps_require_extension_mime_type_; |
345 | 353 |
346 // Allows for the possibility of a normal install (one in which a |client| | 354 // Allows for the possibility of a normal install (one in which a |client| |
347 // is provided in the ctor) to procede without showing the permissions prompt | 355 // is provided in the ctor) to procede without showing the permissions prompt |
348 // dialog. | 356 // dialog. |
349 bool allow_silent_install_; | 357 AllowSilent allow_silent_install_; |
350 | 358 |
351 // The value of the content type header sent with the CRX. | 359 // The value of the content type header sent with the CRX. |
352 // Ignorred unless |require_extension_mime_type_| is true. | 360 // Ignorred unless |require_extension_mime_type_| is true. |
353 std::string original_mime_type_; | 361 std::string original_mime_type_; |
354 | 362 |
355 // What caused this install? Used only for histograms that report | 363 // What caused this install? Used only for histograms that report |
356 // on failure rates, broken down by the cause of the install. | 364 // on failure rates, broken down by the cause of the install. |
357 extension_misc::CrxInstallCause install_cause_; | 365 extension_misc::CrxInstallCause install_cause_; |
358 | 366 |
359 // Creation flags to use for the extension. These flags will be used | 367 // Creation flags to use for the extension. These flags will be used |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
393 | 401 |
394 // Gives access to common methods and data of an extension installer. | 402 // Gives access to common methods and data of an extension installer. |
395 ExtensionInstaller installer_; | 403 ExtensionInstaller installer_; |
396 | 404 |
397 DISALLOW_COPY_AND_ASSIGN(CrxInstaller); | 405 DISALLOW_COPY_AND_ASSIGN(CrxInstaller); |
398 }; | 406 }; |
399 | 407 |
400 } // namespace extensions | 408 } // namespace extensions |
401 | 409 |
402 #endif // CHROME_BROWSER_EXTENSIONS_CRX_INSTALLER_H_ | 410 #endif // CHROME_BROWSER_EXTENSIONS_CRX_INSTALLER_H_ |
OLD | NEW |