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

Side by Side Diff: apps/saved_files_service.cc

Issue 1458553006: ScopedPtrMap -> std::map from apps, ash, media, ui (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix ash_unittests compile error Created 5 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
« no previous file with comments | « apps/saved_files_service.h ('k') | ash/system/chromeos/power/tray_power_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "apps/saved_files_service.h" 5 #include "apps/saved_files_service.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <map> 8 #include <map>
9 9
10 #include "apps/saved_files_service_factory.h" 10 #include "apps/saved_files_service_factory.h"
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 } 268 }
269 } 269 }
270 270
271 void SavedFilesService::ClearQueue(const extensions::Extension* extension) { 271 void SavedFilesService::ClearQueue(const extensions::Extension* extension) {
272 ClearSavedFileEntries(ExtensionPrefs::Get(profile_), extension->id()); 272 ClearSavedFileEntries(ExtensionPrefs::Get(profile_), extension->id());
273 Clear(extension->id()); 273 Clear(extension->id());
274 } 274 }
275 275
276 SavedFilesService::SavedFiles* SavedFilesService::Get( 276 SavedFilesService::SavedFiles* SavedFilesService::Get(
277 const std::string& extension_id) const { 277 const std::string& extension_id) const {
278 base::ScopedPtrMap<std::string, scoped_ptr<SavedFiles>>::const_iterator it = 278 auto it = extension_id_to_saved_files_.find(extension_id);
279 extension_id_to_saved_files_.find(extension_id);
280 if (it != extension_id_to_saved_files_.end()) 279 if (it != extension_id_to_saved_files_.end())
281 return it->second; 280 return it->second.get();
282 281
283 return NULL; 282 return NULL;
284 } 283 }
285 284
286 SavedFilesService::SavedFiles* SavedFilesService::GetOrInsert( 285 SavedFilesService::SavedFiles* SavedFilesService::GetOrInsert(
287 const std::string& extension_id) { 286 const std::string& extension_id) {
288 SavedFiles* saved_files = Get(extension_id); 287 SavedFiles* saved_files = Get(extension_id);
289 if (saved_files) 288 if (saved_files)
290 return saved_files; 289 return saved_files;
291 290
292 scoped_ptr<SavedFiles> scoped_saved_files( 291 scoped_ptr<SavedFiles> scoped_saved_files(
293 new SavedFiles(profile_, extension_id)); 292 new SavedFiles(profile_, extension_id));
294 saved_files = scoped_saved_files.get(); 293 saved_files = scoped_saved_files.get();
295 extension_id_to_saved_files_.insert(extension_id, scoped_saved_files.Pass()); 294 extension_id_to_saved_files_.insert(
295 std::make_pair(extension_id, std::move(scoped_saved_files)));
296 return saved_files; 296 return saved_files;
297 } 297 }
298 298
299 void SavedFilesService::Clear(const std::string& extension_id) { 299 void SavedFilesService::Clear(const std::string& extension_id) {
300 extension_id_to_saved_files_.erase(extension_id); 300 extension_id_to_saved_files_.erase(extension_id);
301 } 301 }
302 302
303 SavedFilesService::SavedFiles::SavedFiles(Profile* profile, 303 SavedFilesService::SavedFiles::SavedFiles(Profile* profile,
304 const std::string& extension_id) 304 const std::string& extension_id)
305 : profile_(profile), extension_id_(extension_id) { 305 : profile_(profile), extension_id_(extension_id) {
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
442 void SavedFilesService::SetLruSizeForTest(int size) { 442 void SavedFilesService::SetLruSizeForTest(int size) {
443 g_max_saved_file_entries = size; 443 g_max_saved_file_entries = size;
444 } 444 }
445 445
446 // static 446 // static
447 void SavedFilesService::ClearLruSizeForTest() { 447 void SavedFilesService::ClearLruSizeForTest() {
448 g_max_saved_file_entries = kMaxSavedFileEntries; 448 g_max_saved_file_entries = kMaxSavedFileEntries;
449 } 449 }
450 450
451 } // namespace apps 451 } // namespace apps
OLDNEW
« no previous file with comments | « apps/saved_files_service.h ('k') | ash/system/chromeos/power/tray_power_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698