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

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

Issue 7661009: base: Add Is* functions to Value class. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: tony review 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
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 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 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 "base/bind.h" 5 #include "base/bind.h"
6 #include "base/values.h" 6 #include "base/values.h"
7 #include "chrome/browser/extensions/extension_service.h" 7 #include "chrome/browser/extensions/extension_service.h"
8 #include "chrome/browser/extensions/extension_settings_api.h" 8 #include "chrome/browser/extensions/extension_settings_api.h"
9 #include "chrome/browser/profiles/profile.h" 9 #include "chrome/browser/profiles/profile.h"
10 10
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 52
53 // Concrete settings functions 53 // Concrete settings functions
54 54
55 bool GetSettingsFunction::RunWithStorageImpl( 55 bool GetSettingsFunction::RunWithStorageImpl(
56 ExtensionSettingsStorage* storage) { 56 ExtensionSettingsStorage* storage) {
57 Value *input; 57 Value *input;
58 EXTENSION_FUNCTION_VALIDATE(args_->Get(0, &input)); 58 EXTENSION_FUNCTION_VALIDATE(args_->Get(0, &input));
59 59
60 std::string as_string; 60 std::string as_string;
61 ListValue* as_list; 61 ListValue* as_list;
62 if (input->IsType(Value::TYPE_NULL)) { 62 if (input->IsNull()) {
63 storage->Get(new StorageResultCallback(this)); 63 storage->Get(new StorageResultCallback(this));
64 } else if (input->GetAsString(&as_string)) { 64 } else if (input->GetAsString(&as_string)) {
65 storage->Get(as_string, new StorageResultCallback(this)); 65 storage->Get(as_string, new StorageResultCallback(this));
66 } else if (input->GetAsList(&as_list)) { 66 } else if (input->GetAsList(&as_list)) {
67 storage->Get(*as_list, new StorageResultCallback(this)); 67 storage->Get(*as_list, new StorageResultCallback(this));
68 } else { 68 } else {
69 error_ = kUnsupportedArgumentType; 69 error_ = kUnsupportedArgumentType;
70 return false; 70 return false;
71 } 71 }
72 72
(...skipping 25 matching lines...) Expand all
98 } 98 }
99 99
100 return true; 100 return true;
101 } 101 }
102 102
103 bool ClearSettingsFunction::RunWithStorageImpl( 103 bool ClearSettingsFunction::RunWithStorageImpl(
104 ExtensionSettingsStorage* storage) { 104 ExtensionSettingsStorage* storage) {
105 storage->Clear(new StorageResultCallback(this)); 105 storage->Clear(new StorageResultCallback(this));
106 return true; 106 return true;
107 } 107 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_service_unittest.cc ('k') | chrome/browser/extensions/extension_tabs_module.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698