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

Side by Side Diff: trunk/src/chrome/browser/extensions/api/storage/settings_backend.cc

Issue 14824006: Revert 198820 "Move FileEnumerator to its own file, do some refa..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years, 7 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 unified diff | Download patch | Annotate | Revision Log
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/settings_backend.h" 5 #include "chrome/browser/extensions/api/storage/settings_backend.h"
6 6
7 #include "base/files/file_enumerator.h" 7 #include "base/file_util.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "chrome/browser/extensions/api/storage/settings_sync_processor.h" 9 #include "chrome/browser/extensions/api/storage/settings_sync_processor.h"
10 #include "chrome/browser/extensions/api/storage/settings_sync_util.h" 10 #include "chrome/browser/extensions/api/storage/settings_sync_util.h"
11 #include "chrome/browser/extensions/api/storage/syncable_settings_storage.h" 11 #include "chrome/browser/extensions/api/storage/syncable_settings_storage.h"
12 #include "content/public/browser/browser_thread.h" 12 #include "content/public/browser/browser_thread.h"
13 #include "sync/api/sync_error_factory.h" 13 #include "sync/api/sync_error_factory.h"
14 14
15 using content::BrowserThread; 15 using content::BrowserThread;
16 16
17 namespace extensions { 17 namespace extensions {
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 std::set<std::string> result; 98 std::set<std::string> result;
99 99
100 // Storage areas can be in-memory as well as on disk. |storage_objs_| will 100 // Storage areas can be in-memory as well as on disk. |storage_objs_| will
101 // contain all that are in-memory. 101 // contain all that are in-memory.
102 for (StorageObjMap::iterator it = storage_objs_.begin(); 102 for (StorageObjMap::iterator it = storage_objs_.begin();
103 it != storage_objs_.end(); ++it) { 103 it != storage_objs_.end(); ++it) {
104 result.insert(it->first); 104 result.insert(it->first);
105 } 105 }
106 106
107 // Leveldb databases are directories inside base_path_. 107 // Leveldb databases are directories inside base_path_.
108 base::FileEnumerator extension_dirs( 108 file_util::FileEnumerator::FindInfo find_info;
109 base_path_, false, base::FileEnumerator::DIRECTORIES); 109 file_util::FileEnumerator extension_dirs(
110 base_path_, false, file_util::FileEnumerator::DIRECTORIES);
110 while (!extension_dirs.Next().empty()) { 111 while (!extension_dirs.Next().empty()) {
111 base::FilePath extension_dir = extension_dirs.GetInfo().GetName(); 112 extension_dirs.GetFindInfo(&find_info);
113 base::FilePath extension_dir(
114 file_util::FileEnumerator::GetFilename(find_info));
112 DCHECK(!extension_dir.IsAbsolute()); 115 DCHECK(!extension_dir.IsAbsolute());
113 // Extension IDs are created as std::strings so they *should* be ASCII. 116 // Extension IDs are created as std::strings so they *should* be ASCII.
114 std::string maybe_as_ascii(extension_dir.MaybeAsASCII()); 117 std::string maybe_as_ascii(extension_dir.MaybeAsASCII());
115 if (!maybe_as_ascii.empty()) { 118 if (!maybe_as_ascii.empty()) {
116 result.insert(maybe_as_ascii); 119 result.insert(maybe_as_ascii);
117 } 120 }
118 } 121 }
119 122
120 return result; 123 return result;
121 } 124 }
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 scoped_ptr<SettingsSyncProcessor> SettingsBackend::CreateSettingsSyncProcessor( 277 scoped_ptr<SettingsSyncProcessor> SettingsBackend::CreateSettingsSyncProcessor(
275 const std::string& extension_id) const { 278 const std::string& extension_id) const {
276 CHECK(sync_processor_.get()); 279 CHECK(sync_processor_.get());
277 return scoped_ptr<SettingsSyncProcessor>( 280 return scoped_ptr<SettingsSyncProcessor>(
278 new SettingsSyncProcessor(extension_id, 281 new SettingsSyncProcessor(extension_id,
279 sync_type_, 282 sync_type_,
280 sync_processor_.get())); 283 sync_processor_.get()));
281 } 284 }
282 285
283 } // namespace extensions 286 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698