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

Side by Side 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 unified diff | Download patch
« mojo/shell/desktop/mojo_main.cc ('K') | « mojo/shell/switches.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "mojo/shell/switches.h" 5 #include "mojo/shell/switches.h"
6 6
7 #include "base/basictypes.h"
8
7 namespace switches { 9 namespace switches {
8 10
9 // Specify configuration arguments for a Mojo application URL. For example: 11 // Specify configuration arguments for a Mojo application URL. For example:
10 // --args-for='mojo:wget http://www.google.com' 12 // --args-for='mojo:wget http://www.google.com'
11 const char kArgsFor[] = "args-for"; 13 const char kArgsFor[] = "args-for";
12 14
13 // Used to specify the type of child process (switch values from 15 // Used to specify the type of child process (switch values from
14 // |ChildProcess::Type|). 16 // |ChildProcess::Type|).
15 const char kChildProcessType[] = "child-process-type"; 17 const char kChildProcessType[] = "child-process-type";
16 18
(...skipping 25 matching lines...) Expand all
42 // Enables the mojo spy, which acts as a man-in-the-middle inspector for 44 // Enables the mojo spy, which acts as a man-in-the-middle inspector for
43 // message pipes and other activities. This is work in progress. 45 // message pipes and other activities. This is work in progress.
44 const char kSpy[] = "spy"; 46 const char kSpy[] = "spy";
45 47
46 // Specifies a set of mappings to apply when resolving urls. The value is set of 48 // Specifies a set of mappings to apply when resolving urls. The value is set of
47 // ',' separated mappings, where each mapping consists of a pair of urls giving 49 // ',' separated mappings, where each mapping consists of a pair of urls giving
48 // the to/from url to map. For example, 'a=b,c=d' contains two mappings, the 50 // the to/from url to map. For example, 'a=b,c=d' contains two mappings, the
49 // first maps 'a' to 'b' and the second 'c' to 'd'. 51 // first maps 'a' to 'b' and the second 'c' to 'd'.
50 const char kURLMappings[] = "url-mappings"; 52 const char kURLMappings[] = "url-mappings";
51 53
54 const char* switch_array[] = {
55 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
56 kChildProcessType,
57 kDisableCache,
58 kEnableExternalApplications,
59 kEnableMultiprocess,
60 kHelp,
61 kOrigin,
62 kSpy,
63 kURLMappings
64 };
65
66 const std::set<std::string>& GetAllSwitches() {
67 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
68 static bool initialized = false;
69 if (!initialized) {
70 for (size_t i = 0; i < arraysize(switch_array); ++i)
71 switch_set.insert(switch_array[i]);
72 initialized = true;
73 }
74 return switch_set;
75 }
76
52 } // namespace switches 77 } // namespace switches
OLDNEW
« 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