|
OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #include "chrome/browser/extensions/api/command_line_private/command_line_privat e_api.h" | |
6 | |
7 #include <string> | |
8 | |
9 #include "base/command_line.h" | |
10 #include "base/memory/scoped_ptr.h" | |
11 #include "base/values.h" | |
12 #include "chrome/common/extensions/api/command_line_private.h" | |
13 | |
14 namespace command_line_private = extensions::api::command_line_private; | |
not at google - send to devlin
2013/04/15 06:08:45
can go inside the extensions { namespace below
方觉(Fang Jue)
2013/04/15 06:25:03
Done.
| |
15 | |
16 namespace extensions { | |
17 | |
18 bool CommandLinePrivateHasSwitchFunction::RunImpl() { | |
19 scoped_ptr<command_line_private::HasSwitch::Params> params( | |
20 command_line_private::HasSwitch::Params::Create(*args_)); | |
21 EXTENSION_FUNCTION_VALIDATE(params.get()); | |
not at google - send to devlin
2013/04/15 06:08:45
don't need .get()
方觉(Fang Jue)
2013/04/15 06:25:03
I looked at other API implementations (such as ala
not at google - send to devlin
2013/04/15 06:26:52
Nevertheless, you don't need .get().
| |
22 | |
23 if (params->name.empty()) | |
24 return false; | |
not at google - send to devlin
2013/04/15 06:08:45
should also set error_ here
方觉(Fang Jue)
2013/04/15 06:25:03
Done.
| |
25 | |
26 const CommandLine* command_line = CommandLine::ForCurrentProcess(); | |
27 bool result = command_line->HasSwitch(params->name); | |
28 SetResult(base::Value::CreateBooleanValue(result)); | |
not at google - send to devlin
2013/04/15 06:08:45
typically I'd (a) inline most of this and (b) use
方觉(Fang Jue)
2013/04/15 06:25:03
Done.
| |
29 return true; | |
30 } | |
31 | |
32 } // namespace extensions | |
OLD | NEW |