| 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 "base/bind_helpers.h" | 7 #include "base/bind_helpers.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
| 10 #include "base/memory/scoped_vector.h" | 10 #include "base/memory/scoped_vector.h" |
| (...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 461 UpdateIsAppLauncherEnabled(base::Bind( | 461 UpdateIsAppLauncherEnabled(base::Bind( |
| 462 &CompleteInstallFunction::OnGetAppLauncherEnabled, this, | 462 &CompleteInstallFunction::OnGetAppLauncherEnabled, this, |
| 463 approval_->extension_id)); | 463 approval_->extension_id)); |
| 464 } | 464 } |
| 465 | 465 |
| 466 void CompleteInstallFunction::OnGetAppLauncherEnabled( | 466 void CompleteInstallFunction::OnGetAppLauncherEnabled( |
| 467 std::string id, | 467 std::string id, |
| 468 bool app_launcher_enabled) { | 468 bool app_launcher_enabled) { |
| 469 if (app_launcher_enabled) { | 469 if (app_launcher_enabled) { |
| 470 std::string name; | 470 std::string name; |
| 471 DCHECK(approval_->parsed_manifest->GetString(extension_manifest_keys::kName, | 471 if (!approval_->parsed_manifest->GetString(extension_manifest_keys::kName, |
| 472 &name)); | 472 &name)) { |
| 473 NOTREACHED(); |
| 474 } |
| 473 // Tell the app list about the install that we just started. | 475 // Tell the app list about the install that we just started. |
| 474 chrome::NotifyAppListOfBeginExtensionInstall( | 476 chrome::NotifyAppListOfBeginExtensionInstall( |
| 475 profile(), id, name, approval_->installing_icon); | 477 profile(), id, name, approval_->installing_icon); |
| 476 } | 478 } |
| 477 | 479 |
| 478 // The extension will install through the normal extension install flow, but | 480 // The extension will install through the normal extension install flow, but |
| 479 // the whitelist entry will bypass the normal permissions install dialog. | 481 // the whitelist entry will bypass the normal permissions install dialog. |
| 480 scoped_refptr<WebstoreInstaller> installer = new WebstoreInstaller( | 482 scoped_refptr<WebstoreInstaller> installer = new WebstoreInstaller( |
| 481 profile(), this, | 483 profile(), this, |
| 482 &(dispatcher()->delegate()->GetAssociatedWebContents()->GetController()), | 484 &(dispatcher()->delegate()->GetAssociatedWebContents()->GetController()), |
| (...skipping 21 matching lines...) Expand all Loading... |
| 504 id, error, reason); | 506 id, error, reason); |
| 505 } | 507 } |
| 506 | 508 |
| 507 error_ = error; | 509 error_ = error; |
| 508 SendResponse(false); | 510 SendResponse(false); |
| 509 | 511 |
| 510 // Matches the AddRef in RunImpl(). | 512 // Matches the AddRef in RunImpl(). |
| 511 Release(); | 513 Release(); |
| 512 } | 514 } |
| 513 | 515 |
| 516 void CompleteInstallFunction::OnExtensionDownloadProgress( |
| 517 const std::string& id, |
| 518 content::DownloadItem* item) { |
| 519 chrome::NotifyAppListOfDownloadProgress(profile(), id, |
| 520 item->PercentComplete()); |
| 521 } |
| 514 | 522 |
| 515 bool GetBrowserLoginFunction::RunImpl() { | 523 bool GetBrowserLoginFunction::RunImpl() { |
| 516 SetResult(CreateLoginResult(profile_->GetOriginalProfile())); | 524 SetResult(CreateLoginResult(profile_->GetOriginalProfile())); |
| 517 return true; | 525 return true; |
| 518 } | 526 } |
| 519 | 527 |
| 520 bool GetStoreLoginFunction::RunImpl() { | 528 bool GetStoreLoginFunction::RunImpl() { |
| 521 ExtensionService* service = | 529 ExtensionService* service = |
| 522 extensions::ExtensionSystem::Get(profile_)->extension_service(); | 530 extensions::ExtensionSystem::Get(profile_)->extension_service(); |
| 523 ExtensionPrefs* prefs = service->extension_prefs(); | 531 ExtensionPrefs* prefs = service->extension_prefs(); |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 569 &GetIsLauncherEnabledFunction::OnIsLauncherCheckCompleted, this)); | 577 &GetIsLauncherEnabledFunction::OnIsLauncherCheckCompleted, this)); |
| 570 return true; | 578 return true; |
| 571 } | 579 } |
| 572 | 580 |
| 573 void GetIsLauncherEnabledFunction::OnIsLauncherCheckCompleted(bool is_enabled) { | 581 void GetIsLauncherEnabledFunction::OnIsLauncherCheckCompleted(bool is_enabled) { |
| 574 SetResult(Value::CreateBooleanValue(is_enabled)); | 582 SetResult(Value::CreateBooleanValue(is_enabled)); |
| 575 SendResponse(true); | 583 SendResponse(true); |
| 576 } | 584 } |
| 577 | 585 |
| 578 } // namespace extensions | 586 } // namespace extensions |
| OLD | NEW |