| 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/api/webstore_private/webstore_private_api.h" | 5 #include "chrome/browser/extensions/api/webstore_private/webstore_private_api.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 317 | 317 |
| 318 void WebstorePrivateBeginInstallWithManifest3Function::HandleInstallProceed() { | 318 void WebstorePrivateBeginInstallWithManifest3Function::HandleInstallProceed() { |
| 319 // This gets cleared in CrxInstaller::ConfirmInstall(). TODO(asargent) - in | 319 // This gets cleared in CrxInstaller::ConfirmInstall(). TODO(asargent) - in |
| 320 // the future we may also want to add time-based expiration, where a whitelist | 320 // the future we may also want to add time-based expiration, where a whitelist |
| 321 // entry is only valid for some number of minutes. | 321 // entry is only valid for some number of minutes. |
| 322 std::unique_ptr<WebstoreInstaller::Approval> approval( | 322 std::unique_ptr<WebstoreInstaller::Approval> approval( |
| 323 WebstoreInstaller::Approval::CreateWithNoInstallPrompt( | 323 WebstoreInstaller::Approval::CreateWithNoInstallPrompt( |
| 324 chrome_details_.GetProfile(), details().id, | 324 chrome_details_.GetProfile(), details().id, |
| 325 std::move(parsed_manifest_), false)); | 325 std::move(parsed_manifest_), false)); |
| 326 approval->use_app_installed_bubble = !!details().app_install_bubble; | 326 approval->use_app_installed_bubble = !!details().app_install_bubble; |
| 327 approval->enable_launcher = !!details().enable_launcher; | |
| 328 // If we are enabling the launcher, we should not show the app list in order | 327 // If we are enabling the launcher, we should not show the app list in order |
| 329 // to train the user to open it themselves at least once. | 328 // to train the user to open it themselves at least once. |
| 330 approval->skip_post_install_ui = !!details().enable_launcher; | 329 approval->skip_post_install_ui = !!details().enable_launcher; |
| 331 approval->dummy_extension = dummy_extension_.get(); | 330 approval->dummy_extension = dummy_extension_.get(); |
| 332 approval->installing_icon = gfx::ImageSkia::CreateFrom1xBitmap(icon_); | 331 approval->installing_icon = gfx::ImageSkia::CreateFrom1xBitmap(icon_); |
| 333 if (details().authuser) | 332 if (details().authuser) |
| 334 approval->authuser = *details().authuser; | 333 approval->authuser = *details().authuser; |
| 335 g_pending_approvals.Get().PushApproval(std::move(approval)); | 334 g_pending_approvals.Get().PushApproval(std::move(approval)); |
| 336 | 335 |
| 337 DCHECK(scoped_active_install_.get()); | 336 DCHECK(scoped_active_install_.get()); |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 404 approval_ = g_pending_approvals.Get().PopApproval( | 403 approval_ = g_pending_approvals.Get().PopApproval( |
| 405 chrome_details_.GetProfile(), params->expected_id); | 404 chrome_details_.GetProfile(), params->expected_id); |
| 406 if (!approval_) { | 405 if (!approval_) { |
| 407 return RespondNow(Error(kNoPreviousBeginInstallWithManifestError, | 406 return RespondNow(Error(kNoPreviousBeginInstallWithManifestError, |
| 408 params->expected_id)); | 407 params->expected_id)); |
| 409 } | 408 } |
| 410 | 409 |
| 411 scoped_active_install_.reset(new ScopedActiveInstall( | 410 scoped_active_install_.reset(new ScopedActiveInstall( |
| 412 InstallTracker::Get(browser_context()), params->expected_id)); | 411 InstallTracker::Get(browser_context()), params->expected_id)); |
| 413 | 412 |
| 414 AppListService* app_list_service = AppListService::Get(); | |
| 415 | |
| 416 if (approval_->enable_launcher) { | |
| 417 app_list_service->EnableAppList(chrome_details_.GetProfile(), | |
| 418 AppListService::ENABLE_FOR_APP_INSTALL); | |
| 419 } | |
| 420 | |
| 421 if (IsAppLauncherEnabled() && approval_->manifest->is_app()) { | |
| 422 // Show the app list to show download is progressing. Don't show the app | |
| 423 // list on first app install so users can be trained to open it themselves. | |
| 424 app_list_service->ShowForAppInstall( | |
| 425 chrome_details_.GetProfile(), | |
| 426 params->expected_id, | |
| 427 approval_->enable_launcher); | |
| 428 } | |
| 429 | |
| 430 // Balanced in OnExtensionInstallSuccess() or OnExtensionInstallFailure(). | 413 // Balanced in OnExtensionInstallSuccess() or OnExtensionInstallFailure(). |
| 431 AddRef(); | 414 AddRef(); |
| 432 | 415 |
| 433 // The extension will install through the normal extension install flow, but | 416 // The extension will install through the normal extension install flow, but |
| 434 // the whitelist entry will bypass the normal permissions install dialog. | 417 // the whitelist entry will bypass the normal permissions install dialog. |
| 435 scoped_refptr<WebstoreInstaller> installer = new WebstoreInstaller( | 418 scoped_refptr<WebstoreInstaller> installer = new WebstoreInstaller( |
| 436 chrome_details_.GetProfile(), this, | 419 chrome_details_.GetProfile(), this, |
| 437 chrome_details_.GetAssociatedWebContents(), params->expected_id, | 420 chrome_details_.GetAssociatedWebContents(), params->expected_id, |
| 438 std::move(approval_), WebstoreInstaller::INSTALL_SOURCE_OTHER); | 421 std::move(approval_), WebstoreInstaller::INSTALL_SOURCE_OTHER); |
| 439 installer->Start(); | 422 installer->Start(); |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 597 WebstorePrivateGetEphemeralAppsEnabledFunction:: | 580 WebstorePrivateGetEphemeralAppsEnabledFunction:: |
| 598 ~WebstorePrivateGetEphemeralAppsEnabledFunction() {} | 581 ~WebstorePrivateGetEphemeralAppsEnabledFunction() {} |
| 599 | 582 |
| 600 ExtensionFunction::ResponseAction | 583 ExtensionFunction::ResponseAction |
| 601 WebstorePrivateGetEphemeralAppsEnabledFunction::Run() { | 584 WebstorePrivateGetEphemeralAppsEnabledFunction::Run() { |
| 602 return RespondNow(ArgumentList(GetEphemeralAppsEnabled::Results::Create( | 585 return RespondNow(ArgumentList(GetEphemeralAppsEnabled::Results::Create( |
| 603 false))); | 586 false))); |
| 604 } | 587 } |
| 605 | 588 |
| 606 } // namespace extensions | 589 } // namespace extensions |
| OLD | NEW |