| 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 "ClipboardUtilitiesChromium.h" | 9 #include "ClipboardUtilitiesChromium.h" |
| 10 #include "Cursor.h" | 10 #include "Cursor.h" |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 | 55 |
| 56 #if defined(OS_WIN) | 56 #if defined(OS_WIN) |
| 57 #include <windows.h> | 57 #include <windows.h> |
| 58 #include <vssym32.h> | 58 #include <vssym32.h> |
| 59 | 59 |
| 60 #include "base/gfx/native_theme.h" | 60 #include "base/gfx/native_theme.h" |
| 61 #endif | 61 #endif |
| 62 | 62 |
| 63 namespace { | 63 namespace { |
| 64 | 64 |
| 65 gfx::NativeView ToPlatform(WebCore::Widget* widget) { | 65 gfx::NativeViewId ToNativeId(WebCore::Widget* widget) { |
| 66 if (!widget) | 66 if (!widget) |
| 67 return 0; | 67 return 0; |
| 68 PlatformWidget widget_id = widget->root()->hostWindow()->platformWindow(); | 68 return widget->root()->hostWindow()->platformWindow(); |
| 69 // TODO(eseidel): This cast is a hack. We should replace gfx::NativeView with | |
| 70 // something more abstract like PlatformWidget since webkit/glue should not | |
| 71 // know about actual native widgets. | |
| 72 return static_cast<gfx::NativeView>(widget_id); | |
| 73 } | 69 } |
| 74 | 70 |
| 75 #if PLATFORM(WIN_OS) | 71 #if PLATFORM(WIN_OS) |
| 76 static RECT IntRectToRECT(const WebCore::IntRect& r) { | 72 static RECT IntRectToRECT(const WebCore::IntRect& r) { |
| 77 RECT result; | 73 RECT result; |
| 78 result.left = r.x(); | 74 result.left = r.x(); |
| 79 result.top = r.y(); | 75 result.top = r.y(); |
| 80 result.right = r.right(); | 76 result.right = r.right(); |
| 81 result.bottom = r.bottom(); | 77 result.bottom = r.bottom(); |
| 82 return result; | 78 return result; |
| (...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 426 SharedBuffer::create(data.empty() ? "" : data.data(), | 422 SharedBuffer::create(data.empty() ? "" : data.data(), |
| 427 data.length())); | 423 data.length())); |
| 428 RefPtr<Image> image = BitmapImage::create(); | 424 RefPtr<Image> image = BitmapImage::create(); |
| 429 image->setData(buffer, true); | 425 image->setData(buffer, true); |
| 430 return image; | 426 return image; |
| 431 } | 427 } |
| 432 | 428 |
| 433 // Screen --------------------------------------------------------------------- | 429 // Screen --------------------------------------------------------------------- |
| 434 | 430 |
| 435 int ChromiumBridge::screenDepth(Widget* widget) { | 431 int ChromiumBridge::screenDepth(Widget* widget) { |
| 436 return webkit_glue::GetScreenInfo(ToPlatform(widget)).depth; | 432 return webkit_glue::GetScreenInfo(ToNativeId(widget)).depth; |
| 437 } | 433 } |
| 438 | 434 |
| 439 int ChromiumBridge::screenDepthPerComponent(Widget* widget) { | 435 int ChromiumBridge::screenDepthPerComponent(Widget* widget) { |
| 440 return webkit_glue::GetScreenInfo(ToPlatform(widget)).depth_per_component; | 436 return webkit_glue::GetScreenInfo(ToNativeId(widget)).depth_per_component; |
| 441 } | 437 } |
| 442 | 438 |
| 443 bool ChromiumBridge::screenIsMonochrome(Widget* widget) { | 439 bool ChromiumBridge::screenIsMonochrome(Widget* widget) { |
| 444 return webkit_glue::GetScreenInfo(ToPlatform(widget)).is_monochrome; | 440 return webkit_glue::GetScreenInfo(ToNativeId(widget)).is_monochrome; |
| 445 } | 441 } |
| 446 | 442 |
| 447 IntRect ChromiumBridge::screenRect(Widget* widget) { | 443 IntRect ChromiumBridge::screenRect(Widget* widget) { |
| 448 return webkit_glue::ToIntRect( | 444 return webkit_glue::ToIntRect( |
| 449 webkit_glue::GetScreenInfo(ToPlatform(widget)).rect); | 445 webkit_glue::GetScreenInfo(ToNativeId(widget)).rect); |
| 450 } | 446 } |
| 451 | 447 |
| 452 IntRect ChromiumBridge::screenAvailableRect(Widget* widget) { | 448 IntRect ChromiumBridge::screenAvailableRect(Widget* widget) { |
| 453 return webkit_glue::ToIntRect( | 449 return webkit_glue::ToIntRect( |
| 454 webkit_glue::GetScreenInfo(ToPlatform(widget)).available_rect); | 450 webkit_glue::GetScreenInfo(ToNativeId(widget)).available_rect); |
| 455 } | 451 } |
| 456 | 452 |
| 457 // SharedTimers ---------------------------------------------------------------- | 453 // SharedTimers ---------------------------------------------------------------- |
| 458 // Called by SharedTimerChromium.cpp | 454 // Called by SharedTimerChromium.cpp |
| 459 | 455 |
| 460 class SharedTimerTask; | 456 class SharedTimerTask; |
| 461 | 457 |
| 462 // We maintain a single active timer and a single active task for | 458 // We maintain a single active timer and a single active task for |
| 463 // setting timers directly on the platform. | 459 // setting timers directly on the platform. |
| 464 static SharedTimerTask* shared_timer_task; | 460 static SharedTimerTask* shared_timer_task; |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 707 chrome_client->SetCursor(WebCursor(cursor.impl())); | 703 chrome_client->SetCursor(WebCursor(cursor.impl())); |
| 708 } | 704 } |
| 709 | 705 |
| 710 void ChromiumBridge::widgetSetFocus(Widget* widget) { | 706 void ChromiumBridge::widgetSetFocus(Widget* widget) { |
| 711 ChromeClientImpl* chrome_client = ToChromeClient(widget); | 707 ChromeClientImpl* chrome_client = ToChromeClient(widget); |
| 712 if (chrome_client) | 708 if (chrome_client) |
| 713 chrome_client->focus(); | 709 chrome_client->focus(); |
| 714 } | 710 } |
| 715 | 711 |
| 716 } // namespace WebCore | 712 } // namespace WebCore |
| OLD | NEW |