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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 123 static FormatType GetWebKitSmartPasteFormatType(); | 123 static FormatType GetWebKitSmartPasteFormatType(); |
| 124 // Win: MS HTML Format, Other: Generic HTML format | 124 // Win: MS HTML Format, Other: Generic HTML format |
| 125 static FormatType GetHtmlFormatType(); | 125 static FormatType GetHtmlFormatType(); |
| 126 #if defined(OS_WIN) | 126 #if defined(OS_WIN) |
| 127 static FormatType GetBitmapFormatType(); | 127 static FormatType GetBitmapFormatType(); |
| 128 // Firefox text/html | 128 // Firefox text/html |
| 129 static FormatType GetTextHtmlFormatType(); | 129 static FormatType GetTextHtmlFormatType(); |
| 130 static FormatType GetCFHDropFormatType(); | 130 static FormatType GetCFHDropFormatType(); |
| 131 static FormatType GetFileDescriptorFormatType(); | 131 static FormatType GetFileDescriptorFormatType(); |
| 132 static FormatType GetFileContentFormatZeroType(); | 132 static FormatType GetFileContentFormatZeroType(); |
| 133 | |
| 134 // Duplicates any remote shared memory handle embedded inside |objects| that | |
| 135 // was created by |process| so that it can be used by this process. | |
| 136 static void DuplicateRemoteHandles(base::ProcessHandle process, | |
| 137 ObjectMap* objects); | |
| 133 #endif | 138 #endif |
| 134 | 139 |
| 135 private: | 140 private: |
| 136 void WriteText(const char* text_data, size_t text_len); | 141 void WriteText(const char* text_data, size_t text_len); |
| 137 | 142 |
| 138 void WriteHTML(const char* markup_data, | 143 void WriteHTML(const char* markup_data, |
| 139 size_t markup_len, | 144 size_t markup_len, |
| 140 const char* url_data, | 145 const char* url_data, |
| 141 size_t url_len); | 146 size_t url_len); |
| 142 | 147 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 174 | 179 |
| 175 // Free a handle depending on its type (as intuited from format) | 180 // Free a handle depending on its type (as intuited from format) |
| 176 static void FreeData(FormatType format, HANDLE data); | 181 static void FreeData(FormatType format, HANDLE data); |
| 177 | 182 |
| 178 // Return the window that should be the clipboard owner, creating it | 183 // Return the window that should be the clipboard owner, creating it |
| 179 // if neccessary. Marked const for lazily initialization by const methods. | 184 // if neccessary. Marked const for lazily initialization by const methods. |
| 180 HWND GetClipboardWindow() const; | 185 HWND GetClipboardWindow() const; |
| 181 | 186 |
| 182 // Mark this as mutable so const methods can still do lazy initialization. | 187 // Mark this as mutable so const methods can still do lazy initialization. |
| 183 mutable HWND clipboard_owner_; | 188 mutable HWND clipboard_owner_; |
| 189 | |
| 190 // true if we can create a window. | |
|
jam
2009/01/31 00:24:47
nit: please capitalize True.
| |
| 191 bool create_window_; | |
| 184 #elif defined(OS_LINUX) | 192 #elif defined(OS_LINUX) |
| 185 // Data is stored in the |clipboard_data_| map until it is saved to the system | 193 // Data is stored in the |clipboard_data_| map until it is saved to the system |
| 186 // clipboard. The Store* functions save data to the |clipboard_data_| map. The | 194 // clipboard. The Store* functions save data to the |clipboard_data_| map. The |
| 187 // SetGtkClipboard function replaces whatever is on the system clipboard with | 195 // SetGtkClipboard function replaces whatever is on the system clipboard with |
| 188 // the contents of |clipboard_data_|. | 196 // the contents of |clipboard_data_|. |
| 189 // The Write* functions make a deep copy of the data passed to them an store | 197 // The Write* functions make a deep copy of the data passed to them an store |
| 190 // it in |clipboard_data_|. | 198 // it in |clipboard_data_|. |
| 191 | 199 |
| 192 // Write changes to gtk clipboard. | 200 // Write changes to gtk clipboard. |
| 193 void SetGtkClipboard(); | 201 void SetGtkClipboard(); |
| 194 // Free pointers in clipboard_data_ and clear() the map. | 202 // Free pointers in clipboard_data_ and clear() the map. |
| 195 void FreeTargetMap(); | 203 void FreeTargetMap(); |
| 196 // Insert a mapping into clipboard_data_. | 204 // Insert a mapping into clipboard_data_. |
| 197 void InsertMapping(const char* key, char* data, size_t data_len); | 205 void InsertMapping(const char* key, char* data, size_t data_len); |
| 198 | 206 |
| 199 TargetMap* clipboard_data_; | 207 TargetMap* clipboard_data_; |
| 200 GtkClipboard* clipboard_; | 208 GtkClipboard* clipboard_; |
| 201 #endif | 209 #endif |
| 202 | 210 |
| 203 DISALLOW_EVIL_CONSTRUCTORS(Clipboard); | 211 DISALLOW_EVIL_CONSTRUCTORS(Clipboard); |
| 204 }; | 212 }; |
| 205 | 213 |
| 206 #endif // BASE_CLIPBOARD_H_ | 214 #endif // BASE_CLIPBOARD_H_ |
| OLD | NEW |