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
3 // found in the LICENSE file.
5 #include "chrome/installer/gcapi_mac/gcapi.h"
7 #import <Foundation/Foundation.h>
14 "usage: gcapi_example [options]\n"
17 " --criteria-check exit after criteria check\n"
18 " --force-reinstall delete Google Chrome from Applications first\n"
19 " --install <path> copy <path> to /Applications/Google Chrome.app, set up\n"
20 " --brand <CODE> set brandcode to <CODE> during installation\n"
21 " --launch launch Google Chrome when all is done\n"
22 " --help print this message\n"
26 int main(int argc, char* argv[]) {
27 const option kLongOptions[] = {
28 { "criteria-check", no_argument, NULL, 'c' },
29 { "force-reinstall", no_argument, NULL, 'r' },
30 { "install", required_argument, NULL, 'i' },
31 { "brand", required_argument, NULL, 'b' },
32 { "launch", no_argument, NULL, 'l' },
33 { "help", no_argument, NULL, 'h' },
37 std::string source_path;
38 std::string brand_code;
39 bool check_only = false;
40 bool reinstall = false;
43 while ((opt = getopt_long(argc, argv, "cri:b:lh", kLongOptions, NULL))
69 [[NSFileManager defaultManager]
70 removeItemAtPath:@"/Applications/Google Chrome.app" error:nil];
74 int can_install = GoogleChromeCompatibilityCheck(&reasons);
75 NSLog(@"can_install: %d, reasons %x", can_install, reasons);
79 if (can_install && !source_path.empty()) {
80 int install_result = InstallGoogleChrome(
82 brand_code.empty() ? NULL : brand_code.c_str(),
84 NSLog(@"install result: %d", install_result);