Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(242)

Side by Side Diff: chrome/browser/extensions/settings/testing_settings_storage.cc

Issue 9284013: Extension Storage API: expose storage quota information to extensions, via: (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: with use-after-free fixed Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 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/testing_settings_storage.h" 5 #include "chrome/browser/extensions/settings/testing_settings_storage.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 8
9 namespace extensions { 9 namespace extensions {
10 10
11 namespace { 11 namespace {
(...skipping 18 matching lines...) Expand all
30 30
31 TestingSettingsStorage::TestingSettingsStorage() 31 TestingSettingsStorage::TestingSettingsStorage()
32 : fail_all_requests_(false) {} 32 : fail_all_requests_(false) {}
33 33
34 TestingSettingsStorage::~TestingSettingsStorage() {} 34 TestingSettingsStorage::~TestingSettingsStorage() {}
35 35
36 void TestingSettingsStorage::SetFailAllRequests(bool fail_all_requests) { 36 void TestingSettingsStorage::SetFailAllRequests(bool fail_all_requests) {
37 fail_all_requests_ = fail_all_requests; 37 fail_all_requests_ = fail_all_requests;
38 } 38 }
39 39
40 size_t TestingSettingsStorage::GetBytesInUse(const std::string& key) {
41 // Let SettingsStorageQuotaEnforcer implement this.
42 NOTREACHED() << "Not implemented";
43 return 0;
44 }
45
46 size_t TestingSettingsStorage::GetBytesInUse(
47 const std::vector<std::string>& keys) {
48 // Let SettingsStorageQuotaEnforcer implement this.
49 NOTREACHED() << "Not implemented";
50 return 0;
51 }
52
53 size_t TestingSettingsStorage::GetBytesInUse() {
54 // Let SettingsStorageQuotaEnforcer implement this.
55 NOTREACHED() << "Not implemented";
56 return 0;
57 }
58
40 SettingsStorage::ReadResult TestingSettingsStorage::Get( 59 SettingsStorage::ReadResult TestingSettingsStorage::Get(
41 const std::string& key) { 60 const std::string& key) {
42 return Get(CreateVector(key)); 61 return Get(CreateVector(key));
43 } 62 }
44 63
45 SettingsStorage::ReadResult TestingSettingsStorage::Get( 64 SettingsStorage::ReadResult TestingSettingsStorage::Get(
46 const std::vector<std::string>& keys) { 65 const std::vector<std::string>& keys) {
47 if (fail_all_requests_) { 66 if (fail_all_requests_) {
48 return ReadResultError(); 67 return ReadResultError();
49 } 68 }
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 } 143 }
125 144
126 std::vector<std::string> keys; 145 std::vector<std::string> keys;
127 for (DictionaryValue::Iterator it(storage_); it.HasNext(); it.Advance()) { 146 for (DictionaryValue::Iterator it(storage_); it.HasNext(); it.Advance()) {
128 keys.push_back(it.key()); 147 keys.push_back(it.key());
129 } 148 }
130 return Remove(keys); 149 return Remove(keys);
131 } 150 }
132 151
133 } // namespace extensions 152 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698