| 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" |
| 11 #include "Frame.h" | 11 #include "Frame.h" |
| 12 #include "FrameView.h" | 12 #include "FrameView.h" |
| 13 #include "HostWindow.h" | 13 #include "HostWindow.h" |
| 14 #include "KURL.h" | 14 #include "KURL.h" |
| 15 #include "NativeImageSkia.h" | 15 #include "NativeImageSkia.h" |
| 16 #include "Page.h" | 16 #include "Page.h" |
| 17 #include "PasteboardPrivate.h" | 17 #include "PasteboardPrivate.h" |
| 18 #include "PlatformContextSkia.h" | 18 #include "PlatformContextSkia.h" |
| 19 #include "PlatformString.h" | 19 #include "PlatformString.h" |
| 20 #include "PlatformWidget.h" | 20 #include "PlatformWidget.h" |
| 21 #include "PluginData.h" | 21 #include "PluginData.h" |
| 22 #include "PluginInfoStore.h" | 22 #include "PluginInfoStore.h" |
| 23 #include "ScrollbarTheme.h" | 23 #include "ScrollbarTheme.h" |
| 24 #include "ScrollView.h" | 24 #include "ScrollView.h" |
| 25 #include "SystemTime.h" | 25 #include "SystemTime.h" |
| 26 #include "Widget.h" | 26 #include "Widget.h" |
| 27 #include <wtf/CurrentTime.h> |
| 27 | 28 |
| 28 #undef LOG | 29 #undef LOG |
| 29 #include "base/clipboard.h" | 30 #include "base/clipboard.h" |
| 30 #include "base/file_util.h" | 31 #include "base/file_util.h" |
| 31 #include "base/message_loop.h" | 32 #include "base/message_loop.h" |
| 32 #include "base/stats_counters.h" | 33 #include "base/stats_counters.h" |
| 33 #include "base/string_util.h" | 34 #include "base/string_util.h" |
| 34 #include "base/time.h" | 35 #include "base/time.h" |
| 35 #include "base/trace_event.h" | 36 #include "base/trace_event.h" |
| 36 #include "build/build_config.h" | 37 #include "build/build_config.h" |
| (...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 482 void (*callback_)(); | 483 void (*callback_)(); |
| 483 DISALLOW_COPY_AND_ASSIGN(SharedTimerTask); | 484 DISALLOW_COPY_AND_ASSIGN(SharedTimerTask); |
| 484 }; | 485 }; |
| 485 | 486 |
| 486 void ChromiumBridge::setSharedTimerFiredFunction(void (*func)()) { | 487 void ChromiumBridge::setSharedTimerFiredFunction(void (*func)()) { |
| 487 shared_timer_function = func; | 488 shared_timer_function = func; |
| 488 } | 489 } |
| 489 | 490 |
| 490 void ChromiumBridge::setSharedTimerFireTime(double fire_time) { | 491 void ChromiumBridge::setSharedTimerFireTime(double fire_time) { |
| 491 DCHECK(shared_timer_function); | 492 DCHECK(shared_timer_function); |
| 492 int interval = static_cast<int>((fire_time - currentTime()) * 1000); | 493 int interval = static_cast<int>((fire_time - WTF::currentTime()) * 1000); |
| 493 if (interval < 0) | 494 if (interval < 0) |
| 494 interval = 0; | 495 interval = 0; |
| 495 | 496 |
| 496 stopSharedTimer(); | 497 stopSharedTimer(); |
| 497 | 498 |
| 498 // Verify that we didn't leak the task or timer objects. | 499 // Verify that we didn't leak the task or timer objects. |
| 499 DCHECK(shared_timer_task == NULL); | 500 DCHECK(shared_timer_task == NULL); |
| 500 shared_timer_task = new SharedTimerTask(shared_timer_function); | 501 shared_timer_task = new SharedTimerTask(shared_timer_function); |
| 501 MessageLoop::current()->PostDelayedTask(FROM_HERE, shared_timer_task, | 502 MessageLoop::current()->PostDelayedTask(FROM_HERE, shared_timer_task, |
| 502 interval); | 503 interval); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 524 // counter functions. | 525 // counter functions. |
| 525 void ChromiumBridge::initV8CounterFunction() { | 526 void ChromiumBridge::initV8CounterFunction() { |
| 526 v8::V8::SetCounterFunction(StatsTable::FindLocation); | 527 v8::V8::SetCounterFunction(StatsTable::FindLocation); |
| 527 } | 528 } |
| 528 #endif | 529 #endif |
| 529 | 530 |
| 530 // SystemTime ----------------------------------------------------------------- | 531 // SystemTime ----------------------------------------------------------------- |
| 531 // Called by SystemTimeChromium.cpp | 532 // Called by SystemTimeChromium.cpp |
| 532 | 533 |
| 533 double ChromiumBridge::currentTime() { | 534 double ChromiumBridge::currentTime() { |
| 534 // Get the current time in seconds since epoch. | 535 // TODO(mbelshe): This can be deleted; SystemTimeChromium does not need this |
| 536 // anymore. |
| 535 return base::Time::Now().ToDoubleT(); | 537 return base::Time::Now().ToDoubleT(); |
| 536 } | 538 } |
| 537 | 539 |
| 538 // Theming -------------------------------------------------------------------- | 540 // Theming -------------------------------------------------------------------- |
| 539 | 541 |
| 540 #if PLATFORM(WIN_OS) | 542 #if PLATFORM(WIN_OS) |
| 541 | 543 |
| 542 void ChromiumBridge::paintButton( | 544 void ChromiumBridge::paintButton( |
| 543 GraphicsContext* gc, int part, int state, int classic_state, | 545 GraphicsContext* gc, int part, int state, int classic_state, |
| 544 const IntRect& rect) { | 546 const IntRect& rect) { |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 703 chrome_client->SetCursor(WebCursor(cursor.impl())); | 705 chrome_client->SetCursor(WebCursor(cursor.impl())); |
| 704 } | 706 } |
| 705 | 707 |
| 706 void ChromiumBridge::widgetSetFocus(Widget* widget) { | 708 void ChromiumBridge::widgetSetFocus(Widget* widget) { |
| 707 ChromeClientImpl* chrome_client = ToChromeClient(widget); | 709 ChromeClientImpl* chrome_client = ToChromeClient(widget); |
| 708 if (chrome_client) | 710 if (chrome_client) |
| 709 chrome_client->focus(); | 711 chrome_client->focus(); |
| 710 } | 712 } |
| 711 | 713 |
| 712 } // namespace WebCore | 714 } // namespace WebCore |
| OLD | NEW |