OLD | NEW |
---|---|
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 // This file provides the embedder's side of random webkit glue functions. | 5 // This file provides the embedder's side of random webkit glue functions. |
6 | 6 |
7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
8 | 8 |
9 #if defined(OS_WIN) | 9 #if defined(OS_WIN) |
10 #include <windows.h> | 10 #include <windows.h> |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
85 } | 85 } |
86 | 86 |
87 RenderThreadImpl::current()->Send( | 87 RenderThreadImpl::current()->Send( |
88 new ClipboardHostMsg_WriteObjectsAsync(objects_)); | 88 new ClipboardHostMsg_WriteObjectsAsync(objects_)); |
89 } | 89 } |
90 | 90 |
91 namespace webkit_glue { | 91 namespace webkit_glue { |
92 | 92 |
93 // Clipboard glue | 93 // Clipboard glue |
94 | 94 |
95 ui::Clipboard* ClipboardGetClipboard() { | 95 CONTENT_EXPORT ui::Clipboard* ClipboardGetClipboard() { |
Jói
2011/11/11 13:09:36
Should these be in the header file (webkit/glue/we
tommi (sloooow) - chröme
2011/11/11 13:23:29
Yes, they should only be in the header. Fixing.
| |
96 return NULL; | 96 return NULL; |
97 } | 97 } |
98 | 98 |
99 uint64 ClipboardGetSequenceNumber(ui::Clipboard::Buffer buffer) { | 99 CONTENT_EXPORT uint64 ClipboardGetSequenceNumber(ui::Clipboard::Buffer buffer) { |
100 uint64 sequence_number = 0; | 100 uint64 sequence_number = 0; |
101 RenderThreadImpl::current()->Send( | 101 RenderThreadImpl::current()->Send( |
102 new ClipboardHostMsg_GetSequenceNumber(buffer, | 102 new ClipboardHostMsg_GetSequenceNumber(buffer, |
103 &sequence_number)); | 103 &sequence_number)); |
104 return sequence_number; | 104 return sequence_number; |
105 } | 105 } |
106 | 106 |
107 bool ClipboardIsFormatAvailable(const ui::Clipboard::FormatType& format, | 107 CONTENT_EXPORT bool ClipboardIsFormatAvailable( |
108 ui::Clipboard::Buffer buffer) { | 108 const ui::Clipboard::FormatType& format, |
109 ui::Clipboard::Buffer buffer) { | |
109 bool result; | 110 bool result; |
110 RenderThreadImpl::current()->Send( | 111 RenderThreadImpl::current()->Send( |
111 new ClipboardHostMsg_IsFormatAvailable(format, buffer, &result)); | 112 new ClipboardHostMsg_IsFormatAvailable(format, buffer, &result)); |
112 return result; | 113 return result; |
113 } | 114 } |
114 | 115 |
115 void ClipboardReadAvailableTypes(ui::Clipboard::Buffer buffer, | 116 CONTENT_EXPORT void ClipboardReadAvailableTypes(ui::Clipboard::Buffer buffer, |
116 std::vector<string16>* types, | 117 std::vector<string16>* types, |
117 bool* contains_filenames) { | 118 bool* contains_filenames) { |
118 RenderThreadImpl::current()->Send(new ClipboardHostMsg_ReadAvailableTypes( | 119 RenderThreadImpl::current()->Send(new ClipboardHostMsg_ReadAvailableTypes( |
119 buffer, types, contains_filenames)); | 120 buffer, types, contains_filenames)); |
120 } | 121 } |
121 | 122 |
122 void ClipboardReadText(ui::Clipboard::Buffer buffer, string16* result) { | 123 CONTENT_EXPORT void ClipboardReadText(ui::Clipboard::Buffer buffer, |
124 string16* result) { | |
123 RenderThreadImpl::current()->Send( | 125 RenderThreadImpl::current()->Send( |
124 new ClipboardHostMsg_ReadText(buffer, result)); | 126 new ClipboardHostMsg_ReadText(buffer, result)); |
125 } | 127 } |
126 | 128 |
127 void ClipboardReadAsciiText(ui::Clipboard::Buffer buffer, std::string* result) { | 129 CONTENT_EXPORT void ClipboardReadAsciiText(ui::Clipboard::Buffer buffer, |
130 std::string* result) { | |
128 RenderThreadImpl::current()->Send( | 131 RenderThreadImpl::current()->Send( |
129 new ClipboardHostMsg_ReadAsciiText(buffer, result)); | 132 new ClipboardHostMsg_ReadAsciiText(buffer, result)); |
130 } | 133 } |
131 | 134 |
132 void ClipboardReadHTML(ui::Clipboard::Buffer buffer, string16* markup, | 135 CONTENT_EXPORT void ClipboardReadHTML(ui::Clipboard::Buffer buffer, |
133 GURL* url, uint32* fragment_start, | 136 string16* markup, |
134 uint32* fragment_end) { | 137 GURL* url, uint32* fragment_start, |
138 uint32* fragment_end) { | |
135 RenderThreadImpl::current()->Send( | 139 RenderThreadImpl::current()->Send( |
136 new ClipboardHostMsg_ReadHTML(buffer, markup, url, fragment_start, | 140 new ClipboardHostMsg_ReadHTML(buffer, markup, url, fragment_start, |
137 fragment_end)); | 141 fragment_end)); |
138 } | 142 } |
139 | 143 |
140 void ClipboardReadImage(ui::Clipboard::Buffer buffer, std::string* data) { | 144 CONTENT_EXPORT void ClipboardReadImage(ui::Clipboard::Buffer buffer, |
145 std::string* data) { | |
141 base::SharedMemoryHandle image_handle; | 146 base::SharedMemoryHandle image_handle; |
142 uint32 image_size; | 147 uint32 image_size; |
143 RenderThreadImpl::current()->Send( | 148 RenderThreadImpl::current()->Send( |
144 new ClipboardHostMsg_ReadImage(buffer, &image_handle, &image_size)); | 149 new ClipboardHostMsg_ReadImage(buffer, &image_handle, &image_size)); |
145 if (base::SharedMemory::IsHandleValid(image_handle)) { | 150 if (base::SharedMemory::IsHandleValid(image_handle)) { |
146 base::SharedMemory buffer(image_handle, true); | 151 base::SharedMemory buffer(image_handle, true); |
147 buffer.Map(image_size); | 152 buffer.Map(image_size); |
148 data->append(static_cast<char*>(buffer.memory()), image_size); | 153 data->append(static_cast<char*>(buffer.memory()), image_size); |
149 } | 154 } |
150 } | 155 } |
151 | 156 |
152 void GetPlugins(bool refresh, | 157 CONTENT_EXPORT void GetPlugins(bool refresh, |
153 std::vector<webkit::WebPluginInfo>* plugins) { | 158 std::vector<webkit::WebPluginInfo>* plugins) { |
154 if (!RenderThreadImpl::current()->plugin_refresh_allowed()) | 159 if (!RenderThreadImpl::current()->plugin_refresh_allowed()) |
155 refresh = false; | 160 refresh = false; |
156 RenderThreadImpl::current()->Send( | 161 RenderThreadImpl::current()->Send( |
157 new ViewHostMsg_GetPlugins(refresh, plugins)); | 162 new ViewHostMsg_GetPlugins(refresh, plugins)); |
158 } | 163 } |
159 | 164 |
160 bool IsProtocolSupportedForMedia(const GURL& url) { | 165 CONTENT_EXPORT bool IsProtocolSupportedForMedia(const GURL& url) { |
161 // If new protocol is to be added here, we need to make sure the response is | 166 // If new protocol is to be added here, we need to make sure the response is |
162 // validated accordingly in the media engine. | 167 // validated accordingly in the media engine. |
163 if (url.SchemeIsFile() || url.SchemeIs(chrome::kHttpScheme) || | 168 if (url.SchemeIsFile() || url.SchemeIs(chrome::kHttpScheme) || |
164 url.SchemeIs(chrome::kHttpsScheme) || | 169 url.SchemeIs(chrome::kHttpsScheme) || |
165 url.SchemeIs(chrome::kDataScheme) || | 170 url.SchemeIs(chrome::kDataScheme) || |
166 url.SchemeIs(chrome::kFileSystemScheme) || | 171 url.SchemeIs(chrome::kFileSystemScheme) || |
167 url.SchemeIs(chrome::kBlobScheme)) | 172 url.SchemeIs(chrome::kBlobScheme)) |
168 return true; | 173 return true; |
169 return | 174 return |
170 content::GetContentClient()->renderer()->IsProtocolSupportedForMedia(url); | 175 content::GetContentClient()->renderer()->IsProtocolSupportedForMedia(url); |
171 } | 176 } |
172 | 177 |
173 // static factory function | 178 // static factory function |
174 ResourceLoaderBridge* ResourceLoaderBridge::Create( | 179 CONTENT_EXPORT ResourceLoaderBridge* ResourceLoaderBridge::Create( |
175 const ResourceLoaderBridge::RequestInfo& request_info) { | 180 const ResourceLoaderBridge::RequestInfo& request_info) { |
176 return ChildThread::current()->CreateBridge(request_info); | 181 return ChildThread::current()->CreateBridge(request_info); |
177 } | 182 } |
178 | 183 |
179 // static factory function | 184 // static factory function |
180 WebSocketStreamHandleBridge* WebSocketStreamHandleBridge::Create( | 185 CONTENT_EXPORT WebSocketStreamHandleBridge* WebSocketStreamHandleBridge::Create( |
181 WebKit::WebSocketStreamHandle* handle, | 186 WebKit::WebSocketStreamHandle* handle, |
182 WebSocketStreamHandleDelegate* delegate) { | 187 WebSocketStreamHandleDelegate* delegate) { |
183 SocketStreamDispatcher* dispatcher = | 188 SocketStreamDispatcher* dispatcher = |
184 ChildThread::current()->socket_stream_dispatcher(); | 189 ChildThread::current()->socket_stream_dispatcher(); |
185 return dispatcher->CreateBridge(handle, delegate); | 190 return dispatcher->CreateBridge(handle, delegate); |
186 } | 191 } |
187 | 192 |
188 string16 GetLocalizedString(int message_id) { | 193 CONTENT_EXPORT string16 GetLocalizedString(int message_id) { |
189 return content::GetContentClient()->GetLocalizedString(message_id); | 194 return content::GetContentClient()->GetLocalizedString(message_id); |
190 } | 195 } |
191 | 196 |
192 base::StringPiece GetDataResource(int resource_id) { | 197 CONTENT_EXPORT base::StringPiece GetDataResource(int resource_id) { |
193 return content::GetContentClient()->GetDataResource(resource_id); | 198 return content::GetContentClient()->GetDataResource(resource_id); |
194 } | 199 } |
195 | 200 |
196 } // namespace webkit_glue | 201 } // namespace webkit_glue |
OLD | NEW |