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 13 matching lines...) Expand all Loading... |
24 #include "SystemTime.h" | 24 #include "SystemTime.h" |
25 #include "Widget.h" | 25 #include "Widget.h" |
26 #include <wtf/CurrentTime.h> | 26 #include <wtf/CurrentTime.h> |
27 | 27 |
28 #undef LOG | 28 #undef LOG |
29 #include "base/file_util.h" | 29 #include "base/file_util.h" |
30 #include "base/string_util.h" | 30 #include "base/string_util.h" |
31 #include "build/build_config.h" | 31 #include "build/build_config.h" |
32 #include "googleurl/src/url_util.h" | 32 #include "googleurl/src/url_util.h" |
33 #include "skia/ext/skia_utils_win.h" | 33 #include "skia/ext/skia_utils_win.h" |
| 34 #include "third_party/WebKit/WebKit/chromium/public/WebScreenInfo.h" |
34 #include "webkit/glue/chrome_client_impl.h" | 35 #include "webkit/glue/chrome_client_impl.h" |
35 #include "webkit/glue/glue_util.h" | 36 #include "webkit/glue/glue_util.h" |
36 #include "webkit/glue/plugins/plugin_instance.h" | 37 #include "webkit/glue/plugins/plugin_instance.h" |
37 #include "webkit/glue/screen_info.h" | 38 #include "webkit/glue/screen_info.h" |
38 #include "webkit/glue/webcursor.h" | 39 #include "webkit/glue/webcursor.h" |
39 #include "webkit/glue/webkit_glue.h" | 40 #include "webkit/glue/webkit_glue.h" |
40 #include "webkit/glue/webplugin_impl.h" | 41 #include "webkit/glue/webplugin_impl.h" |
41 #include "webkit/glue/webview.h" | 42 #include "webkit/glue/webview_impl.h" |
42 | 43 |
43 #if defined(OS_WIN) | 44 #if defined(OS_WIN) |
44 #include <windows.h> | 45 #include <windows.h> |
45 #include <vssym32.h> | 46 #include <vssym32.h> |
46 | 47 |
47 #include "base/gfx/native_theme.h" | 48 #include "base/gfx/native_theme.h" |
48 #endif | 49 #endif |
49 | 50 |
50 namespace { | 51 namespace { |
51 | 52 |
(...skipping 13 matching lines...) Expand all Loading... |
65 return NULL; | 66 return NULL; |
66 } | 67 } |
67 | 68 |
68 WebCore::Page* page = view->frame() ? view->frame()->page() : NULL; | 69 WebCore::Page* page = view->frame() ? view->frame()->page() : NULL; |
69 if (!page) | 70 if (!page) |
70 return NULL; | 71 return NULL; |
71 | 72 |
72 return static_cast<ChromeClientImpl*>(page->chrome()->client()); | 73 return static_cast<ChromeClientImpl*>(page->chrome()->client()); |
73 } | 74 } |
74 | 75 |
| 76 WebViewImpl* ToWebView(WebCore::Widget* widget) { |
| 77 ChromeClientImpl* chrome_client = ToChromeClient(widget); |
| 78 if (!chrome_client) |
| 79 return NULL; |
| 80 return chrome_client->webview(); |
| 81 } |
| 82 |
| 83 WebCore::IntRect ToIntRect(const WebKit::WebRect& input) { |
| 84 return WebCore::IntRect(input.x, input.y, input.width, input.height); |
| 85 } |
| 86 |
75 } // namespace | 87 } // namespace |
76 | 88 |
77 namespace WebCore { | 89 namespace WebCore { |
78 | 90 |
79 // JavaScript ----------------------------------------------------------------- | 91 // JavaScript ----------------------------------------------------------------- |
80 | 92 |
81 void ChromiumBridge::notifyJSOutOfMemory(Frame* frame) { | 93 void ChromiumBridge::notifyJSOutOfMemory(Frame* frame) { |
82 if (!frame) | 94 if (!frame) |
83 return; | 95 return; |
84 | 96 |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 // Protocol ------------------------------------------------------------------- | 168 // Protocol ------------------------------------------------------------------- |
157 | 169 |
158 String ChromiumBridge::uiResourceProtocol() { | 170 String ChromiumBridge::uiResourceProtocol() { |
159 return webkit_glue::StdStringToString(webkit_glue::GetUIResourceProtocol()); | 171 return webkit_glue::StdStringToString(webkit_glue::GetUIResourceProtocol()); |
160 } | 172 } |
161 | 173 |
162 | 174 |
163 // Screen --------------------------------------------------------------------- | 175 // Screen --------------------------------------------------------------------- |
164 | 176 |
165 int ChromiumBridge::screenDepth(Widget* widget) { | 177 int ChromiumBridge::screenDepth(Widget* widget) { |
166 return webkit_glue::GetScreenInfo(ToNativeId(widget)).depth; | 178 WebViewImpl* view = ToWebView(widget); |
| 179 if (!view || !view->delegate()) |
| 180 return NULL; |
| 181 return view->delegate()->GetScreenInfo(view).depth; |
167 } | 182 } |
168 | 183 |
169 int ChromiumBridge::screenDepthPerComponent(Widget* widget) { | 184 int ChromiumBridge::screenDepthPerComponent(Widget* widget) { |
170 return webkit_glue::GetScreenInfo(ToNativeId(widget)).depth_per_component; | 185 WebViewImpl* view = ToWebView(widget); |
| 186 if (!view || !view->delegate()) |
| 187 return NULL; |
| 188 return view->delegate()->GetScreenInfo(view).depthPerComponent; |
171 } | 189 } |
172 | 190 |
173 bool ChromiumBridge::screenIsMonochrome(Widget* widget) { | 191 bool ChromiumBridge::screenIsMonochrome(Widget* widget) { |
174 return webkit_glue::GetScreenInfo(ToNativeId(widget)).is_monochrome; | 192 WebViewImpl* view = ToWebView(widget); |
| 193 if (!view || !view->delegate()) |
| 194 return NULL; |
| 195 return view->delegate()->GetScreenInfo(view).isMonochrome; |
175 } | 196 } |
176 | 197 |
177 IntRect ChromiumBridge::screenRect(Widget* widget) { | 198 IntRect ChromiumBridge::screenRect(Widget* widget) { |
178 return webkit_glue::ToIntRect( | 199 WebViewImpl* view = ToWebView(widget); |
179 webkit_glue::GetScreenInfo(ToNativeId(widget)).rect); | 200 if (!view || !view->delegate()) |
| 201 return IntRect(); |
| 202 return ToIntRect(view->delegate()->GetScreenInfo(view).rect); |
180 } | 203 } |
181 | 204 |
182 IntRect ChromiumBridge::screenAvailableRect(Widget* widget) { | 205 IntRect ChromiumBridge::screenAvailableRect(Widget* widget) { |
183 return webkit_glue::ToIntRect( | 206 WebViewImpl* view = ToWebView(widget); |
184 webkit_glue::GetScreenInfo(ToNativeId(widget)).available_rect); | 207 if (!view || !view->delegate()) |
| 208 return IntRect(); |
| 209 return ToIntRect(view->delegate()->GetScreenInfo(view).availableRect); |
185 } | 210 } |
186 | 211 |
187 // Widget --------------------------------------------------------------------- | 212 // Widget --------------------------------------------------------------------- |
188 | 213 |
189 void ChromiumBridge::widgetSetCursor(Widget* widget, const Cursor& cursor) { | 214 void ChromiumBridge::widgetSetCursor(Widget* widget, const Cursor& cursor) { |
190 ChromeClientImpl* chrome_client = ToChromeClient(widget); | 215 ChromeClientImpl* chrome_client = ToChromeClient(widget); |
191 if (chrome_client) | 216 if (chrome_client) |
192 chrome_client->SetCursor(WebCursor(cursor.impl())); | 217 chrome_client->SetCursor(WebCursor(cursor.impl())); |
193 } | 218 } |
194 | 219 |
195 void ChromiumBridge::widgetSetFocus(Widget* widget) { | 220 void ChromiumBridge::widgetSetFocus(Widget* widget) { |
196 ChromeClientImpl* chrome_client = ToChromeClient(widget); | 221 ChromeClientImpl* chrome_client = ToChromeClient(widget); |
197 if (chrome_client) | 222 if (chrome_client) |
198 chrome_client->focus(); | 223 chrome_client->focus(); |
199 } | 224 } |
200 | 225 |
201 } // namespace WebCore | 226 } // namespace WebCore |
OLD | NEW |