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

Unified Diff: chromeos/dbus/dbus_command_line_helper.h

Issue 181413006: Replace misc. network stub flags with more flexible ones (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address feedback Created 6 years, 10 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: chromeos/dbus/dbus_command_line_helper.h
diff --git a/chromeos/dbus/dbus_command_line_helper.h b/chromeos/dbus/dbus_command_line_helper.h
new file mode 100644
index 0000000000000000000000000000000000000000..d0f96b392a162f65eedc363ac74e4115c8261dfc
--- /dev/null
+++ b/chromeos/dbus/dbus_command_line_helper.h
@@ -0,0 +1,33 @@
+// Copyright (c) 2014 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.
+
+#ifndef CHROMEOS_DBUS_DBUS_COMMAND_LINE_HELPER_H_
+#define CHROMEOS_DBUS_DBUS_COMMAND_LINE_HELPER_H_
+
+#include <string>
+
+#include "base/callback.h"
+#include "chromeos/chromeos_export.h"
+
+namespace dbus_command_line_helper {
+
+// Parses a single name,value pair. Returns 'true' if parsed successfully.
+typedef base::Callback<
+ bool(const std::string& arg0, const std::string& arg1)> ParseOptionCallback;
+
+// Parses a command line switch containing comma-separated name-value pairs.
+// Invokes |callback| for each name-value pair. Returns false only if the
+// option is not set in the command line.
+// Examples:
+// Invokes |callback| once with ("foo", ""):
+// --option=foo
+// Invokes |callback| three times with ("foo", ""), ("bar", "1"), ("a", "b")
+// --option=foo,bar=1,a=b
+CHROMEOS_EXPORT bool ParseOptions(const std::string& switch_name,
+ const ParseOptionCallback& callback);
+
+} // namespace dbus_command_line_helper
+
+
+#endif // CHROMEOS_DBUS_DBUS_COMMAND_LINE_HELPER_H_

Powered by Google App Engine
This is Rietveld 408576698