blob: e726a6c3dc425f03bd5341c70b38e7c73d278202 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
// Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this
// source code is governed by a BSD-style license that can be found in the
// LICENSE file.
#include "webkit/glue/webkitclient_impl.h"
#include "base/message_loop.h"
namespace webkit_glue {
WebKitClientImpl::WebKitClientImpl()
: main_loop_(MessageLoop::current()),
shared_timer_func_(NULL) {
}
WebKit::WebClipboard* WebKitClientImpl::clipboard() {
return &clipboard_;
}
double WebKitClientImpl::currentTime() {
return base::Time::Now().ToDoubleT();
}
void WebKitClientImpl::setSharedTimerFiredFunction(void (*func)()) {
shared_timer_func_ = func;
}
void WebKitClientImpl::setSharedTimerFireTime(double fire_time) {
int interval = static_cast<int>((fire_time - currentTime()) * 1000);
if (interval < 0)
interval = 0;
shared_timer_.Stop();
shared_timer_.Start(base::TimeDelta::FromMilliseconds(interval), this,
&WebKitClientImpl::DoTimeout);
}
void WebKitClientImpl::stopSharedTimer() {
shared_timer_.Stop();
}
void WebKitClientImpl::callOnMainThread(void (*func)()) {
main_loop_->PostTask(FROM_HERE, NewRunnableFunction(func));
}
} // namespace webkit_glue
|