| OLD | NEW |
| 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/extension_info_map.h" | 5 #include "chrome/browser/extensions/extension_info_map.h" |
| 6 | 6 |
| 7 #include "chrome/common/extensions/extension.h" | 7 #include "chrome/common/extensions/extension.h" |
| 8 #include "chrome/common/extensions/extension_set.h" | 8 #include "chrome/common/extensions/extension_set.h" |
| 9 #include "chrome/common/url_constants.h" | 9 #include "chrome/common/url_constants.h" |
| 10 #include "content/public/browser/browser_thread.h" | 10 #include "content/public/browser/browser_thread.h" |
| 11 | 11 |
| 12 using content::BrowserThread; | 12 using content::BrowserThread; |
| 13 | 13 |
| 14 namespace { | 14 namespace { |
| 15 | 15 |
| 16 void CheckOnValidThread() { | 16 void CheckOnValidThread() { |
| 17 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 17 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 18 } | 18 } |
| 19 | 19 |
| 20 } // namespace | 20 } // namespace |
| 21 | 21 |
| 22 | |
| 23 struct ExtensionInfoMap::ExtraData { | 22 struct ExtensionInfoMap::ExtraData { |
| 24 // When the extension was installed. | 23 // When the extension was installed. |
| 25 base::Time install_time; | 24 base::Time install_time; |
| 26 | 25 |
| 27 // True if the user has allowed this extension to run in incognito mode. | 26 // True if the user has allowed this extension to run in incognito mode. |
| 28 bool incognito_enabled; | 27 bool incognito_enabled; |
| 29 | 28 |
| 30 ExtraData(); | 29 ExtraData(); |
| 31 ~ExtraData(); | 30 ~ExtraData(); |
| 32 }; | 31 }; |
| 33 | 32 |
| 34 ExtensionInfoMap::ExtraData::ExtraData() : incognito_enabled(false) { | 33 ExtensionInfoMap::ExtraData::ExtraData() : incognito_enabled(false) {} |
| 35 } | |
| 36 | 34 |
| 37 ExtensionInfoMap::ExtraData::~ExtraData() { | 35 ExtensionInfoMap::ExtraData::~ExtraData() {} |
| 38 } | |
| 39 | 36 |
| 40 | 37 ExtensionInfoMap::ExtensionInfoMap() {} |
| 41 ExtensionInfoMap::ExtensionInfoMap() { | |
| 42 } | |
| 43 | |
| 44 ExtensionInfoMap::~ExtensionInfoMap() { | |
| 45 if (quota_service_.get()) { | |
| 46 BrowserThread::DeleteSoon(BrowserThread::IO, FROM_HERE, | |
| 47 quota_service_.release()); | |
| 48 } | |
| 49 } | |
| 50 | 38 |
| 51 const extensions::ProcessMap& ExtensionInfoMap::process_map() const { | 39 const extensions::ProcessMap& ExtensionInfoMap::process_map() const { |
| 52 return process_map_; | 40 return process_map_; |
| 53 } | 41 } |
| 54 | 42 |
| 55 void ExtensionInfoMap::AddExtension(const Extension* extension, | 43 void ExtensionInfoMap::AddExtension(const Extension* extension, |
| 56 base::Time install_time, | 44 base::Time install_time, |
| 57 bool incognito_enabled) { | 45 bool incognito_enabled) { |
| 58 CheckOnValidThread(); | 46 CheckOnValidThread(); |
| 59 extensions_.Insert(extension); | 47 extensions_.Insert(extension); |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 } | 140 } |
| 153 return false; | 141 return false; |
| 154 } | 142 } |
| 155 | 143 |
| 156 ExtensionsQuotaService* ExtensionInfoMap::GetQuotaService() { | 144 ExtensionsQuotaService* ExtensionInfoMap::GetQuotaService() { |
| 157 CheckOnValidThread(); | 145 CheckOnValidThread(); |
| 158 if (!quota_service_.get()) | 146 if (!quota_service_.get()) |
| 159 quota_service_.reset(new ExtensionsQuotaService()); | 147 quota_service_.reset(new ExtensionsQuotaService()); |
| 160 return quota_service_.get(); | 148 return quota_service_.get(); |
| 161 } | 149 } |
| 150 |
| 151 ExtensionInfoMap::~ExtensionInfoMap() { |
| 152 if (quota_service_.get()) { |
| 153 BrowserThread::DeleteSoon(BrowserThread::IO, FROM_HERE, |
| 154 quota_service_.release()); |
| 155 } |
| 156 } |
| OLD | NEW |