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

Unified Diff: chrome/browser/extensions/extension_function_util.cc

Issue 10175008: Improving the process model extension API (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressing feedback by Matt. Created 8 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/extension_function_util.cc
diff --git a/chrome/browser/extensions/extension_function_util.cc b/chrome/browser/extensions/extension_function_util.cc
new file mode 100644
index 0000000000000000000000000000000000000000..02739f25316a4bdb366f4494b48a59024a796f6f
--- /dev/null
+++ b/chrome/browser/extensions/extension_function_util.cc
@@ -0,0 +1,27 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/extensions/extension_function_util.h"
+
+bool ExtensionFuncUtil::ReadOneOrMoreIntegers(base::Value* value,
Matt Perry 2012/05/08 01:00:34 nit: just make the function global. classes of sta
nasko 2012/05/08 16:39:50 Done.
+ std::vector<int>* result) {
+ if (value->IsType(Value::TYPE_INTEGER)) {
+ int v = -1;
+ if (!value->GetAsInteger(&v))
+ return false;
+ result->push_back(v);
+ return true;
+
+ } else if (value->IsType(Value::TYPE_LIST)) {
+ base::ListValue* values = static_cast<base::ListValue*>(value);
+ for (size_t i = 0; i < values->GetSize(); ++i) {
+ int v = -1;
+ if (!values->GetInteger(i, &v))
+ return false;
+ result->push_back(v);
+ }
+ return true;
+ }
+ return false;
+}
« no previous file with comments | « chrome/browser/extensions/extension_function_util.h ('k') | chrome/browser/extensions/extension_processes_api.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698