Upstream oodles of Chrome for Android code into Chromium.
[chromium-blink-merge.git] / chrome / browser / chrome_process_singleton.cc
bloba6824578df89f69f56a14a980c0d41746717f6af
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/chrome_process_singleton.h"
7 ChromeProcessSingleton::ChromeProcessSingleton(
8 const base::FilePath& user_data_dir,
9 const ProcessSingleton::NotificationCallback& notification_callback)
10 : startup_lock_(notification_callback),
11 modal_dialog_lock_(startup_lock_.AsNotificationCallback()),
12 process_singleton_(user_data_dir,
13 modal_dialog_lock_.AsNotificationCallback()) {
17 ChromeProcessSingleton::ChromeProcessSingleton(
18 const base::FilePath& user_data_dir,
19 const ProcessSingleton::NotificationCallback& notification_callback,
20 const ProcessSingletonModalDialogLock::SetForegroundWindowHandler&
21 set_foreground_window_handler)
22 : startup_lock_(notification_callback),
23 modal_dialog_lock_(startup_lock_.AsNotificationCallback(),
24 set_foreground_window_handler),
25 process_singleton_(user_data_dir,
26 modal_dialog_lock_.AsNotificationCallback()) {
29 ChromeProcessSingleton::~ChromeProcessSingleton() {
32 ProcessSingleton::NotifyResult
33 ChromeProcessSingleton::NotifyOtherProcessOrCreate() {
34 return process_singleton_.NotifyOtherProcessOrCreate();
37 void ChromeProcessSingleton::Cleanup() {
38 process_singleton_.Cleanup();
41 void ChromeProcessSingleton::SetActiveModalDialog(
42 gfx::NativeWindow active_dialog) {
43 modal_dialog_lock_.SetActiveModalDialog(active_dialog);
46 void ChromeProcessSingleton::Unlock() {
47 startup_lock_.Unlock();