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. 4 5 #include "chrome/browser/chrome_process_singleton.h" 6 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()) { 14 } 15 16 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()) { 27 } 28 29 ChromeProcessSingleton::~ChromeProcessSingleton() { 30 } 31 32 ProcessSingleton::NotifyResult 33 ChromeProcessSingleton::NotifyOtherProcessOrCreate() { 34 return process_singleton_.NotifyOtherProcessOrCreate(); 35 } 36 37 void ChromeProcessSingleton::Cleanup() { 38 process_singleton_.Cleanup(); 39 } 40 41 void ChromeProcessSingleton::SetActiveModalDialog( 42 gfx::NativeWindow active_dialog) { 43 modal_dialog_lock_.SetActiveModalDialog(active_dialog); 44 } 45 46 void ChromeProcessSingleton::Unlock() { 47 startup_lock_.Unlock(); 48 } 49