OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "extensions/browser/state_store.h" | 5 #include "extensions/browser/state_store.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "chrome/browser/chrome_notification_types.h" | 9 #include "chrome/browser/chrome_notification_types.h" |
10 #include "content/public/browser/browser_context.h" | 10 #include "content/public/browser/browser_context.h" |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 content::BrowserContext* browser_context, | 152 content::BrowserContext* browser_context, |
153 const Extension* extension, | 153 const Extension* extension, |
154 bool is_update, | 154 bool is_update, |
155 bool from_ephemeral, | 155 bool from_ephemeral, |
156 const std::string& old_name) { | 156 const std::string& old_name) { |
157 RemoveKeysForExtension(extension->id()); | 157 RemoveKeysForExtension(extension->id()); |
158 } | 158 } |
159 | 159 |
160 void StateStore::OnExtensionUninstalled( | 160 void StateStore::OnExtensionUninstalled( |
161 content::BrowserContext* browser_context, | 161 content::BrowserContext* browser_context, |
162 const Extension* extension) { | 162 const Extension* extension, |
| 163 extensions::UninstallReason reason) { |
163 RemoveKeysForExtension(extension->id()); | 164 RemoveKeysForExtension(extension->id()); |
164 } | 165 } |
165 | 166 |
166 void StateStore::Init() { | 167 void StateStore::Init() { |
167 if (!db_path_.empty()) | 168 if (!db_path_.empty()) |
168 store_.Init(db_path_); | 169 store_.Init(db_path_); |
169 task_queue_->SetReady(); | 170 task_queue_->SetReady(); |
170 } | 171 } |
171 | 172 |
172 void StateStore::RemoveKeysForExtension(const std::string& extension_id) { | 173 void StateStore::RemoveKeysForExtension(const std::string& extension_id) { |
173 for (std::set<std::string>::iterator key = registered_keys_.begin(); | 174 for (std::set<std::string>::iterator key = registered_keys_.begin(); |
174 key != registered_keys_.end(); | 175 key != registered_keys_.end(); |
175 ++key) { | 176 ++key) { |
176 task_queue_->InvokeWhenReady(base::Bind(&ValueStoreFrontend::Remove, | 177 task_queue_->InvokeWhenReady(base::Bind(&ValueStoreFrontend::Remove, |
177 base::Unretained(&store_), | 178 base::Unretained(&store_), |
178 GetFullKey(extension_id, *key))); | 179 GetFullKey(extension_id, *key))); |
179 } | 180 } |
180 } | 181 } |
181 | 182 |
182 } // namespace extensions | 183 } // namespace extensions |
OLD | NEW |