Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(39)

Side by Side Diff: chrome/browser/extensions/crx_installer.cc

Issue 12093036: Move Extension Location and Type enums to Manifest, and move InstallWarning to its own file. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/extensions/crx_installer.h ('k') | chrome/browser/extensions/default_apps.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "chrome/browser/extensions/crx_installer.h" 5 #include "chrome/browser/extensions/crx_installer.h"
6 6
7 #include <map> 7 #include <map>
8 #include <set> 8 #include <set>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 ExtensionInstallPrompt* client, 82 ExtensionInstallPrompt* client,
83 const WebstoreInstaller::Approval* approval) { 83 const WebstoreInstaller::Approval* approval) {
84 return new CrxInstaller(frontend->AsWeakPtr(), client, approval); 84 return new CrxInstaller(frontend->AsWeakPtr(), client, approval);
85 } 85 }
86 86
87 CrxInstaller::CrxInstaller( 87 CrxInstaller::CrxInstaller(
88 base::WeakPtr<ExtensionService> frontend_weak, 88 base::WeakPtr<ExtensionService> frontend_weak,
89 ExtensionInstallPrompt* client, 89 ExtensionInstallPrompt* client,
90 const WebstoreInstaller::Approval* approval) 90 const WebstoreInstaller::Approval* approval)
91 : install_directory_(frontend_weak->install_directory()), 91 : install_directory_(frontend_weak->install_directory()),
92 install_source_(Extension::INTERNAL), 92 install_source_(Manifest::INTERNAL),
93 approved_(false), 93 approved_(false),
94 extensions_enabled_(frontend_weak->extensions_enabled()), 94 extensions_enabled_(frontend_weak->extensions_enabled()),
95 delete_source_(false), 95 delete_source_(false),
96 create_app_shortcut_(false), 96 create_app_shortcut_(false),
97 frontend_weak_(frontend_weak), 97 frontend_weak_(frontend_weak),
98 profile_(frontend_weak->profile()), 98 profile_(frontend_weak->profile()),
99 client_(client), 99 client_(client),
100 apps_require_extension_mime_type_(false), 100 apps_require_extension_mime_type_(false),
101 allow_silent_install_(false), 101 allow_silent_install_(false),
102 install_cause_(extension_misc::INSTALL_CAUSE_UNSET), 102 install_cause_(extension_misc::INSTALL_CAUSE_UNSET),
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 (!expected_manifest_.get() || 236 (!expected_manifest_.get() ||
237 !expected_manifest_->Equals(original_manifest_.get()))) { 237 !expected_manifest_->Equals(original_manifest_.get()))) {
238 return CrxInstallerError( 238 return CrxInstallerError(
239 l10n_util::GetStringUTF16(IDS_EXTENSION_MANIFEST_INVALID)); 239 l10n_util::GetStringUTF16(IDS_EXTENSION_MANIFEST_INVALID));
240 } 240 }
241 241
242 // The checks below are skipped for themes and external installs. 242 // The checks below are skipped for themes and external installs.
243 // TODO(pamg): After ManagementPolicy refactoring is complete, remove this 243 // TODO(pamg): After ManagementPolicy refactoring is complete, remove this
244 // and other uses of install_source_ that are no longer needed now that the 244 // and other uses of install_source_ that are no longer needed now that the
245 // SandboxedUnpacker sets extension->location. 245 // SandboxedUnpacker sets extension->location.
246 if (extension->is_theme() || Extension::IsExternalLocation(install_source_)) 246 if (extension->is_theme() || Manifest::IsExternalLocation(install_source_))
247 return CrxInstallerError(); 247 return CrxInstallerError();
248 248
249 if (!extensions_enabled_) { 249 if (!extensions_enabled_) {
250 return CrxInstallerError( 250 return CrxInstallerError(
251 l10n_util::GetStringUTF16(IDS_EXTENSION_INSTALL_NOT_ENABLED)); 251 l10n_util::GetStringUTF16(IDS_EXTENSION_INSTALL_NOT_ENABLED));
252 } 252 }
253 253
254 if (install_cause_ == extension_misc::INSTALL_CAUSE_USER_DOWNLOAD) { 254 if (install_cause_ == extension_misc::INSTALL_CAUSE_USER_DOWNLOAD) {
255 if (FeatureSwitch::easy_off_store_install()->IsEnabled()) { 255 if (FeatureSwitch::easy_off_store_install()->IsEnabled()) {
256 const char* kHistogramName = "Extensions.OffStoreInstallDecisionEasy"; 256 const char* kHistogramName = "Extensions.OffStoreInstallDecisionEasy";
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 } 335 }
336 } 336 }
337 337
338 return CrxInstallerError(); 338 return CrxInstallerError();
339 } 339 }
340 340
341 void CrxInstaller::OnUnpackFailure(const string16& error_message) { 341 void CrxInstaller::OnUnpackFailure(const string16& error_message) {
342 DCHECK(installer_task_runner_->RunsTasksOnCurrentThread()); 342 DCHECK(installer_task_runner_->RunsTasksOnCurrentThread());
343 343
344 UMA_HISTOGRAM_ENUMERATION("Extensions.UnpackFailureInstallSource", 344 UMA_HISTOGRAM_ENUMERATION("Extensions.UnpackFailureInstallSource",
345 install_source(), Extension::NUM_LOCATIONS); 345 install_source(), Manifest::NUM_LOCATIONS);
346 346
347 UMA_HISTOGRAM_ENUMERATION("Extensions.UnpackFailureInstallCause", 347 UMA_HISTOGRAM_ENUMERATION("Extensions.UnpackFailureInstallCause",
348 install_cause(), 348 install_cause(),
349 extension_misc::NUM_INSTALL_CAUSES); 349 extension_misc::NUM_INSTALL_CAUSES);
350 350
351 ReportFailureFromFileThread(CrxInstallerError(error_message)); 351 ReportFailureFromFileThread(CrxInstallerError(error_message));
352 } 352 }
353 353
354 void CrxInstaller::OnUnpackSuccess(const FilePath& temp_dir, 354 void CrxInstaller::OnUnpackSuccess(const FilePath& temp_dir,
355 const FilePath& extension_dir, 355 const FilePath& extension_dir,
356 const DictionaryValue* original_manifest, 356 const DictionaryValue* original_manifest,
357 const Extension* extension) { 357 const Extension* extension) {
358 DCHECK(installer_task_runner_->RunsTasksOnCurrentThread()); 358 DCHECK(installer_task_runner_->RunsTasksOnCurrentThread());
359 359
360 UMA_HISTOGRAM_ENUMERATION("Extensions.UnpackSuccessInstallSource", 360 UMA_HISTOGRAM_ENUMERATION("Extensions.UnpackSuccessInstallSource",
361 install_source(), Extension::NUM_LOCATIONS); 361 install_source(), Manifest::NUM_LOCATIONS);
362 362
363 363
364 UMA_HISTOGRAM_ENUMERATION("Extensions.UnpackSuccessInstallCause", 364 UMA_HISTOGRAM_ENUMERATION("Extensions.UnpackSuccessInstallCause",
365 install_cause(), 365 install_cause(),
366 extension_misc::NUM_INSTALL_CAUSES); 366 extension_misc::NUM_INSTALL_CAUSES);
367 367
368 // Note: We take ownership of |extension| and |temp_dir|. 368 // Note: We take ownership of |extension| and |temp_dir|.
369 extension_ = extension; 369 extension_ = extension;
370 temp_dir_ = temp_dir; 370 temp_dir_ = temp_dir;
371 371
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
668 temp_dir_ = FilePath(); 668 temp_dir_ = FilePath();
669 } 669 }
670 670
671 if (delete_source_ && !source_file_.value().empty()) { 671 if (delete_source_ && !source_file_.value().empty()) {
672 extension_file_util::DeleteFile(source_file_, false); 672 extension_file_util::DeleteFile(source_file_, false);
673 source_file_ = FilePath(); 673 source_file_ = FilePath();
674 } 674 }
675 } 675 }
676 676
677 } // namespace extensions 677 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/crx_installer.h ('k') | chrome/browser/extensions/default_apps.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698