| 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 #include "webkit/glue/webkit_glue.h" | 5 #include "webkit/glue/webkit_glue.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/clipboard.h" | 9 #include "base/clipboard.h" |
| 10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 } | 27 } |
| 28 | 28 |
| 29 namespace webkit_glue { | 29 namespace webkit_glue { |
| 30 | 30 |
| 31 base::LazyInstance<Clipboard> clipboard(base::LINKER_INITIALIZED); | 31 base::LazyInstance<Clipboard> clipboard(base::LINKER_INITIALIZED); |
| 32 | 32 |
| 33 Clipboard* ClipboardGetClipboard() { | 33 Clipboard* ClipboardGetClipboard() { |
| 34 return clipboard.Pointer(); | 34 return clipboard.Pointer(); |
| 35 } | 35 } |
| 36 | 36 |
| 37 bool ClipboardIsFormatAvailable(Clipboard::FormatType format) { | 37 bool ClipboardIsFormatAvailable(const Clipboard::FormatType& format) { |
| 38 return ClipboardGetClipboard()->IsFormatAvailable(format); | 38 return ClipboardGetClipboard()->IsFormatAvailable(format); |
| 39 } | 39 } |
| 40 | 40 |
| 41 void ClipboardReadText(string16* result) { | 41 void ClipboardReadText(string16* result) { |
| 42 ClipboardGetClipboard()->ReadText(result); | 42 ClipboardGetClipboard()->ReadText(result); |
| 43 } | 43 } |
| 44 | 44 |
| 45 void ClipboardReadAsciiText(std::string* result) { | 45 void ClipboardReadAsciiText(std::string* result) { |
| 46 ClipboardGetClipboard()->ReadAsciiText(result); | 46 ClipboardGetClipboard()->ReadAsciiText(result); |
| 47 } | 47 } |
| 48 | 48 |
| 49 void ClipboardReadHTML(string16* markup, GURL* url) { | 49 void ClipboardReadHTML(string16* markup, GURL* url) { |
| 50 std::string url_str; | 50 std::string url_str; |
| 51 ClipboardGetClipboard()->ReadHTML(markup, url ? &url_str : NULL); | 51 ClipboardGetClipboard()->ReadHTML(markup, url ? &url_str : NULL); |
| 52 if (url) | 52 if (url) |
| 53 *url = GURL(url_str); | 53 *url = GURL(url_str); |
| 54 } | 54 } |
| 55 | 55 |
| 56 } // namespace webkit_glue | 56 } // namespace webkit_glue |
| OLD | NEW |