OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/installer/gcapi_mac/gcapi.h" | 5 #include "chrome/installer/gcapi_mac/gcapi.h" |
6 | 6 |
7 #import <Foundation/Foundation.h> | 7 #import <Foundation/Foundation.h> |
8 #include <getopt.h> | 8 #include <getopt.h> |
9 | 9 |
10 #include <string> | 10 #include <string> |
11 | 11 |
12 void Usage() { | 12 void Usage() { |
13 fprintf(stderr, | 13 fprintf(stderr, |
14 "usage: gcapi_example [options]\n" | 14 "usage: gcapi_example [options]\n" |
15 "\n" | 15 "\n" |
16 "options:\n" | 16 "options:\n" |
17 " --criteria-check exit after criteria check\n" | 17 " --criteria-check exit after criteria check\n" |
18 " --force-reinstall delete Google Chrome from Applications first\n" | 18 " --force-reinstall delete Google Chrome from Applications first\n" |
19 " --install <path> copy <path> to /Applications/Google Chrome.app, set up\n" | 19 " --install <path> copy <path> to /Applications/Google Chrome.app, set up\n" |
20 " --brand <CODE> set brandcode to <CODE> during installation\n" | 20 " --brand <CODE> set brandcode to <CODE> during installation\n" |
21 " --launch launch Google Chrome when all is done\n" | 21 " --launch launch Google Chrome when all is done\n" |
22 " --help print this message\n" | 22 " --help print this message\n" |
23 ); | 23 ); |
24 } | 24 } |
25 | 25 |
26 int main(int argc, char* argv[]) { | 26 int main(int argc, char* argv[]) { |
27 const option kLongOptions[] = { | 27 const option kLongOptions[] = { |
| 28 { "criteria-check", no_argument, NULL, 'c' }, |
28 { "force-reinstall", no_argument, NULL, 'r' }, | 29 { "force-reinstall", no_argument, NULL, 'r' }, |
29 { "install", required_argument, NULL, 'i' }, | 30 { "install", required_argument, NULL, 'i' }, |
30 { "brand", required_argument, NULL, 'b' }, | 31 { "brand", required_argument, NULL, 'b' }, |
31 { "launch", no_argument, NULL, 'l' }, | 32 { "launch", no_argument, NULL, 'l' }, |
32 { "help", no_argument, NULL, 'h' }, | 33 { "help", no_argument, NULL, 'h' }, |
33 { NULL, 0, NULL, 0 } | 34 { NULL, 0, NULL, 0 } |
34 }; | 35 }; |
35 | 36 |
36 std::string source_path; | 37 std::string source_path; |
37 std::string brand_code; | 38 std::string brand_code; |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 int install_result = InstallGoogleChrome( | 80 int install_result = InstallGoogleChrome( |
80 source_path.c_str(), | 81 source_path.c_str(), |
81 brand_code.empty() ? NULL : brand_code.c_str(), | 82 brand_code.empty() ? NULL : brand_code.c_str(), |
82 NULL, 0); | 83 NULL, 0); |
83 NSLog(@"install result: %d", install_result); | 84 NSLog(@"install result: %d", install_result); |
84 } | 85 } |
85 | 86 |
86 if (launch) | 87 if (launch) |
87 LaunchGoogleChrome(); | 88 LaunchGoogleChrome(); |
88 } | 89 } |
OLD | NEW |