Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / chrome / browser / service_process / service_process_control_mac.mm
blob0e26eb291a8f8666e479c9e99e661cdb98e6a4b7
1 // Copyright (c) 2011 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/browser/service_process/service_process_control.h"
7 #include "base/bind.h"
8 #include "base/command_line.h"
9 #include "base/mac/foundation_util.h"
10 #include "base/mac/scoped_cftyperef.h"
11 #include "chrome/common/service_process_util_posix.h"
12 #include "content/public/browser/browser_thread.h"
13 #include "third_party/google_toolbox_for_mac/src/Foundation/GTMServiceManagement.h"
15 using content::BrowserThread;
17 void ServiceProcessControl::Launcher::DoRun() {
18   base::ScopedCFTypeRef<CFDictionaryRef> launchd_plist(
19       CreateServiceProcessLaunchdPlist(cmd_line_.get(), false));
20   CFErrorRef error = NULL;
21   if (!GTMSMJobSubmit(launchd_plist, &error)) {
22     LOG(ERROR) << error;
23     CFRelease(error);
24   } else {
25     launched_ = true;
26   }
27   BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
28                           base::Bind(&Launcher::Notify, this));