1 // Copyright (c) 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.
5 #include "chrome/browser/browser_process_platform_part_mac.h"
7 #include "chrome/browser/chrome_browser_application_mac.h"
8 #include "chrome/browser/ui/app_list/app_list_service.h"
10 BrowserProcessPlatformPart::BrowserProcessPlatformPart() {
13 BrowserProcessPlatformPart::~BrowserProcessPlatformPart() {
16 void BrowserProcessPlatformPart::StartTearDown() {
17 app_shim_host_manager_ = NULL;
20 void BrowserProcessPlatformPart::AttemptExit() {
21 // On the Mac, the application continues to run once all windows are closed.
22 // Terminate will result in a CloseAllBrowsers() call, and once (and if)
23 // that is done, will cause the application to exit cleanly.
24 chrome_browser_application_mac::Terminate();
27 void BrowserProcessPlatformPart::PreMainMessageLoopRun() {
28 // AppShimHostManager can not simply be reset, otherwise destroying the old
29 // domain socket will cause the just-created socket to be unlinked.
30 DCHECK(!app_shim_host_manager_);
31 app_shim_host_manager_ = new AppShimHostManager;
32 // Init needs to be called after assigning to a scoped_refptr (i.e. after
33 // incrementing the refcount).
34 app_shim_host_manager_->Init();
35 AppListService::InitAll(NULL);
38 AppShimHostManager* BrowserProcessPlatformPart::app_shim_host_manager() {
39 return app_shim_host_manager_.get();