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

Side by Side Diff: chrome/browser/extensions/extension_settings_noop_storage.cc

Issue 7189029: Implement an initial extension settings API. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Make clang happy Created 9 years, 4 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
(Empty)
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/extensions/extension_settings_noop_storage.h"
6
7 #include "base/bind.h"
8 #include "base/memory/scoped_ptr.h"
9 #include "base/message_loop.h"
10 #include "base/task.h"
11
12 static void CallOnSuccess(
13 ExtensionSettingsStorage::Callback* callback, DictionaryValue* settings) {
14 callback->OnSuccess(settings);
15 delete callback;
16 }
17
18 static void Succeed(
19 ExtensionSettingsStorage::Callback* callback, DictionaryValue* settings) {
20 MessageLoop::current()->PostTask(
21 FROM_HERE,
22 base::Bind(&CallOnSuccess, callback, settings));
23 }
24
25 void ExtensionSettingsNoopStorage::DeleteSoon() {
26 delete this;
27 }
28
29 void ExtensionSettingsNoopStorage::Get(
30 const std::string& key, ExtensionSettingsStorage::Callback* callback) {
31 Succeed(callback, new DictionaryValue());
32 }
33
34 void ExtensionSettingsNoopStorage::Get(
35 const ListValue& keys, ExtensionSettingsStorage::Callback* callback) {
36 Succeed(callback, new DictionaryValue());
37 }
38
39 void ExtensionSettingsNoopStorage::Get(
40 ExtensionSettingsStorage::Callback* callback) {
41 Succeed(callback, new DictionaryValue());
42 }
43
44 void ExtensionSettingsNoopStorage::Set(
45 const std::string& key,
46 const Value& value,
47 ExtensionSettingsStorage::Callback* callback) {
48 DictionaryValue* settings = new DictionaryValue();
49 settings->Set(key, value.DeepCopy());
50 Succeed(callback, settings);
51 }
52
53 void ExtensionSettingsNoopStorage::Set(
54 const DictionaryValue& values,
55 ExtensionSettingsStorage::Callback* callback) {
56 Succeed(callback, values.DeepCopy());
57 }
58
59 void ExtensionSettingsNoopStorage::Remove(
60 const std::string& key, ExtensionSettingsStorage::Callback *callback) {
61 Succeed(callback, NULL);
62 }
63
64 void ExtensionSettingsNoopStorage::Remove(
65 const ListValue& keys, ExtensionSettingsStorage::Callback *callback) {
66 Succeed(callback, NULL);
67 }
68
69 void ExtensionSettingsNoopStorage::Clear(
70 ExtensionSettingsStorage::Callback* callback) {
71 Succeed(callback, NULL);
72 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_settings_noop_storage.h ('k') | chrome/browser/extensions/extension_settings_storage.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698