| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this |
| 2 // source code is governed by a BSD-style license that can be found in the | 2 // source code is governed by a BSD-style license that can be found in the |
| 3 // LICENSE file. | 3 // LICENSE file. |
| 4 | 4 |
| 5 #include "webkit/glue/webclipboard_impl.h" | 5 #include "webkit/glue/webclipboard_impl.h" |
| 6 | 6 |
| 7 #include "base/clipboard.h" | 7 #include "base/clipboard.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
| 10 #include "googleurl/src/gurl.h" | 10 #include "googleurl/src/gurl.h" |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 if (!image.isNull()) { | 149 if (!image.isNull()) { |
| 150 #if WEBKIT_USING_SKIA | 150 #if WEBKIT_USING_SKIA |
| 151 const SkBitmap& bitmap = image.getSkBitmap(); | 151 const SkBitmap& bitmap = image.getSkBitmap(); |
| 152 #elif WEBKIT_USING_CG | 152 #elif WEBKIT_USING_CG |
| 153 const SkBitmap& bitmap = gfx::CGImageToSkBitmap(image.getCGImageRef()); | 153 const SkBitmap& bitmap = gfx::CGImageToSkBitmap(image.getCGImageRef()); |
| 154 #endif | 154 #endif |
| 155 SkAutoLockPixels locked(bitmap); | 155 SkAutoLockPixels locked(bitmap); |
| 156 scw.WriteBitmapFromPixels(bitmap.getPixels(), image.size()); | 156 scw.WriteBitmapFromPixels(bitmap.getPixels(), image.size()); |
| 157 } | 157 } |
| 158 | 158 |
| 159 if (!url.isEmpty()) { | 159 // We intentionally only write the image. If the user wants the URL, they |
| 160 scw.WriteBookmark(title, url.spec()); | 160 // can get that from the context menu. |
| 161 scw.WriteHTML(UTF8ToUTF16(URLToImageMarkup(url, title)), ""); | |
| 162 scw.WriteText(UTF8ToUTF16(url.spec())); | |
| 163 } | |
| 164 } | 161 } |
| 165 | 162 |
| 166 bool WebClipboardImpl::ConvertBufferType(Buffer buffer, | 163 bool WebClipboardImpl::ConvertBufferType(Buffer buffer, |
| 167 Clipboard::Buffer* result) { | 164 Clipboard::Buffer* result) { |
| 168 switch (buffer) { | 165 switch (buffer) { |
| 169 case BufferStandard: | 166 case BufferStandard: |
| 170 *result = Clipboard::BUFFER_STANDARD; | 167 *result = Clipboard::BUFFER_STANDARD; |
| 171 break; | 168 break; |
| 172 case BufferSelection: | 169 case BufferSelection: |
| 173 #if defined(OS_LINUX) | 170 #if defined(OS_LINUX) |
| 174 *result = Clipboard::BUFFER_SELECTION; | 171 *result = Clipboard::BUFFER_SELECTION; |
| 175 break; | 172 break; |
| 176 #endif | 173 #endif |
| 177 default: | 174 default: |
| 178 NOTREACHED(); | 175 NOTREACHED(); |
| 179 return false; | 176 return false; |
| 180 } | 177 } |
| 181 return true; | 178 return true; |
| 182 } | 179 } |
| 183 | 180 |
| 184 } // namespace webkit_glue | 181 } // namespace webkit_glue |
| OLD | NEW |