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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 if (!webview) | 99 if (!webview) |
100 return; | 100 return; |
101 WebViewDelegate* delegate = webview->GetDelegate(); | 101 WebViewDelegate* delegate = webview->GetDelegate(); |
102 if (!delegate) | 102 if (!delegate) |
103 return; | 103 return; |
104 delegate->JSOutOfMemory(); | 104 delegate->JSOutOfMemory(); |
105 } | 105 } |
106 | 106 |
107 // Plugin --------------------------------------------------------------------- | 107 // Plugin --------------------------------------------------------------------- |
108 | 108 |
109 bool ChromiumBridge::plugins(bool refresh, Vector<PluginInfo*>* results) { | |
110 std::vector<WebPluginInfo> glue_plugins; | |
111 if (!webkit_glue::GetPlugins(refresh, &glue_plugins)) | |
112 return false; | |
113 for (size_t i = 0; i < glue_plugins.size(); ++i) { | |
114 PluginInfo* rv = new PluginInfo; | |
115 const WebPluginInfo& plugin = glue_plugins[i]; | |
116 rv->name = webkit_glue::StdWStringToString(plugin.name); | |
117 rv->desc = webkit_glue::StdWStringToString(plugin.desc); | |
118 rv->file = | |
119 #if defined(OS_WIN) | |
120 webkit_glue::StdWStringToString(plugin.path.BaseName().value()); | |
121 #elif defined(OS_POSIX) | |
122 webkit_glue::StdStringToString(plugin.path.BaseName().value()); | |
123 #endif | |
124 for (size_t j = 0; j < plugin.mime_types.size(); ++ j) { | |
125 MimeClassInfo* new_mime = new MimeClassInfo(); | |
126 const WebPluginMimeType& mime_type = plugin.mime_types[j]; | |
127 new_mime->desc = webkit_glue::StdWStringToString(mime_type.description); | |
128 | |
129 for (size_t k = 0; k < mime_type.file_extensions.size(); ++k) { | |
130 if (new_mime->suffixes.length()) | |
131 new_mime->suffixes.append(","); | |
132 | |
133 new_mime->suffixes.append(webkit_glue::StdStringToString( | |
134 mime_type.file_extensions[k])); | |
135 } | |
136 | |
137 new_mime->type = webkit_glue::StdStringToString(mime_type.mime_type); | |
138 new_mime->plugin = rv; | |
139 rv->mimes.append(new_mime); | |
140 } | |
141 results->append(rv); | |
142 } | |
143 return true; | |
144 } | |
145 | |
146 NPObject* ChromiumBridge::pluginScriptableObject(Widget* widget) { | 109 NPObject* ChromiumBridge::pluginScriptableObject(Widget* widget) { |
147 if (!widget) | 110 if (!widget) |
148 return NULL; | 111 return NULL; |
149 | 112 |
150 // NOTE: We have to trust that the widget passed to us here is a | 113 // NOTE: We have to trust that the widget passed to us here is a |
151 // WebPluginImpl. There isn't a way to dynamically verify it, since the | 114 // WebPluginImpl. There isn't a way to dynamically verify it, since the |
152 // derived class (Widget) has no identifier. | 115 // derived class (Widget) has no identifier. |
153 return static_cast<WebPluginContainer*>(widget)->GetPluginScriptableObject(); | 116 return static_cast<WebPluginContainer*>(widget)->GetPluginScriptableObject(); |
154 } | 117 } |
155 | 118 |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 chrome_client->SetCursor(WebCursor(cursor.impl())); | 179 chrome_client->SetCursor(WebCursor(cursor.impl())); |
217 } | 180 } |
218 | 181 |
219 void ChromiumBridge::widgetSetFocus(Widget* widget) { | 182 void ChromiumBridge::widgetSetFocus(Widget* widget) { |
220 ChromeClientImpl* chrome_client = ToChromeClient(widget); | 183 ChromeClientImpl* chrome_client = ToChromeClient(widget); |
221 if (chrome_client) | 184 if (chrome_client) |
222 chrome_client->focus(); | 185 chrome_client->focus(); |
223 } | 186 } |
224 | 187 |
225 } // namespace WebCore | 188 } // namespace WebCore |
OLD | NEW |