| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 locked_ = false; | 70 locked_ = false; |
| 71 foreground_window_ = NULL; | 71 foreground_window_ = NULL; |
| 72 } | 72 } |
| 73 | 73 |
| 74 bool locked() { | 74 bool locked() { |
| 75 DCHECK(CalledOnValidThread()); | 75 DCHECK(CalledOnValidThread()); |
| 76 return locked_; | 76 return locked_; |
| 77 } | 77 } |
| 78 | 78 |
| 79 private: | 79 private: |
| 80 #if defined(OS_WIN) || defined(OS_LINUX) | 80 #if defined(OS_WIN) || defined(OS_LINUX) || defined(OS_FREEBSD) |
| 81 // Timeout for the current browser process to respond. 20 seconds should be | 81 // Timeout for the current browser process to respond. 20 seconds should be |
| 82 // enough. It's only used in Windows and Linux implementations. | 82 // enough. It's only used in Windows and Linux implementations. |
| 83 static const int kTimeoutInSeconds = 20; | 83 static const int kTimeoutInSeconds = 20; |
| 84 #endif | 84 #endif |
| 85 | 85 |
| 86 bool locked_; | 86 bool locked_; |
| 87 gfx::NativeWindow foreground_window_; | 87 gfx::NativeWindow foreground_window_; |
| 88 | 88 |
| 89 #if defined(OS_WIN) | 89 #if defined(OS_WIN) |
| 90 // This ugly behemoth handles startup commands sent from another process. | 90 // This ugly behemoth handles startup commands sent from another process. |
| 91 LRESULT OnCopyData(HWND hwnd, const COPYDATASTRUCT* cds); | 91 LRESULT OnCopyData(HWND hwnd, const COPYDATASTRUCT* cds); |
| 92 | 92 |
| 93 LRESULT CALLBACK WndProc(HWND hwnd, | 93 LRESULT CALLBACK WndProc(HWND hwnd, |
| 94 UINT message, | 94 UINT message, |
| 95 WPARAM wparam, | 95 WPARAM wparam, |
| 96 LPARAM lparam); | 96 LPARAM lparam); |
| 97 | 97 |
| 98 static LRESULT CALLBACK WndProcStatic(HWND hwnd, | 98 static LRESULT CALLBACK WndProcStatic(HWND hwnd, |
| 99 UINT message, | 99 UINT message, |
| 100 WPARAM wparam, | 100 WPARAM wparam, |
| 101 LPARAM lparam) { | 101 LPARAM lparam) { |
| 102 ProcessSingleton* msg_wnd = reinterpret_cast<ProcessSingleton*>( | 102 ProcessSingleton* msg_wnd = reinterpret_cast<ProcessSingleton*>( |
| 103 GetWindowLongPtr(hwnd, GWLP_USERDATA)); | 103 GetWindowLongPtr(hwnd, GWLP_USERDATA)); |
| 104 return msg_wnd->WndProc(hwnd, message, wparam, lparam); | 104 return msg_wnd->WndProc(hwnd, message, wparam, lparam); |
| 105 } | 105 } |
| 106 | 106 |
| 107 HWND remote_window_; // The HWND_MESSAGE of another browser. | 107 HWND remote_window_; // The HWND_MESSAGE of another browser. |
| 108 HWND window_; // The HWND_MESSAGE window. | 108 HWND window_; // The HWND_MESSAGE window. |
| 109 #elif defined(OS_LINUX) | 109 #elif defined(OS_LINUX) || defined(OS_FREEBSD) |
| 110 // Path in file system to the socket. | 110 // Path in file system to the socket. |
| 111 FilePath socket_path_; | 111 FilePath socket_path_; |
| 112 | 112 |
| 113 // Path in file system to the lock. | 113 // Path in file system to the lock. |
| 114 FilePath lock_path_; | 114 FilePath lock_path_; |
| 115 | 115 |
| 116 // Helper class for linux specific messages. LinuxWatcher is ref counted | 116 // Helper class for linux specific messages. LinuxWatcher is ref counted |
| 117 // because it posts messages between threads. | 117 // because it posts messages between threads. |
| 118 class LinuxWatcher; | 118 class LinuxWatcher; |
| 119 scoped_refptr<LinuxWatcher> watcher_; | 119 scoped_refptr<LinuxWatcher> watcher_; |
| 120 #endif | 120 #endif |
| 121 | 121 |
| 122 DISALLOW_COPY_AND_ASSIGN(ProcessSingleton); | 122 DISALLOW_COPY_AND_ASSIGN(ProcessSingleton); |
| 123 }; | 123 }; |
| 124 | 124 |
| 125 #endif // CHROME_BROWSER_PROCESS_SINGLETON_H_ | 125 #endif // CHROME_BROWSER_PROCESS_SINGLETON_H_ |
| OLD | NEW |