Chromium Code Reviews| Index: chrome/browser/modal_dialog_lock.h |
| diff --git a/chrome/browser/modal_dialog_lock.h b/chrome/browser/modal_dialog_lock.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..f04756ff1f71fa6b22f73f7a9b7657c044f3b674 |
| --- /dev/null |
| +++ b/chrome/browser/modal_dialog_lock.h |
| @@ -0,0 +1,52 @@ |
| +// Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CHROME_BROWSER_MODAL_DIALOG_LOCK_H_ |
| +#define CHROME_BROWSER_MODAL_DIALOG_LOCK_H_ |
| + |
| +#include "base/basictypes.h" |
| +#include "chrome/browser/process_singleton.h" |
| +#include "ui/gfx/native_widget_types.h" |
| + |
| +class CommandLine; |
| + |
| +namespace base { |
| +class FilePath; |
| +} |
| + |
| +// Implements a ProcessSingleton::NotificationCallback that prevents |
|
gab
2013/03/27 18:03:26
I don't like the use of "Implements" here since it
erikwright (departed)
2013/03/28 03:16:34
Changed to Provides.
|
| +// command-line handling when a modal dialog is active. |
| +// |
| +// While a dialog is active, the ProcessSingleton notification |
| +// callback will handle but ignore notifications (i.e., neither this process |
| +// nor the invoking process will handle the command line) and the dialog is |
| +// brought to the foreground. |
| +// |
| +// Otherwise, the notification is forwarded to a wrapped NotificationCallback. |
| +class ModalDialogLock { |
|
robertshield
2013/03/27 14:51:38
Minor nit, but would prefer naming this with "Proc
erikwright (departed)
2013/03/28 03:16:34
Done.
|
| + public: |
| + explicit ModalDialogLock( |
| + const ProcessSingleton::NotificationCallback& original_callback); |
| + ~ModalDialogLock(); |
| + |
| + // Receives a handle to the active modal dialog, or NULL if the active dialog |
| + // is dismissed. |
| + void SetActiveModalDialog(gfx::NativeWindow active_dialog); |
| + |
| + // Returns the callback that should be supplied to ProcessSingleton. |
| + // The callback is only valid during the lifetime of the ModalDialogLock |
| + // instance. |
| + ProcessSingleton::NotificationCallback AsNotificationCallback(); |
| + |
| + private: |
| + bool NotificationCallbackImpl(const CommandLine& command_line, |
| + const base::FilePath& current_directory); |
| + |
| + gfx::NativeWindow active_dialog_; |
| + ProcessSingleton::NotificationCallback original_callback_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(ModalDialogLock); |
| +}; |
| + |
| +#endif // CHROME_BROWSER_MODAL_DIALOG_LOCK_H_ |