blob: 7bbc521d93e8ec1d09628819c002c78591344e3f [file] [log] [blame]
[email protected]9a47c432013-04-19 20:33:551// 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/process_singleton_modal_dialog_lock.h"
6
Greg Thompsoneafda51e2017-09-05 23:09:457#include <utility>
[email protected]9a47c432013-04-19 20:33:558
9#include "base/bind.h"
[email protected]9a47c432013-04-19 20:33:5510
11ProcessSingletonModalDialogLock::ProcessSingletonModalDialogLock(
12 const ProcessSingleton::NotificationCallback& original_callback)
Greg Thompsoneafda51e2017-09-05 23:09:4513 : original_callback_(original_callback) {}
[email protected]9a47c432013-04-19 20:33:5514
15ProcessSingletonModalDialogLock::~ProcessSingletonModalDialogLock() {}
16
Greg Thompsoneafda51e2017-09-05 23:09:4517void ProcessSingletonModalDialogLock::SetModalDialogNotificationHandler(
18 base::Closure notification_handler) {
19 notification_handler_ = std::move(notification_handler);
[email protected]9a47c432013-04-19 20:33:5520}
21
22ProcessSingleton::NotificationCallback
23ProcessSingletonModalDialogLock::AsNotificationCallback() {
24 return base::Bind(&ProcessSingletonModalDialogLock::NotificationCallbackImpl,
25 base::Unretained(this));
26}
27
28bool ProcessSingletonModalDialogLock::NotificationCallbackImpl(
avi556c05022014-12-22 23:31:4329 const base::CommandLine& command_line,
30 const base::FilePath& current_directory) {
Greg Thompsoneafda51e2017-09-05 23:09:4531 if (notification_handler_)
32 notification_handler_.Run();
33
34 return original_callback_.Run(command_line, current_directory);
[email protected]9a47c432013-04-19 20:33:5535}