| 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 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 512 // or OnInstallComplete. | 512 // or OnInstallComplete. |
| 513 return RespondLater(); | 513 return RespondLater(); |
| 514 } | 514 } |
| 515 | 515 |
| 516 void WebstorePrivateInstallBundleFunction::OnFetchComplete( | 516 void WebstorePrivateInstallBundleFunction::OnFetchComplete( |
| 517 const GURL& url, const SkBitmap* bitmap) { | 517 const GURL& url, const SkBitmap* bitmap) { |
| 518 BundleInstaller::ItemList items; | 518 BundleInstaller::ItemList items; |
| 519 for (const auto& entry : params_->contents) { | 519 for (const auto& entry : params_->contents) { |
| 520 // Skip already-installed items. | 520 // Skip already-installed items. |
| 521 bool is_installed = | 521 bool is_installed = |
| 522 extensions::ExtensionRegistry::Get(browser_context())->GetExtensionById( | 522 extensions::ExtensionRegistry::Get(browser_context()) |
| 523 entry->id, extensions::ExtensionRegistry::EVERYTHING) != nullptr; | 523 ->GetExtensionById( |
| 524 entry.id, extensions::ExtensionRegistry::EVERYTHING) != nullptr; |
| 524 if (is_installed || | 525 if (is_installed || |
| 525 InstallTracker::Get(browser_context())->GetActiveInstall(entry->id)) { | 526 InstallTracker::Get(browser_context())->GetActiveInstall(entry.id)) { |
| 526 continue; | 527 continue; |
| 527 } | 528 } |
| 528 BundleInstaller::Item item; | 529 BundleInstaller::Item item; |
| 529 item.id = entry->id; | 530 item.id = entry.id; |
| 530 item.manifest = entry->manifest; | 531 item.manifest = entry.manifest; |
| 531 item.localized_name = entry->localized_name; | 532 item.localized_name = entry.localized_name; |
| 532 if (entry->icon_url) | 533 if (entry.icon_url) |
| 533 item.icon_url = source_url().Resolve(*entry->icon_url); | 534 item.icon_url = source_url().Resolve(*entry.icon_url); |
| 534 items.push_back(item); | 535 items.push_back(item); |
| 535 } | 536 } |
| 536 if (items.empty()) { | 537 if (items.empty()) { |
| 537 Respond(Error(kAlreadyInstalledError)); | 538 Respond(Error(kAlreadyInstalledError)); |
| 538 Release(); // Matches the AddRef in Run. | 539 Release(); // Matches the AddRef in Run. |
| 539 return; | 540 return; |
| 540 } | 541 } |
| 541 | 542 |
| 542 std::string authuser = | 543 std::string authuser = |
| 543 details().authuser ? *details().authuser : std::string(); | 544 details().authuser ? *details().authuser : std::string(); |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 692 WebstorePrivateGetEphemeralAppsEnabledFunction:: | 693 WebstorePrivateGetEphemeralAppsEnabledFunction:: |
| 693 ~WebstorePrivateGetEphemeralAppsEnabledFunction() {} | 694 ~WebstorePrivateGetEphemeralAppsEnabledFunction() {} |
| 694 | 695 |
| 695 ExtensionFunction::ResponseAction | 696 ExtensionFunction::ResponseAction |
| 696 WebstorePrivateGetEphemeralAppsEnabledFunction::Run() { | 697 WebstorePrivateGetEphemeralAppsEnabledFunction::Run() { |
| 697 return RespondNow(ArgumentList(GetEphemeralAppsEnabled::Results::Create( | 698 return RespondNow(ArgumentList(GetEphemeralAppsEnabled::Results::Create( |
| 698 false))); | 699 false))); |
| 699 } | 700 } |
| 700 | 701 |
| 701 } // namespace extensions | 702 } // namespace extensions |
| OLD | NEW |