| 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/settings/settings_frontend.h" | 5 #include "chrome/browser/extensions/settings/settings_frontend.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
| 9 #include "base/string_number_conversions.h" | 9 #include "base/string_number_conversions.h" |
| 10 #include "chrome/browser/extensions/extension_event_names.h" | 10 #include "chrome/browser/extensions/extension_event_names.h" |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 CHECK(base::StringToSizeT(as_string, &as_integer)); | 99 CHECK(base::StringToSizeT(as_string, &as_integer)); |
| 100 return as_integer; | 100 return as_integer; |
| 101 } | 101 } |
| 102 | 102 |
| 103 // Constructs a |Limits| configuration by looking up the QUOTA_BYTES, | 103 // Constructs a |Limits| configuration by looking up the QUOTA_BYTES, |
| 104 // QUOTA_BYTES_PER_ITEM, and MAX_ITEMS properties of a storage area defined | 104 // QUOTA_BYTES_PER_ITEM, and MAX_ITEMS properties of a storage area defined |
| 105 // in chrome/common/extensions/api/storage.json (via ExtensionAPI). | 105 // in chrome/common/extensions/api/storage.json (via ExtensionAPI). |
| 106 SettingsStorageQuotaEnforcer::Limits GetLimitsFromExtensionAPI( | 106 SettingsStorageQuotaEnforcer::Limits GetLimitsFromExtensionAPI( |
| 107 const std::string& storage_area_id) { | 107 const std::string& storage_area_id) { |
| 108 const DictionaryValue* storage_schema = | 108 const DictionaryValue* storage_schema = |
| 109 ExtensionAPI::GetSharedInstance()->GetSchema("storage"); | 109 ExtensionAPI::GetInstance()->GetSchema("storage"); |
| 110 CHECK(storage_schema); | 110 CHECK(storage_schema); |
| 111 | 111 |
| 112 DictionaryValue* properties = NULL; | 112 DictionaryValue* properties = NULL; |
| 113 storage_schema->GetDictionary( | 113 storage_schema->GetDictionary( |
| 114 "properties." + storage_area_id + ".properties", &properties); | 114 "properties." + storage_area_id + ".properties", &properties); |
| 115 CHECK(properties); | 115 CHECK(properties); |
| 116 | 116 |
| 117 SettingsStorageQuotaEnforcer::Limits limits = { | 117 SettingsStorageQuotaEnforcer::Limits limits = { |
| 118 GetStringAsInteger(*properties, "QUOTA_BYTES.value", UINT_MAX), | 118 GetStringAsInteger(*properties, "QUOTA_BYTES.value", UINT_MAX), |
| 119 GetStringAsInteger(*properties, "QUOTA_BYTES_PER_ITEM.value", UINT_MAX), | 119 GetStringAsInteger(*properties, "QUOTA_BYTES_PER_ITEM.value", UINT_MAX), |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 351 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 351 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 352 return observers_; | 352 return observers_; |
| 353 } | 353 } |
| 354 | 354 |
| 355 // BackendWrappers | 355 // BackendWrappers |
| 356 | 356 |
| 357 SettingsFrontend::BackendWrappers::BackendWrappers() {} | 357 SettingsFrontend::BackendWrappers::BackendWrappers() {} |
| 358 SettingsFrontend::BackendWrappers::~BackendWrappers() {} | 358 SettingsFrontend::BackendWrappers::~BackendWrappers() {} |
| 359 | 359 |
| 360 } // namespace extensions | 360 } // namespace extensions |
| OLD | NEW |