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_CHROME_PROCESS_SINGLETON_H_ | 5 #ifndef CHROME_BROWSER_CHROME_PROCESS_SINGLETON_H_ |
6 #define CHROME_BROWSER_CHROME_PROCESS_SINGLETON_H_ | 6 #define CHROME_BROWSER_CHROME_PROCESS_SINGLETON_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "chrome/browser/process_singleton.h" | 10 #include "chrome/browser/process_singleton.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 // NotificationCallback. | 21 // NotificationCallback. |
22 // | 22 // |
23 // The client must ensure that SetActiveModalDialog is called appropriately when | 23 // The client must ensure that SetActiveModalDialog is called appropriately when |
24 // dialogs are displayed or dismissed during startup. While a dialog is active: | 24 // dialogs are displayed or dismissed during startup. While a dialog is active: |
25 // 1. Neither this process nor the invoking process will handle the command | 25 // 1. Neither this process nor the invoking process will handle the command |
26 // line. | 26 // line. |
27 // 2. The active dialog is brought to the foreground and/or the taskbar icon | 27 // 2. The active dialog is brought to the foreground and/or the taskbar icon |
28 // flashed (using ::SetForegroundWindow on Windows). | 28 // flashed (using ::SetForegroundWindow on Windows). |
29 class ChromeProcessSingleton { | 29 class ChromeProcessSingleton { |
30 public: | 30 public: |
31 ChromeProcessSingleton( | 31 typedef base::Callback<bool(const CommandLine& command_line, |
32 const base::FilePath& user_data_dir, | 32 const base::FilePath& current_directory, |
33 const ProcessSingleton::NotificationCallback& notification_callback); | 33 scoped_ptr<OperationOutput> operation_output)> |
| 34 NotificationCallback; |
34 | 35 |
35 ChromeProcessSingleton( | 36 ChromeProcessSingleton( |
36 const base::FilePath& user_data_dir, | 37 const base::FilePath& user_data_dir, |
37 const ProcessSingleton::NotificationCallback& notification_callback, | 38 const NotificationCallback& notification_callback); |
| 39 |
| 40 ChromeProcessSingleton( |
| 41 const base::FilePath& user_data_dir, |
| 42 const NotificationCallback& notification_callback, |
38 const ProcessSingletonModalDialogLock::SetForegroundWindowHandler& | 43 const ProcessSingletonModalDialogLock::SetForegroundWindowHandler& |
39 set_foreground_window_handler); | 44 set_foreground_window_handler); |
40 | 45 |
41 ~ChromeProcessSingleton(); | 46 ~ChromeProcessSingleton(); |
42 | 47 |
43 // Notify another process, if available. Otherwise sets ourselves as the | 48 // Notify another process, if available. Otherwise sets ourselves as the |
44 // singleton instance. Returns PROCESS_NONE if we became the singleton | 49 // singleton instance. Returns PROCESS_NONE if we became the singleton |
45 // instance. Callers are guaranteed to either have notified an existing | 50 // instance. Callers are guaranteed to either have notified an existing |
46 // process or have grabbed the singleton (unless the profile is locked by an | 51 // process or have grabbed the singleton (unless the profile is locked by an |
47 // unreachable process). | 52 // unreachable process). |
(...skipping 20 matching lines...) Expand all Loading... |
68 ProcessSingletonStartupLock startup_lock_; | 73 ProcessSingletonStartupLock startup_lock_; |
69 ProcessSingletonModalDialogLock modal_dialog_lock_; | 74 ProcessSingletonModalDialogLock modal_dialog_lock_; |
70 | 75 |
71 // The basic ProcessSingleton | 76 // The basic ProcessSingleton |
72 ProcessSingleton process_singleton_; | 77 ProcessSingleton process_singleton_; |
73 | 78 |
74 DISALLOW_COPY_AND_ASSIGN(ChromeProcessSingleton); | 79 DISALLOW_COPY_AND_ASSIGN(ChromeProcessSingleton); |
75 }; | 80 }; |
76 | 81 |
77 #endif // CHROME_BROWSER_CHROME_PROCESS_SINGLETON_H_ | 82 #endif // CHROME_BROWSER_CHROME_PROCESS_SINGLETON_H_ |
OLD | NEW |