| 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
| 10 | 10 |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 | 102 |
| 103 #if defined(OS_WIN) && !defined(USE_AURA) | 103 #if defined(OS_WIN) && !defined(USE_AURA) |
| 104 // Used in specific cases to let us know that there is an existing instance | 104 // Used in specific cases to let us know that there is an existing instance |
| 105 // of Chrome running with this profile. In general, you should not use this | 105 // of Chrome running with this profile. In general, you should not use this |
| 106 // function. Instead consider using NotifyOtherProcessOrCreate(). | 106 // function. Instead consider using NotifyOtherProcessOrCreate(). |
| 107 // For non profile-specific method, use | 107 // For non profile-specific method, use |
| 108 // browser_util::IsBrowserAlreadyRunning(). | 108 // browser_util::IsBrowserAlreadyRunning(). |
| 109 bool FoundOtherProcessWindow() const { | 109 bool FoundOtherProcessWindow() const { |
| 110 return (NULL != remote_window_); | 110 return (NULL != remote_window_); |
| 111 } | 111 } |
| 112 #endif // defined(OS_WIN) | 112 #endif // defined(OS_WIN) && !defined(USE_AURA) |
| 113 | 113 |
| 114 // Sets ourself up as the singleton instance. Returns true on success. If | 114 // Sets ourself up as the singleton instance. Returns true on success. If |
| 115 // false is returned, we are not the singleton instance and the caller must | 115 // false is returned, we are not the singleton instance and the caller must |
| 116 // exit. Otherwise, stores the provided callback for notification from | 116 // exit. Otherwise, stores the provided callback for notification from |
| 117 // future processes. | 117 // future processes. |
| 118 bool Create( | 118 bool Create( |
| 119 const NotificationCallback& notification_callback); | 119 const NotificationCallback& notification_callback); |
| 120 | 120 |
| 121 // Clear any lock state during shutdown. | 121 // Clear any lock state during shutdown. |
| 122 void Cleanup(); | 122 void Cleanup(); |
| 123 | 123 |
| 124 #if defined(OS_WIN) |
| 125 // We need to unregister the window as late as possible so that we can detect |
| 126 // another instance of chrome running. Otherwise we may end up writing out |
| 127 // data while a new chrome is starting up. |
| 128 void UnregisterWindowClass(); |
| 129 #endif // defined(OS_WIN) |
| 130 |
| 124 // Blocks the dispatch of CopyData messages. foreground_window refers | 131 // Blocks the dispatch of CopyData messages. foreground_window refers |
| 125 // to the window that should be set to the foreground if a CopyData message | 132 // to the window that should be set to the foreground if a CopyData message |
| 126 // is received while the ProcessSingleton is locked. | 133 // is received while the ProcessSingleton is locked. |
| 127 void Lock(gfx::NativeWindow foreground_window) { | 134 void Lock(gfx::NativeWindow foreground_window) { |
| 128 DCHECK(CalledOnValidThread()); | 135 DCHECK(CalledOnValidThread()); |
| 129 locked_ = true; | 136 locked_ = true; |
| 130 foreground_window_ = foreground_window; | 137 foreground_window_ = foreground_window; |
| 131 } | 138 } |
| 132 | 139 |
| 133 // Changes the foreground window without changing the locked state. | 140 // Changes the foreground window without changing the locked state. |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 #endif | 228 #endif |
| 222 | 229 |
| 223 // If messages are received in the locked state, the corresponding command | 230 // If messages are received in the locked state, the corresponding command |
| 224 // lines are saved here to be replayed later. | 231 // lines are saved here to be replayed later. |
| 225 std::vector<DelayedStartupMessage> saved_startup_messages_; | 232 std::vector<DelayedStartupMessage> saved_startup_messages_; |
| 226 | 233 |
| 227 DISALLOW_COPY_AND_ASSIGN(ProcessSingleton); | 234 DISALLOW_COPY_AND_ASSIGN(ProcessSingleton); |
| 228 }; | 235 }; |
| 229 | 236 |
| 230 #endif // CHROME_BROWSER_PROCESS_SINGLETON_H_ | 237 #endif // CHROME_BROWSER_PROCESS_SINGLETON_H_ |
| OLD | NEW |