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

Side by Side Diff: chrome/browser/extensions/api/storage/managed_value_store_cache.cc

Issue 2466523002: Remove some linked_ptr c/b/extension (Closed)
Patch Set: review Created 4 years, 1 month 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 unified diff | Download patch
OLDNEW
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/storage/managed_value_store_cache.h" 5 #include "chrome/browser/extensions/api/storage/managed_value_store_cache.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 return; 339 return;
340 } 340 }
341 341
342 GetStoreFor(extension_id)->SetCurrentPolicy(*current_policy); 342 GetStoreFor(extension_id)->SetCurrentPolicy(*current_policy);
343 } 343 }
344 344
345 PolicyValueStore* ManagedValueStoreCache::GetStoreFor( 345 PolicyValueStore* ManagedValueStoreCache::GetStoreFor(
346 const std::string& extension_id) { 346 const std::string& extension_id) {
347 DCHECK_CURRENTLY_ON(BrowserThread::FILE); 347 DCHECK_CURRENTLY_ON(BrowserThread::FILE);
348 348
349 PolicyValueStoreMap::iterator it = store_map_.find(extension_id); 349 auto it = store_map_.find(extension_id);
350 if (it != store_map_.end()) 350 if (it != store_map_.end())
351 return it->second.get(); 351 return it->second.get();
352 352
353 // Create the store now, and serve the cached policy until the PolicyService 353 // Create the store now, and serve the cached policy until the PolicyService
354 // sends updated values. 354 // sends updated values.
355 PolicyValueStore* store = new PolicyValueStore( 355 std::unique_ptr<PolicyValueStore> store(new PolicyValueStore(
356 extension_id, observers_, 356 extension_id, observers_,
357 storage_factory_->CreateSettingsStore(settings_namespace::MANAGED, 357 storage_factory_->CreateSettingsStore(settings_namespace::MANAGED,
358 kManagedModelType, extension_id)); 358 kManagedModelType, extension_id)));
359 store_map_[extension_id] = make_linked_ptr(store); 359 PolicyValueStore* raw_store = store.get();
360 store_map_[extension_id] = std::move(store);
360 361
361 return store; 362 return raw_store;
362 } 363 }
363 364
364 bool ManagedValueStoreCache::HasStore(const std::string& extension_id) const { 365 bool ManagedValueStoreCache::HasStore(const std::string& extension_id) const {
365 // Note: Currently only manage extensions (not apps). 366 // Note: Currently only manage extensions (not apps).
366 return storage_factory_->HasSettings(settings_namespace::MANAGED, 367 return storage_factory_->HasSettings(settings_namespace::MANAGED,
367 kManagedModelType, extension_id); 368 kManagedModelType, extension_id);
368 } 369 }
369 370
370 } // namespace extensions 371 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698