| 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/api/declarative_content/content_action.h" | 5 #include "chrome/browser/extensions/api/declarative_content/content_action.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 | 8 |
| 9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 DISALLOW_COPY_AND_ASSIGN(SetIcon); | 163 DISALLOW_COPY_AND_ASSIGN(SetIcon); |
| 164 }; | 164 }; |
| 165 | 165 |
| 166 // Helper for getting JS collections into C++. | 166 // Helper for getting JS collections into C++. |
| 167 static bool AppendJSStringsToCPPStrings(const base::ListValue& append_strings, | 167 static bool AppendJSStringsToCPPStrings(const base::ListValue& append_strings, |
| 168 std::vector<std::string>* append_to) { | 168 std::vector<std::string>* append_to) { |
| 169 for (base::ListValue::const_iterator it = append_strings.begin(); | 169 for (base::ListValue::const_iterator it = append_strings.begin(); |
| 170 it != append_strings.end(); | 170 it != append_strings.end(); |
| 171 ++it) { | 171 ++it) { |
| 172 std::string value; | 172 std::string value; |
| 173 if (it->GetAsString(&value)) { | 173 if ((*it)->GetAsString(&value)) { |
| 174 append_to->push_back(value); | 174 append_to->push_back(value); |
| 175 } else { | 175 } else { |
| 176 return false; | 176 return false; |
| 177 } | 177 } |
| 178 } | 178 } |
| 179 | 179 |
| 180 return true; | 180 return true; |
| 181 } | 181 } |
| 182 | 182 |
| 183 struct ContentActionFactory { | 183 struct ContentActionFactory { |
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 442 return (*factory_method_iter->second)( | 442 return (*factory_method_iter->second)( |
| 443 browser_context, extension, action_dict, error); | 443 browser_context, extension, action_dict, error); |
| 444 | 444 |
| 445 *error = base::StringPrintf(kInvalidInstanceTypeError, instance_type.c_str()); | 445 *error = base::StringPrintf(kInvalidInstanceTypeError, instance_type.c_str()); |
| 446 return std::unique_ptr<ContentAction>(); | 446 return std::unique_ptr<ContentAction>(); |
| 447 } | 447 } |
| 448 | 448 |
| 449 ContentAction::ContentAction() {} | 449 ContentAction::ContentAction() {} |
| 450 | 450 |
| 451 } // namespace extensions | 451 } // namespace extensions |
| OLD | NEW |