| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/tools/test_shell/simple_clipboard_impl.h" | 5 #include "webkit/tools/test_shell/simple_clipboard_impl.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
| 10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
| 11 #include "base/string16.h" | 11 #include "base/string16.h" |
| 12 #include "googleurl/src/gurl.h" | 12 #include "googleurl/src/gurl.h" |
| 13 #include "third_party/skia/include/core/SkBitmap.h" | 13 #include "third_party/skia/include/core/SkBitmap.h" |
| 14 #if defined(USE_SYSTEM_ZLIB) | 14 #if defined(USE_SYSTEM_ZLIB) |
| 15 #include <zlib.h> | 15 #include <zlib.h> |
| 16 #else | 16 #else |
| 17 #include "third_party/zlib/zlib.h" | 17 #include "third_party/zlib/zlib.h" |
| 18 #endif | 18 #endif |
| 19 #include "ui/base/clipboard/clipboard.h" | 19 #include "ui/base/clipboard/clipboard.h" |
| 20 #include "ui/gfx/codec/png_codec.h" | 20 #include "ui/gfx/codec/png_codec.h" |
| 21 #include "ui/gfx/size.h" | 21 #include "ui/gfx/size.h" |
| 22 #include "webkit/glue/webkit_glue.h" | 22 #include "webkit/glue/webkit_glue.h" |
| 23 | 23 |
| 24 namespace { | 24 namespace { |
| 25 | 25 |
| 26 base::LazyInstance<ui::Clipboard> clipboard = LAZY_INSTANCE_INITIALIZER; | |
| 27 | |
| 28 } // anonymous namespace | 26 } // anonymous namespace |
| 29 | 27 |
| 30 SimpleClipboardClient::SimpleClipboardClient() { | 28 SimpleClipboardClient::SimpleClipboardClient() { |
| 31 } | 29 } |
| 32 | 30 |
| 33 SimpleClipboardClient::~SimpleClipboardClient() { | 31 SimpleClipboardClient::~SimpleClipboardClient() { |
| 34 } | 32 } |
| 35 | 33 |
| 36 | 34 |
| 37 ui::Clipboard* SimpleClipboardClient::GetClipboard() { | 35 ui::Clipboard* SimpleClipboardClient::GetClipboard() { |
| 38 return clipboard.Pointer(); | 36 return ui::Clipboard::GetForCurrentThread(); |
| 39 } | 37 } |
| 40 | 38 |
| 41 uint64 SimpleClipboardClient::GetSequenceNumber(ui::Clipboard::Buffer buffer) { | 39 uint64 SimpleClipboardClient::GetSequenceNumber(ui::Clipboard::Buffer buffer) { |
| 42 return GetClipboard()->GetSequenceNumber(buffer); | 40 return GetClipboard()->GetSequenceNumber(buffer); |
| 43 } | 41 } |
| 44 | 42 |
| 45 bool SimpleClipboardClient::IsFormatAvailable( | 43 bool SimpleClipboardClient::IsFormatAvailable( |
| 46 const ui::Clipboard::FormatType& format, | 44 const ui::Clipboard::FormatType& format, |
| 47 ui::Clipboard::Buffer buffer) { | 45 ui::Clipboard::Buffer buffer) { |
| 48 return GetClipboard()->IsFormatAvailable(format, buffer); | 46 return GetClipboard()->IsFormatAvailable(format, buffer); |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 void SimpleClipboardClient::ReadCustomData(ui::Clipboard::Buffer buffer, | 108 void SimpleClipboardClient::ReadCustomData(ui::Clipboard::Buffer buffer, |
| 111 const string16& type, | 109 const string16& type, |
| 112 string16* data) { | 110 string16* data) { |
| 113 GetClipboard()->ReadCustomData(buffer, type, data); | 111 GetClipboard()->ReadCustomData(buffer, type, data); |
| 114 } | 112 } |
| 115 | 113 |
| 116 webkit_glue::ClipboardClient::WriteContext* | 114 webkit_glue::ClipboardClient::WriteContext* |
| 117 SimpleClipboardClient::CreateWriteContext() { | 115 SimpleClipboardClient::CreateWriteContext() { |
| 118 return NULL; | 116 return NULL; |
| 119 } | 117 } |
| OLD | NEW |