| 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 #include "chrome/browser/extensions/extension_webstore_private_api.h" | 5 #include "chrome/browser/extensions/extension_webstore_private_api.h" |
| 6 | 6 |
| 7 #include "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
| 8 #include "base/memory/scoped_vector.h" | 8 #include "base/memory/scoped_vector.h" |
| 9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| (...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 396 | 396 |
| 397 // Matches the AddRef in RunImpl(). | 397 // Matches the AddRef in RunImpl(). |
| 398 Release(); | 398 Release(); |
| 399 } | 399 } |
| 400 | 400 |
| 401 void BeginInstallWithManifestFunction::InstallUIProceed() { | 401 void BeginInstallWithManifestFunction::InstallUIProceed() { |
| 402 // This gets cleared in CrxInstaller::ConfirmInstall(). TODO(asargent) - in | 402 // This gets cleared in CrxInstaller::ConfirmInstall(). TODO(asargent) - in |
| 403 // the future we may also want to add time-based expiration, where a whitelist | 403 // the future we may also want to add time-based expiration, where a whitelist |
| 404 // entry is only valid for some number of minutes. | 404 // entry is only valid for some number of minutes. |
| 405 scoped_ptr<WebstoreInstaller::Approval> approval( | 405 scoped_ptr<WebstoreInstaller::Approval> approval( |
| 406 new WebstoreInstaller::Approval); | 406 WebstoreInstaller::Approval::CreateWithNoInstallPrompt( |
| 407 approval->extension_id = id_; | 407 profile(), id_, parsed_manifest_.Pass())); |
| 408 approval->profile = profile(); | |
| 409 approval->parsed_manifest.reset(parsed_manifest_.release()); | |
| 410 approval->use_app_installed_bubble = use_app_installed_bubble_; | 408 approval->use_app_installed_bubble = use_app_installed_bubble_; |
| 411 g_pending_approvals.Get().PushApproval(approval.Pass()); | 409 g_pending_approvals.Get().PushApproval(approval.Pass()); |
| 412 | 410 |
| 413 SetResult(ERROR_NONE); | 411 SetResult(ERROR_NONE); |
| 414 SendResponse(true); | 412 SendResponse(true); |
| 415 | 413 |
| 416 // The Permissions_Install histogram is recorded from the ExtensionService | 414 // The Permissions_Install histogram is recorded from the ExtensionService |
| 417 // for all extension installs, so we only need to record the web store | 415 // for all extension installs, so we only need to record the web store |
| 418 // specific histogram here. | 416 // specific histogram here. |
| 419 ExtensionService::RecordPermissionMessagesHistogram( | 417 ExtensionService::RecordPermissionMessagesHistogram( |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 503 void SilentlyInstallFunction::OnWebstoreParseSuccess( | 501 void SilentlyInstallFunction::OnWebstoreParseSuccess( |
| 504 const std::string& id, | 502 const std::string& id, |
| 505 const SkBitmap& icon, | 503 const SkBitmap& icon, |
| 506 base::DictionaryValue* parsed_manifest) { | 504 base::DictionaryValue* parsed_manifest) { |
| 507 CHECK_EQ(id_, id); | 505 CHECK_EQ(id_, id); |
| 508 | 506 |
| 509 // This lets CrxInstaller bypass the permission confirmation UI for the | 507 // This lets CrxInstaller bypass the permission confirmation UI for the |
| 510 // extension. The whitelist entry gets cleared in | 508 // extension. The whitelist entry gets cleared in |
| 511 // CrxInstaller::ConfirmInstall. | 509 // CrxInstaller::ConfirmInstall. |
| 512 scoped_ptr<WebstoreInstaller::Approval> approval( | 510 scoped_ptr<WebstoreInstaller::Approval> approval( |
| 513 new WebstoreInstaller::Approval); | 511 WebstoreInstaller::Approval::CreateWithNoInstallPrompt( |
| 514 approval->extension_id = id_; | 512 profile(), id_, scoped_ptr<base::DictionaryValue>(parsed_manifest))); |
| 515 approval->parsed_manifest.reset(parsed_manifest); | |
| 516 approval->profile = profile(); | |
| 517 approval->use_app_installed_bubble = false; | |
| 518 approval->skip_post_install_ui = true; | 513 approval->skip_post_install_ui = true; |
| 519 | 514 |
| 520 scoped_refptr<WebstoreInstaller> installer = new WebstoreInstaller( | 515 scoped_refptr<WebstoreInstaller> installer = new WebstoreInstaller( |
| 521 profile(), this, | 516 profile(), this, |
| 522 &(dispatcher()->delegate()->GetAssociatedWebContents()->GetController()), | 517 &(dispatcher()->delegate()->GetAssociatedWebContents()->GetController()), |
| 523 id_, approval.Pass(), WebstoreInstaller::FLAG_NONE); | 518 id_, approval.Pass(), WebstoreInstaller::FLAG_NONE); |
| 524 installer->Start(); | 519 installer->Start(); |
| 525 } | 520 } |
| 526 | 521 |
| 527 void SilentlyInstallFunction::OnWebstoreParseFailure( | 522 void SilentlyInstallFunction::OnWebstoreParseFailure( |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 634 SendResponse(true); | 629 SendResponse(true); |
| 635 } else { | 630 } else { |
| 636 // Matched with a Release in OnGpuInfoUpdate. | 631 // Matched with a Release in OnGpuInfoUpdate. |
| 637 AddRef(); | 632 AddRef(); |
| 638 | 633 |
| 639 manager->AddObserver(this); | 634 manager->AddObserver(this); |
| 640 manager->RequestCompleteGpuInfoIfNeeded(); | 635 manager->RequestCompleteGpuInfoIfNeeded(); |
| 641 } | 636 } |
| 642 return true; | 637 return true; |
| 643 } | 638 } |
| OLD | NEW |