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

Unified Diff: mojo/shell/switches.cc

Issue 731923002: Emit error if unknown switch is passed to mojo_shell (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Remove extra import Created 6 years, 1 month 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
« mojo/shell/desktop/mojo_main.cc ('K') | « mojo/shell/switches.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/shell/switches.cc
diff --git a/mojo/shell/switches.cc b/mojo/shell/switches.cc
index bb159b5b8bd306b212d4e9edf2f3335318dfaef7..9b377e3d64c960ff5fb48a4953b410aa9e8dd976 100644
--- a/mojo/shell/switches.cc
+++ b/mojo/shell/switches.cc
@@ -4,6 +4,8 @@
#include "mojo/shell/switches.h"
+#include "base/basictypes.h"
+
namespace switches {
// Specify configuration arguments for a Mojo application URL. For example:
@@ -49,4 +51,27 @@ const char kSpy[] = "spy";
// first maps 'a' to 'b' and the second 'c' to 'd'.
const char kURLMappings[] = "url-mappings";
+const char* switch_array[] = {
+ kArgsFor,
Aaron Boodman 2014/11/17 15:46:06 This duplicates information. People are going to u
DaveMoore 2014/11/17 16:36:47 Name changed. I didn't think you used kFoo for arr
Aaron Boodman 2014/11/17 16:44:45 Sorry, I disagree. I think it is likely that peopl
+ kChildProcessType,
+ kDisableCache,
+ kEnableExternalApplications,
+ kEnableMultiprocess,
+ kHelp,
+ kOrigin,
+ kSpy,
+ kURLMappings
+};
+
+const std::set<std::string>& GetAllSwitches() {
+ static std::set<std::string> switch_set;
hansmuller 2014/11/17 15:33:19 The switch_array and the cached set values aren't
Aaron Boodman 2014/11/17 15:46:07 It's against Chromium style to have static non-POD
DaveMoore 2014/11/17 16:36:47 I see now that you're right that even function sta
+ static bool initialized = false;
+ if (!initialized) {
+ for (size_t i = 0; i < arraysize(switch_array); ++i)
+ switch_set.insert(switch_array[i]);
+ initialized = true;
+ }
+ return switch_set;
+}
+
} // namespace switches
« mojo/shell/desktop/mojo_main.cc ('K') | « mojo/shell/switches.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698