OLD | NEW |
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 "extensions/browser/info_map.h" | 5 #include "extensions/browser/info_map.h" |
6 | 6 |
7 #include "base/strings/string_util.h" | 7 #include "base/strings/string_util.h" |
8 #include "content/public/browser/browser_thread.h" | 8 #include "content/public/browser/browser_thread.h" |
9 #include "extensions/browser/content_verifier.h" | 9 #include "extensions/browser/content_verifier.h" |
10 #include "extensions/common/constants.h" | 10 #include "extensions/common/constants.h" |
(...skipping 28 matching lines...) Expand all Loading... |
39 ExtraData(); | 39 ExtraData(); |
40 ~ExtraData(); | 40 ~ExtraData(); |
41 }; | 41 }; |
42 | 42 |
43 InfoMap::ExtraData::ExtraData() | 43 InfoMap::ExtraData::ExtraData() |
44 : incognito_enabled(false), notifications_disabled(false) { | 44 : incognito_enabled(false), notifications_disabled(false) { |
45 } | 45 } |
46 | 46 |
47 InfoMap::ExtraData::~ExtraData() {} | 47 InfoMap::ExtraData::~ExtraData() {} |
48 | 48 |
49 InfoMap::InfoMap() : signin_process_id_(-1) { | 49 InfoMap::InfoMap() { |
50 } | 50 } |
51 | 51 |
52 void InfoMap::AddExtension(const Extension* extension, | 52 void InfoMap::AddExtension(const Extension* extension, |
53 base::Time install_time, | 53 base::Time install_time, |
54 bool incognito_enabled, | 54 bool incognito_enabled, |
55 bool notifications_disabled) { | 55 bool notifications_disabled) { |
56 CheckOnValidThread(); | 56 CheckOnValidThread(); |
57 extensions_.Insert(extension); | 57 extensions_.Insert(extension); |
58 disabled_extensions_.Remove(extension->id()); | 58 disabled_extensions_.Remove(extension->id()); |
59 | 59 |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 return true; | 225 return true; |
226 } | 226 } |
227 | 227 |
228 QuotaService* InfoMap::GetQuotaService() { | 228 QuotaService* InfoMap::GetQuotaService() { |
229 CheckOnValidThread(); | 229 CheckOnValidThread(); |
230 if (!quota_service_) | 230 if (!quota_service_) |
231 quota_service_.reset(new QuotaService()); | 231 quota_service_.reset(new QuotaService()); |
232 return quota_service_.get(); | 232 return quota_service_.get(); |
233 } | 233 } |
234 | 234 |
235 void InfoMap::SetSigninProcess(int process_id) { | |
236 signin_process_id_ = process_id; | |
237 } | |
238 | |
239 bool InfoMap::IsSigninProcess(int process_id) const { | |
240 return process_id == signin_process_id_; | |
241 } | |
242 | |
243 void InfoMap::SetNotificationsDisabled( | 235 void InfoMap::SetNotificationsDisabled( |
244 const std::string& extension_id, | 236 const std::string& extension_id, |
245 bool notifications_disabled) { | 237 bool notifications_disabled) { |
246 ExtraDataMap::iterator iter = extra_data_.find(extension_id); | 238 ExtraDataMap::iterator iter = extra_data_.find(extension_id); |
247 if (iter != extra_data_.end()) | 239 if (iter != extra_data_.end()) |
248 iter->second.notifications_disabled = notifications_disabled; | 240 iter->second.notifications_disabled = notifications_disabled; |
249 } | 241 } |
250 | 242 |
251 bool InfoMap::AreNotificationsDisabled( | 243 bool InfoMap::AreNotificationsDisabled( |
252 const std::string& extension_id) const { | 244 const std::string& extension_id) const { |
253 ExtraDataMap::const_iterator iter = extra_data_.find(extension_id); | 245 ExtraDataMap::const_iterator iter = extra_data_.find(extension_id); |
254 if (iter != extra_data_.end()) | 246 if (iter != extra_data_.end()) |
255 return iter->second.notifications_disabled; | 247 return iter->second.notifications_disabled; |
256 return false; | 248 return false; |
257 } | 249 } |
258 | 250 |
259 void InfoMap::SetContentVerifier(ContentVerifier* verifier) { | 251 void InfoMap::SetContentVerifier(ContentVerifier* verifier) { |
260 content_verifier_ = verifier; | 252 content_verifier_ = verifier; |
261 } | 253 } |
262 | 254 |
263 InfoMap::~InfoMap() { | 255 InfoMap::~InfoMap() { |
264 if (quota_service_) { | 256 if (quota_service_) { |
265 BrowserThread::DeleteSoon( | 257 BrowserThread::DeleteSoon( |
266 BrowserThread::IO, FROM_HERE, quota_service_.release()); | 258 BrowserThread::IO, FROM_HERE, quota_service_.release()); |
267 } | 259 } |
268 } | 260 } |
269 | 261 |
270 } // namespace extensions | 262 } // namespace extensions |
OLD | NEW |