| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/settings/settings_backend.h" | 5 #include "chrome/browser/extensions/settings/settings_backend.h" |
| 6 | 6 |
| 7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/json/json_reader.h" | 9 #include "base/json/json_reader.h" |
| 10 #include "base/json/json_writer.h" | 10 #include "base/json/json_writer.h" |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 void SettingsBackend::DeleteStorage(const std::string& extension_id) { | 103 void SettingsBackend::DeleteStorage(const std::string& extension_id) { |
| 104 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 104 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
| 105 StorageObjMap::iterator maybe_storage = storage_objs_.find(extension_id); | 105 StorageObjMap::iterator maybe_storage = storage_objs_.find(extension_id); |
| 106 if (maybe_storage == storage_objs_.end()) { | 106 if (maybe_storage == storage_objs_.end()) { |
| 107 return; | 107 return; |
| 108 } | 108 } |
| 109 | 109 |
| 110 // Clear settings when the extension is uninstalled. Leveldb implementations | 110 // Clear settings when the extension is uninstalled. Leveldb implementations |
| 111 // will also delete the database from disk when the object is destroyed as | 111 // will also delete the database from disk when the object is destroyed as |
| 112 // a result of being removed from |storage_objs_|. | 112 // a result of being removed from |storage_objs_|. |
| 113 maybe_storage->second->Clear(); | 113 maybe_storage->second->Clear(SettingsStorage::FORCE); |
| 114 storage_objs_.erase(maybe_storage); | 114 storage_objs_.erase(maybe_storage); |
| 115 } | 115 } |
| 116 | 116 |
| 117 std::set<std::string> SettingsBackend::GetKnownExtensionIDs() const { | 117 std::set<std::string> SettingsBackend::GetKnownExtensionIDs() const { |
| 118 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 118 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
| 119 std::set<std::string> result; | 119 std::set<std::string> result; |
| 120 | 120 |
| 121 // Extension IDs live in-memory and/or on disk. The cache will contain all | 121 // Extension IDs live in-memory and/or on disk. The cache will contain all |
| 122 // that are in-memory. | 122 // that are in-memory. |
| 123 for (StorageObjMap::iterator it = storage_objs_.begin(); | 123 for (StorageObjMap::iterator it = storage_objs_.begin(); |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 | 288 |
| 289 for (StorageObjMap::iterator it = storage_objs_.begin(); | 289 for (StorageObjMap::iterator it = storage_objs_.begin(); |
| 290 it != storage_objs_.end(); ++it) { | 290 it != storage_objs_.end(); ++it) { |
| 291 // Some storage areas may have already stopped syncing if they had areas | 291 // Some storage areas may have already stopped syncing if they had areas |
| 292 // and syncing was disabled, but StopSyncing is safe to call multiple times. | 292 // and syncing was disabled, but StopSyncing is safe to call multiple times. |
| 293 it->second->StopSyncing(); | 293 it->second->StopSyncing(); |
| 294 } | 294 } |
| 295 } | 295 } |
| 296 | 296 |
| 297 } // namespace extensions | 297 } // namespace extensions |
| OLD | NEW |