Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | |
|
Lei Zhang
2014/01/31 05:02:15
nit: it's 2014.
| |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "chrome/browser/autofill/validation_rules_storage_factory.h" | |
| 6 | |
| 7 #include "base/files/file_path.h" | |
| 8 #include "base/path_service.h" | |
| 9 #include "base/prefs/json_pref_store.h" | |
| 10 #include "base/prefs/pref_filter.h" | |
| 11 #include "base/threading/sequenced_worker_pool.h" | |
| 12 #include "chrome/common/chrome_paths.h" | |
| 13 #include "content/public/browser/browser_thread.h" | |
| 14 #include "third_party/libaddressinput/chromium/chrome_storage_impl.h" | |
| 15 | |
| 16 namespace autofill { | |
| 17 | |
| 18 using ::i18n::addressinput::Storage; | |
| 19 | |
| 20 // static | |
| 21 scoped_ptr<Storage> ValidationRulesStorageFactory::CreateStorage() { | |
| 22 static base::LazyInstance<ValidationRulesStorageFactory> instance = | |
| 23 LAZY_INSTANCE_INITIALIZER; | |
| 24 return scoped_ptr<Storage>( | |
| 25 new ChromeStorageImpl(instance.Get().json_pref_store_.get())); | |
| 26 } | |
| 27 | |
| 28 ValidationRulesStorageFactory::ValidationRulesStorageFactory() { | |
| 29 base::FilePath user_data_dir; | |
| 30 bool success = PathService::Get(chrome::DIR_USER_DATA, &user_data_dir); | |
| 31 DCHECK(success); | |
| 32 | |
| 33 base::FilePath cache = | |
| 34 user_data_dir.Append(FILE_PATH_LITERAL("libaddressinput")); | |
|
Lei Zhang
2014/01/31 02:07:11
Do you want to give it a more descriptive name? Yo
Evan Stade
2014/01/31 04:09:52
do you have a suggestion for the name? It holds "a
Lei Zhang
2014/01/31 05:02:15
"Libaddress Cache" ?
Dan Beam
2014/01/31 19:24:55
there is no libaddress.
if you want to change it,
Dan Beam
2014/02/01 00:43:21
changed to "Address Validation Rules"
| |
| 35 | |
| 36 scoped_refptr<base::SequencedTaskRunner> task_runner = | |
| 37 JsonPrefStore::GetTaskRunnerForFile( | |
| 38 cache, content::BrowserThread::GetBlockingPool()); | |
| 39 | |
| 40 json_pref_store_ = | |
| 41 new JsonPrefStore(cache, task_runner.get(), scoped_ptr<PrefFilter>()); | |
| 42 json_pref_store_->ReadPrefsAsync(NULL); | |
| 43 } | |
| 44 | |
| 45 ValidationRulesStorageFactory::~ValidationRulesStorageFactory() {} | |
| 46 | |
| 47 } // namespace autofill | |
| OLD | NEW |