OLD | NEW |
---|---|
(Empty) | |
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 #ifndef CHROME_BROWSER_MODAL_DIALOG_LOCK_H_ | |
6 #define CHROME_BROWSER_MODAL_DIALOG_LOCK_H_ | |
7 | |
8 #include "base/basictypes.h" | |
9 #include "chrome/browser/process_singleton.h" | |
10 #include "ui/gfx/native_widget_types.h" | |
11 | |
12 class CommandLine; | |
13 | |
14 namespace base { | |
15 class FilePath; | |
16 } | |
17 | |
18 // 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.
| |
19 // command-line handling when a modal dialog is active. | |
20 // | |
21 // While a dialog is active, the ProcessSingleton notification | |
22 // callback will handle but ignore notifications (i.e., neither this process | |
23 // nor the invoking process will handle the command line) and the dialog is | |
24 // brought to the foreground. | |
25 // | |
26 // Otherwise, the notification is forwarded to a wrapped NotificationCallback. | |
27 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.
| |
28 public: | |
29 explicit ModalDialogLock( | |
30 const ProcessSingleton::NotificationCallback& original_callback); | |
31 ~ModalDialogLock(); | |
32 | |
33 // Receives a handle to the active modal dialog, or NULL if the active dialog | |
34 // is dismissed. | |
35 void SetActiveModalDialog(gfx::NativeWindow active_dialog); | |
36 | |
37 // Returns the callback that should be supplied to ProcessSingleton. | |
38 // The callback is only valid during the lifetime of the ModalDialogLock | |
39 // instance. | |
40 ProcessSingleton::NotificationCallback AsNotificationCallback(); | |
41 | |
42 private: | |
43 bool NotificationCallbackImpl(const CommandLine& command_line, | |
44 const base::FilePath& current_directory); | |
45 | |
46 gfx::NativeWindow active_dialog_; | |
47 ProcessSingleton::NotificationCallback original_callback_; | |
48 | |
49 DISALLOW_COPY_AND_ASSIGN(ModalDialogLock); | |
50 }; | |
51 | |
52 #endif // CHROME_BROWSER_MODAL_DIALOG_LOCK_H_ | |
OLD | NEW |