OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/extension_webstore_private_api.h" | 5 #include "chrome/browser/extensions/extension_webstore_private_api.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/scoped_temp_dir.h" | 10 #include "base/scoped_temp_dir.h" |
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
447 } | 447 } |
448 | 448 |
449 void BeginInstallWithManifestFunction::InstallUIProceed() { | 449 void BeginInstallWithManifestFunction::InstallUIProceed() { |
450 CrxInstaller::WhitelistEntry* entry = new CrxInstaller::WhitelistEntry; | 450 CrxInstaller::WhitelistEntry* entry = new CrxInstaller::WhitelistEntry; |
451 entry->parsed_manifest.reset(parsed_manifest_.release()); | 451 entry->parsed_manifest.reset(parsed_manifest_.release()); |
452 entry->localized_name = localized_name_; | 452 entry->localized_name = localized_name_; |
453 CrxInstaller::SetWhitelistEntry(id_, entry); | 453 CrxInstaller::SetWhitelistEntry(id_, entry); |
454 SetResult(ERROR_NONE); | 454 SetResult(ERROR_NONE); |
455 SendResponse(true); | 455 SendResponse(true); |
456 | 456 |
| 457 // The Permissions_Install histogram is recorded from the ExtensionService |
| 458 // for all extension installs, so we only need to record the web store |
| 459 // specific histogram here. |
| 460 ExtensionService::RecordPermissionMessagesHistogram( |
| 461 dummy_extension_, "Extensions.Permissions_WebStoreInstall"); |
| 462 |
457 // Matches the AddRef in RunImpl(). | 463 // Matches the AddRef in RunImpl(). |
458 Release(); | 464 Release(); |
459 } | 465 } |
460 | 466 |
461 void BeginInstallWithManifestFunction::InstallUIAbort(bool user_initiated) { | 467 void BeginInstallWithManifestFunction::InstallUIAbort(bool user_initiated) { |
462 error_ = std::string(kUserCancelledError); | 468 error_ = std::string(kUserCancelledError); |
463 SetResult(USER_CANCELLED); | 469 SetResult(USER_CANCELLED); |
464 SendResponse(false); | 470 SendResponse(false); |
465 | 471 |
| 472 // The web store install histograms are a subset of the install histograms. |
| 473 // We need to record both histograms here since CrxInstaller::InstallUIAbort |
| 474 // is never called for web store install cancellations |
| 475 std::string histogram_name = user_initiated ? |
| 476 "Extensions.Permissions_WebStoreInstallCancel" : |
| 477 "Extensions.Permissions_WebStoreInstallAbort"; |
| 478 ExtensionService::RecordPermissionMessagesHistogram( |
| 479 dummy_extension_, histogram_name.c_str()); |
| 480 |
| 481 histogram_name = user_initiated ? |
| 482 "Extensions.Permissions_InstallCancel" : |
| 483 "Extensions.Permissions_InstallAbort"; |
| 484 ExtensionService::RecordPermissionMessagesHistogram( |
| 485 dummy_extension_, histogram_name.c_str()); |
| 486 |
466 // Matches the AddRef in RunImpl(). | 487 // Matches the AddRef in RunImpl(). |
467 Release(); | 488 Release(); |
468 } | 489 } |
469 | 490 |
470 bool CompleteInstallFunction::RunImpl() { | 491 bool CompleteInstallFunction::RunImpl() { |
471 if (!IsWebStoreURL(profile_, source_url())) | 492 if (!IsWebStoreURL(profile_, source_url())) |
472 return false; | 493 return false; |
473 | 494 |
474 std::string id; | 495 std::string id; |
475 EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &id)); | 496 EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &id)); |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
647 } | 668 } |
648 | 669 |
649 DCHECK(waiting_for_token_); | 670 DCHECK(waiting_for_token_); |
650 | 671 |
651 result_.reset(CreateLoginResult(profile_->GetOriginalProfile())); | 672 result_.reset(CreateLoginResult(profile_->GetOriginalProfile())); |
652 SendResponse(true); | 673 SendResponse(true); |
653 | 674 |
654 // Matches the AddRef in RunImpl(). | 675 // Matches the AddRef in RunImpl(). |
655 Release(); | 676 Release(); |
656 } | 677 } |
OLD | NEW |