Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(210)

Side by Side Diff: webkit/glue/webclipboard_impl.cc

Issue 8801038: Make Clipboard::FormatType an opaque handle type. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/base/clipboard/scoped_clipboard_writer.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #include "webkit/glue/webclipboard_impl.h" 5 #include "webkit/glue/webclipboard_impl.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/pickle.h" 8 #include "base/pickle.h"
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 78
79 uint64 WebClipboardImpl::sequenceNumber(Buffer buffer) { 79 uint64 WebClipboardImpl::sequenceNumber(Buffer buffer) {
80 ui::Clipboard::Buffer buffer_type; 80 ui::Clipboard::Buffer buffer_type;
81 if (!ConvertBufferType(buffer, &buffer_type)) 81 if (!ConvertBufferType(buffer, &buffer_type))
82 return 0; 82 return 0;
83 83
84 return client_->GetSequenceNumber(buffer_type); 84 return client_->GetSequenceNumber(buffer_type);
85 } 85 }
86 86
87 bool WebClipboardImpl::isFormatAvailable(Format format, Buffer buffer) { 87 bool WebClipboardImpl::isFormatAvailable(Format format, Buffer buffer) {
88 ui::Clipboard::FormatType format_type;
89 ui::Clipboard::Buffer buffer_type; 88 ui::Clipboard::Buffer buffer_type;
90 89
91 if (!ConvertBufferType(buffer, &buffer_type)) 90 if (!ConvertBufferType(buffer, &buffer_type))
92 return false; 91 return false;
93 92
94 switch (format) { 93 switch (format) {
95 case FormatPlainText: 94 case FormatPlainText:
96 return client_->IsFormatAvailable(ui::Clipboard::GetPlainTextFormatType(), 95 return client_->IsFormatAvailable(ui::Clipboard::GetPlainTextFormatType(),
97 buffer_type) || 96 buffer_type) ||
98 client_->IsFormatAvailable(ui::Clipboard::GetPlainTextWFormatType(), 97 client_->IsFormatAvailable(ui::Clipboard::GetPlainTextWFormatType(),
99 buffer_type); 98 buffer_type);
100 case FormatHTML: 99 case FormatHTML:
101 format_type = ui::Clipboard::GetHtmlFormatType(); 100 return client_->IsFormatAvailable(ui::Clipboard::GetHtmlFormatType(),
102 break; 101 buffer_type);
103 case FormatSmartPaste: 102 case FormatSmartPaste:
104 format_type = ui::Clipboard::GetWebKitSmartPasteFormatType(); 103 return client_->IsFormatAvailable(
105 break; 104 ui::Clipboard::GetWebKitSmartPasteFormatType(), buffer_type);
106 case FormatBookmark: 105 case FormatBookmark:
107 #if defined(OS_WIN) || defined(OS_MACOSX) 106 #if defined(OS_WIN) || defined(OS_MACOSX)
108 format_type = ui::Clipboard::GetUrlWFormatType(); 107 return client_->IsFormatAvailable(ui::Clipboard::GetUrlWFormatType(),
109 break; 108 buffer_type);
110 #endif 109 #endif
111 default: 110 default:
112 NOTREACHED(); 111 NOTREACHED();
113 return false;
114 } 112 }
115 113
116 return client_->IsFormatAvailable(format_type, buffer_type); 114 return false;
117 } 115 }
118 116
119 WebVector<WebString> WebClipboardImpl::readAvailableTypes( 117 WebVector<WebString> WebClipboardImpl::readAvailableTypes(
120 Buffer buffer, bool* contains_filenames) { 118 Buffer buffer, bool* contains_filenames) {
121 ui::Clipboard::Buffer buffer_type; 119 ui::Clipboard::Buffer buffer_type;
122 std::vector<string16> types; 120 std::vector<string16> types;
123 if (ConvertBufferType(buffer, &buffer_type)) { 121 if (ConvertBufferType(buffer, &buffer_type)) {
124 client_->ReadAvailableTypes(buffer_type, &types, contains_filenames); 122 client_->ReadAvailableTypes(buffer_type, &types, contains_filenames);
125 } 123 }
126 return types; 124 return types;
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 break; 265 break;
268 #endif 266 #endif
269 default: 267 default:
270 NOTREACHED(); 268 NOTREACHED();
271 return false; 269 return false;
272 } 270 }
273 return true; 271 return true;
274 } 272 }
275 273
276 } // namespace webkit_glue 274 } // namespace webkit_glue
OLDNEW
« no previous file with comments | « ui/base/clipboard/scoped_clipboard_writer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698