Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5602)

Unified Diff: chrome/browser/component_updater/component_updater_service.cc

Issue 318143003: Make CUS interface more resilient by returning a copy of the data (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/component_updater/component_updater_service.cc
diff --git a/chrome/browser/component_updater/component_updater_service.cc b/chrome/browser/component_updater/component_updater_service.cc
index f2518ea19991b784b87826dff2da6c76c82d919b..ec10a12f42c0e9eb13f51cc5c57bbbae390ec199 100644
--- a/chrome/browser/component_updater/component_updater_service.cc
+++ b/chrome/browser/component_updater/component_updater_service.cc
@@ -15,7 +15,6 @@
#include "base/files/file_path.h"
#include "base/logging.h"
#include "base/memory/scoped_ptr.h"
-#include "base/memory/weak_ptr.h"
#include "base/observer_list.h"
#include "base/sequenced_task_runner.h"
#include "base/stl_util.h"
@@ -155,8 +154,8 @@ class CrxUpdateService : public ComponentUpdateService, public OnDemandUpdater {
virtual Status Stop() OVERRIDE;
virtual Status RegisterComponent(const CrxComponent& component) OVERRIDE;
virtual std::vector<std::string> GetComponentIDs() const OVERRIDE;
- virtual CrxUpdateItem* GetComponentDetails(
- const std::string& component_id) const OVERRIDE;
+ virtual bool GetComponentDetails(const std::string& component_id,
+ CrxUpdateItem* item) const OVERRIDE;
virtual OnDemandUpdater& GetOnDemandUpdater() OVERRIDE;
// Overrides for OnDemandUpdater.
@@ -510,10 +509,13 @@ std::vector<std::string> CrxUpdateService::GetComponentIDs() const {
return component_ids;
}
-CrxUpdateItem* CrxUpdateService::GetComponentDetails(
- const std::string& component_id) const {
+bool CrxUpdateService::GetComponentDetails(const std::string& component_id,
+ CrxUpdateItem* item) const {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- return FindUpdateItemById(component_id);
+ const CrxUpdateItem* crx_update_item(FindUpdateItemById(component_id));
+ if (crx_update_item)
+ *item = *crx_update_item;
+ return crx_update_item != NULL;
}
OnDemandUpdater& CrxUpdateService::GetOnDemandUpdater() {
« no previous file with comments | « chrome/browser/component_updater/component_updater_service.h ('k') | chrome/browser/ui/webui/components_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698