OLD | NEW |
1 // Copyright (c) 2008 The Chromium Authors. All rights reserved. Use of this | 1 // Copyright (c) 2008 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 "config.h" | 5 #include "config.h" |
6 #include "ChromiumBridge.h" | 6 #include "ChromiumBridge.h" |
7 | 7 |
8 #include "BitmapImage.h" | 8 #include "BitmapImage.h" |
9 #include "Cursor.h" | 9 #include "Cursor.h" |
10 #include "Frame.h" | 10 #include "Frame.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 | 27 |
28 #undef LOG | 28 #undef LOG |
29 #include "base/file_util.h" | 29 #include "base/file_util.h" |
30 #include "base/message_loop.h" | 30 #include "base/message_loop.h" |
31 #include "base/stats_counters.h" | 31 #include "base/stats_counters.h" |
32 #include "base/string_util.h" | 32 #include "base/string_util.h" |
33 #include "base/time.h" | 33 #include "base/time.h" |
34 #include "base/trace_event.h" | 34 #include "base/trace_event.h" |
35 #include "build/build_config.h" | 35 #include "build/build_config.h" |
36 #include "googleurl/src/url_util.h" | 36 #include "googleurl/src/url_util.h" |
37 #include "net/base/mime_util.h" | |
38 #include "skia/ext/skia_utils_win.h" | 37 #include "skia/ext/skia_utils_win.h" |
39 #if USE(V8) | 38 #if USE(V8) |
40 #include <v8.h> | 39 #include <v8.h> |
41 #endif | 40 #endif |
42 #include "grit/webkit_resources.h" | 41 #include "grit/webkit_resources.h" |
43 #include "webkit/glue/chrome_client_impl.h" | 42 #include "webkit/glue/chrome_client_impl.h" |
44 #include "webkit/glue/glue_util.h" | 43 #include "webkit/glue/glue_util.h" |
45 #include "webkit/glue/plugins/plugin_instance.h" | 44 #include "webkit/glue/plugins/plugin_instance.h" |
46 #include "webkit/glue/webcursor.h" | 45 #include "webkit/glue/webcursor.h" |
47 #include "webkit/glue/webkit_glue.h" | 46 #include "webkit/glue/webkit_glue.h" |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 String ChromiumBridge::computedDefaultLanguage() { | 134 String ChromiumBridge::computedDefaultLanguage() { |
136 return webkit_glue::StdWStringToString(webkit_glue::GetWebKitLocale()); | 135 return webkit_glue::StdWStringToString(webkit_glue::GetWebKitLocale()); |
137 } | 136 } |
138 | 137 |
139 // LayoutTestMode ------------------------------------------------------------- | 138 // LayoutTestMode ------------------------------------------------------------- |
140 | 139 |
141 bool ChromiumBridge::layoutTestMode() { | 140 bool ChromiumBridge::layoutTestMode() { |
142 return webkit_glue::IsLayoutTestMode(); | 141 return webkit_glue::IsLayoutTestMode(); |
143 } | 142 } |
144 | 143 |
145 // MimeType ------------------------------------------------------------------- | |
146 | |
147 bool ChromiumBridge::isSupportedImageMIMEType(const char* mime_type) { | |
148 return net::IsSupportedImageMimeType(mime_type); | |
149 } | |
150 | |
151 bool ChromiumBridge::isSupportedJavascriptMIMEType(const char* mime_type) { | |
152 return net::IsSupportedJavascriptMimeType(mime_type); | |
153 } | |
154 | |
155 bool ChromiumBridge::isSupportedNonImageMIMEType(const char* mime_type) { | |
156 return net::IsSupportedNonImageMimeType(mime_type); | |
157 } | |
158 | |
159 bool ChromiumBridge::matchesMIMEType(const String& pattern, | |
160 const String& type) { | |
161 return net::MatchesMimeType(webkit_glue::StringToStdString(pattern), | |
162 webkit_glue::StringToStdString(type)); | |
163 } | |
164 | |
165 String ChromiumBridge::mimeTypeForExtension(const String& ext) { | |
166 if (ext.isEmpty()) | |
167 return String(); | |
168 | |
169 std::string type; | |
170 webkit_glue::GetMimeTypeFromExtension( | |
171 webkit_glue::StringToFilePathString(ext), &type); | |
172 return webkit_glue::StdStringToString(type); | |
173 } | |
174 | |
175 String ChromiumBridge::mimeTypeFromFile(const String& file_path) { | |
176 if (file_path.isEmpty()) | |
177 return String(); | |
178 | |
179 std::string type; | |
180 webkit_glue::GetMimeTypeFromFile( | |
181 FilePath(webkit_glue::StringToFilePathString(file_path)), &type); | |
182 return webkit_glue::StdStringToString(type); | |
183 } | |
184 | |
185 String ChromiumBridge::preferredExtensionForMIMEType(const String& mime_type) { | |
186 if (mime_type.isEmpty()) | |
187 return String(); | |
188 | |
189 FilePath::StringType stdext; | |
190 webkit_glue::GetPreferredExtensionForMimeType( | |
191 webkit_glue::StringToStdString(mime_type), &stdext); | |
192 return webkit_glue::FilePathStringToString(stdext); | |
193 } | |
194 | |
195 // Plugin --------------------------------------------------------------------- | 144 // Plugin --------------------------------------------------------------------- |
196 | 145 |
197 bool ChromiumBridge::plugins(bool refresh, Vector<PluginInfo*>* results) { | 146 bool ChromiumBridge::plugins(bool refresh, Vector<PluginInfo*>* results) { |
198 std::vector<WebPluginInfo> glue_plugins; | 147 std::vector<WebPluginInfo> glue_plugins; |
199 if (!webkit_glue::GetPlugins(refresh, &glue_plugins)) | 148 if (!webkit_glue::GetPlugins(refresh, &glue_plugins)) |
200 return false; | 149 return false; |
201 for (size_t i = 0; i < glue_plugins.size(); ++i) { | 150 for (size_t i = 0; i < glue_plugins.size(); ++i) { |
202 PluginInfo* rv = new PluginInfo; | 151 PluginInfo* rv = new PluginInfo; |
203 const WebPluginInfo& plugin = glue_plugins[i]; | 152 const WebPluginInfo& plugin = glue_plugins[i]; |
204 rv->name = webkit_glue::StdWStringToString(plugin.name); | 153 rv->name = webkit_glue::StdWStringToString(plugin.name); |
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
586 chrome_client->SetCursor(WebCursor(cursor.impl())); | 535 chrome_client->SetCursor(WebCursor(cursor.impl())); |
587 } | 536 } |
588 | 537 |
589 void ChromiumBridge::widgetSetFocus(Widget* widget) { | 538 void ChromiumBridge::widgetSetFocus(Widget* widget) { |
590 ChromeClientImpl* chrome_client = ToChromeClient(widget); | 539 ChromeClientImpl* chrome_client = ToChromeClient(widget); |
591 if (chrome_client) | 540 if (chrome_client) |
592 chrome_client->focus(); | 541 chrome_client->focus(); |
593 } | 542 } |
594 | 543 |
595 } // namespace WebCore | 544 } // namespace WebCore |
OLD | NEW |