OLD | NEW |
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 Loading... |
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 Loading... |
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 } |
OLD | NEW |