OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_H_ | 5 #ifndef CHROME_BROWSER_PROCESS_SINGLETON_H_ |
6 #define CHROME_BROWSER_PROCESS_SINGLETON_H_ | 6 #define CHROME_BROWSER_PROCESS_SINGLETON_H_ |
7 | 7 |
8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
9 | 9 |
10 #if defined(OS_WIN) | 10 #if defined(OS_WIN) |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 | 76 |
77 // Sets ourself up as the singleton instance. Returns true on success. If | 77 // Sets ourself up as the singleton instance. Returns true on success. If |
78 // false is returned, we are not the singleton instance and the caller must | 78 // false is returned, we are not the singleton instance and the caller must |
79 // exit. Otherwise, stores the provided callback for notification from | 79 // exit. Otherwise, stores the provided callback for notification from |
80 // future processes. | 80 // future processes. |
81 // NOTE: Most callers should generally prefer NotifyOtherProcessOrCreate() to | 81 // NOTE: Most callers should generally prefer NotifyOtherProcessOrCreate() to |
82 // this method, only callers for whom failure is prefered to notifying another | 82 // this method, only callers for whom failure is prefered to notifying another |
83 // process should call this directly. | 83 // process should call this directly. |
84 bool Create(const NotificationCallback& notification_callback); | 84 bool Create(const NotificationCallback& notification_callback); |
85 | 85 |
86 #if defined(OS_WIN) | |
87 // Used in specific cases to let us know that there is an existing instance | |
88 // of Chrome running with this profile. In general, you should not use this | |
89 // function. Instead consider using NotifyOtherProcessOrCreate(). | |
90 // For non profile-specific method, use | |
91 // browser_util::IsBrowserAlreadyRunning(). | |
92 bool FoundOtherProcessWindow() const { | |
93 return (NULL != remote_window_); | |
94 } | |
95 #endif // defined(OS_WIN) | |
96 | |
97 // Clear any lock state during shutdown. | 86 // Clear any lock state during shutdown. |
98 void Cleanup(); | 87 void Cleanup(); |
99 | 88 |
100 // Blocks the dispatch of CopyData messages. foreground_window refers | 89 // Blocks the dispatch of CopyData messages. foreground_window refers |
101 // to the window that should be set to the foreground if a CopyData message | 90 // to the window that should be set to the foreground if a CopyData message |
102 // is received while the ProcessSingleton is locked. | 91 // is received while the ProcessSingleton is locked. |
103 void Lock(gfx::NativeWindow foreground_window) { | 92 void Lock(gfx::NativeWindow foreground_window) { |
104 DCHECK(CalledOnValidThread()); | 93 DCHECK(CalledOnValidThread()); |
105 locked_ = true; | 94 locked_ = true; |
106 foreground_window_ = foreground_window; | 95 foreground_window_ = foreground_window; |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 #endif | 217 #endif |
229 | 218 |
230 // If messages are received in the locked state, the corresponding command | 219 // If messages are received in the locked state, the corresponding command |
231 // lines are saved here to be replayed later. | 220 // lines are saved here to be replayed later. |
232 std::vector<DelayedStartupMessage> saved_startup_messages_; | 221 std::vector<DelayedStartupMessage> saved_startup_messages_; |
233 | 222 |
234 DISALLOW_COPY_AND_ASSIGN(ProcessSingleton); | 223 DISALLOW_COPY_AND_ASSIGN(ProcessSingleton); |
235 }; | 224 }; |
236 | 225 |
237 #endif // CHROME_BROWSER_PROCESS_SINGLETON_H_ | 226 #endif // CHROME_BROWSER_PROCESS_SINGLETON_H_ |
OLD | NEW |