OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_PROCESS_SINGLETON_MODAL_DIALOG_LOCK_H_ | 5 #ifndef CHROME_BROWSER_PROCESS_SINGLETON_MODAL_DIALOG_LOCK_H_ |
6 #define CHROME_BROWSER_PROCESS_SINGLETON_MODAL_DIALOG_LOCK_H_ | 6 #define CHROME_BROWSER_PROCESS_SINGLETON_MODAL_DIALOG_LOCK_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/callback_forward.h" | 9 #include "base/callback_forward.h" |
10 #include "chrome/browser/process_singleton.h" | 10 #include "chrome/browser/process_singleton.h" |
11 #include "ui/gfx/native_widget_types.h" | 11 #include "ui/gfx/native_widget_types.h" |
12 | 12 |
| 13 namespace base { |
13 class CommandLine; | 14 class CommandLine; |
14 | |
15 namespace base { | |
16 class FilePath; | 15 class FilePath; |
17 } | 16 } |
18 | 17 |
19 // Provides a ProcessSingleton::NotificationCallback that prevents | 18 // Provides a ProcessSingleton::NotificationCallback that prevents |
20 // command-line handling when a modal dialog is active during startup. The | 19 // command-line handling when a modal dialog is active during startup. The |
21 // client must ensure that SetActiveModalDialog is called appropriately when | 20 // client must ensure that SetActiveModalDialog is called appropriately when |
22 // such dialogs are displayed or dismissed. | 21 // such dialogs are displayed or dismissed. |
23 // | 22 // |
24 // While a dialog is active, the ProcessSingleton notification | 23 // While a dialog is active, the ProcessSingleton notification |
25 // callback will handle but ignore notifications: | 24 // callback will handle but ignore notifications: |
(...skipping 18 matching lines...) Expand all Loading... |
44 // Receives a handle to the active modal dialog, or NULL if the active dialog | 43 // Receives a handle to the active modal dialog, or NULL if the active dialog |
45 // is dismissed. | 44 // is dismissed. |
46 void SetActiveModalDialog(gfx::NativeWindow active_dialog); | 45 void SetActiveModalDialog(gfx::NativeWindow active_dialog); |
47 | 46 |
48 // Returns the ProcessSingleton::NotificationCallback. | 47 // Returns the ProcessSingleton::NotificationCallback. |
49 // The callback is only valid during the lifetime of the | 48 // The callback is only valid during the lifetime of the |
50 // ProcessSingletonModalDialogLock instance. | 49 // ProcessSingletonModalDialogLock instance. |
51 ProcessSingleton::NotificationCallback AsNotificationCallback(); | 50 ProcessSingleton::NotificationCallback AsNotificationCallback(); |
52 | 51 |
53 private: | 52 private: |
54 bool NotificationCallbackImpl(const CommandLine& command_line, | 53 bool NotificationCallbackImpl(const base::CommandLine& command_line, |
55 const base::FilePath& current_directory); | 54 const base::FilePath& current_directory); |
56 | 55 |
57 gfx::NativeWindow active_dialog_; | 56 gfx::NativeWindow active_dialog_; |
58 ProcessSingleton::NotificationCallback original_callback_; | 57 ProcessSingleton::NotificationCallback original_callback_; |
59 SetForegroundWindowHandler set_foreground_window_handler_; | 58 SetForegroundWindowHandler set_foreground_window_handler_; |
60 | 59 |
61 DISALLOW_COPY_AND_ASSIGN(ProcessSingletonModalDialogLock); | 60 DISALLOW_COPY_AND_ASSIGN(ProcessSingletonModalDialogLock); |
62 }; | 61 }; |
63 | 62 |
64 #endif // CHROME_BROWSER_PROCESS_SINGLETON_MODAL_DIALOG_LOCK_H_ | 63 #endif // CHROME_BROWSER_PROCESS_SINGLETON_MODAL_DIALOG_LOCK_H_ |
OLD | NEW |