Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 BASE_CLIPBOARD_H_ | 5 #ifndef BASE_CLIPBOARD_H_ |
| 6 #define BASE_CLIPBOARD_H_ | 6 #define BASE_CLIPBOARD_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 168 // Safely write to system clipboard. Free |handle| on failure. | 168 // Safely write to system clipboard. Free |handle| on failure. |
| 169 void WriteToClipboard(FormatType format, HANDLE handle); | 169 void WriteToClipboard(FormatType format, HANDLE handle); |
| 170 | 170 |
| 171 static void ParseBookmarkClipboardFormat(const std::wstring& bookmark, | 171 static void ParseBookmarkClipboardFormat(const std::wstring& bookmark, |
| 172 std::wstring* title, | 172 std::wstring* title, |
| 173 std::string* url); | 173 std::string* url); |
| 174 | 174 |
| 175 // Free a handle depending on its type (as intuited from format) | 175 // Free a handle depending on its type (as intuited from format) |
| 176 static void FreeData(FormatType format, HANDLE data); | 176 static void FreeData(FormatType format, HANDLE data); |
| 177 | 177 |
| 178 HWND clipboard_owner_; | 178 // Return the window that should be the clipboard owner, creating it |
| 179 // if neccessary. Marked const for lazily initialization by const methods. | |
| 180 HWND GetClipboardWindow() const; | |
| 181 | |
| 182 // Mark this as mutable so const methods can still do lazy initialization. | |
|
Peter Kasting
2008/11/25 06:46:13
Nit: Should probably comment that no one should ac
| |
| 183 mutable HWND clipboard_owner_; | |
| 179 #elif defined(OS_LINUX) | 184 #elif defined(OS_LINUX) |
| 180 // Data is stored in the |clipboard_data_| map until it is saved to the system | 185 // Data is stored in the |clipboard_data_| map until it is saved to the system |
| 181 // clipboard. The Store* functions save data to the |clipboard_data_| map. The | 186 // clipboard. The Store* functions save data to the |clipboard_data_| map. The |
| 182 // SetGtkClipboard function replaces whatever is on the system clipboard with | 187 // SetGtkClipboard function replaces whatever is on the system clipboard with |
| 183 // the contents of |clipboard_data_|. | 188 // the contents of |clipboard_data_|. |
| 184 // The Write* functions make a deep copy of the data passed to them an store | 189 // The Write* functions make a deep copy of the data passed to them an store |
| 185 // it in |clipboard_data_|. | 190 // it in |clipboard_data_|. |
| 186 | 191 |
| 187 // Write changes to gtk clipboard. | 192 // Write changes to gtk clipboard. |
| 188 void SetGtkClipboard(); | 193 void SetGtkClipboard(); |
| 189 // Free pointers in clipboard_data_ and clear() the map. | 194 // Free pointers in clipboard_data_ and clear() the map. |
| 190 void FreeTargetMap(); | 195 void FreeTargetMap(); |
| 191 // Insert a mapping into clipboard_data_. | 196 // Insert a mapping into clipboard_data_. |
| 192 void InsertMapping(const char* key, char* data, size_t data_len); | 197 void InsertMapping(const char* key, char* data, size_t data_len); |
| 193 | 198 |
| 194 TargetMap* clipboard_data_; | 199 TargetMap* clipboard_data_; |
| 195 GtkClipboard* clipboard_; | 200 GtkClipboard* clipboard_; |
| 196 #endif | 201 #endif |
| 197 | 202 |
| 198 DISALLOW_EVIL_CONSTRUCTORS(Clipboard); | 203 DISALLOW_EVIL_CONSTRUCTORS(Clipboard); |
| 199 }; | 204 }; |
| 200 | 205 |
| 201 #endif // BASE_CLIPBOARD_H_ | 206 #endif // BASE_CLIPBOARD_H_ |
| 202 | 207 |
| OLD | NEW |