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_PROCESS_SINGLETON_MODAL_DIALOG_LOCK_H_ | |
6 #define CHROME_BROWSER_PROCESS_SINGLETON_MODAL_DIALOG_LOCK_H_ | |
7 | |
8 #include "base/basictypes.h" | |
9 #include "base/callback_forward.h" | |
10 #include "chrome/browser/process_singleton.h" | |
11 #include "ui/gfx/native_widget_types.h" | |
12 | |
13 class CommandLine; | |
14 | |
15 namespace base { | |
16 class FilePath; | |
17 } | |
18 | |
19 // Provides a ProcessSingleton::NotificationCallback that prevents | |
20 // command-line handling when a modal dialog is active. | |
21 // | |
22 // While a dialog is active, the ProcessSingleton notification | |
gab
2013/03/28 13:45:53
Explain what "a dialog is active" means as far as
erikwright (departed)
2013/04/04 01:39:51
I've added "during startup". I think that the defi
gab
2013/04/04 02:31:45
Well that's better, but what I mean is that this c
erikwright (departed)
2013/04/07 02:27:29
OK, now your concern is clear to me. I added some
| |
23 // callback will handle but ignore notifications (i.e., neither this process | |
gab
2013/03/28 13:45:53
will handle notifications by bringing the dialog t
erikwright (departed)
2013/04/04 01:39:51
Reformatted.
| |
24 // nor the invoking process will handle the command line) and the dialog is | |
25 // brought to the foreground. | |
26 // | |
27 // Otherwise, the notification is forwarded to a wrapped NotificationCallback. | |
28 class ProcessSingletonModalDialogLock { | |
29 public: | |
30 typedef base::Callback<void(gfx::NativeWindow)> SetForegroundWindowHandler; | |
31 explicit ProcessSingletonModalDialogLock( | |
32 const ProcessSingleton::NotificationCallback& original_callback); | |
33 | |
34 ProcessSingletonModalDialogLock( | |
35 const ProcessSingleton::NotificationCallback& original_callback, | |
36 const SetForegroundWindowHandler& set_foreground_window_handler); | |
37 | |
38 ~ProcessSingletonModalDialogLock(); | |
39 | |
40 // Receives a handle to the active modal dialog, or NULL if the active dialog | |
41 // is dismissed. | |
42 void SetActiveModalDialog(gfx::NativeWindow active_dialog); | |
43 | |
44 // Returns the callback that should be supplied to ProcessSingleton. | |
45 // The callback is only valid during the lifetime of the | |
46 // ProcessSingletonModalDialogLock instance. | |
gab
2013/03/28 13:45:53
Same comments on the comment here (ref. identical
erikwright (departed)
2013/04/04 01:39:51
See my response there.
| |
47 ProcessSingleton::NotificationCallback AsNotificationCallback(); | |
48 | |
49 private: | |
50 bool NotificationCallbackImpl(const CommandLine& command_line, | |
51 const base::FilePath& current_directory); | |
52 | |
53 gfx::NativeWindow active_dialog_; | |
54 ProcessSingleton::NotificationCallback original_callback_; | |
55 SetForegroundWindowHandler set_foreground_window_handler_; | |
56 | |
57 DISALLOW_COPY_AND_ASSIGN(ProcessSingletonModalDialogLock); | |
58 }; | |
59 | |
60 #endif // CHROME_BROWSER_PROCESS_SINGLETON_MODAL_DIALOG_LOCK_H_ | |
OLD | NEW |