diff options
author | darin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-28 01:13:47 +0000 |
---|---|---|
committer | darin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-28 01:13:47 +0000 |
commit | 90a3fbb1723ba60bcf557121b7bbe80817a7533f (patch) | |
tree | 28d845ed0f1d64cdfa418f4561af4536de6f3c40 /webkit/glue/chromium_bridge_impl.cc | |
parent | 41fb1d7d262e44d8561a5c4d6d7e353f638b56e8 (diff) | |
download | chromium_src-90a3fbb1723ba60bcf557121b7bbe80817a7533f.zip chromium_src-90a3fbb1723ba60bcf557121b7bbe80817a7533f.tar.gz chromium_src-90a3fbb1723ba60bcf557121b7bbe80817a7533f.tar.bz2 |
Chrome side to pick up new WebKit API changes.
WebKit API now provides:
- layoutTestMode
- support for registering extra local URL schemes
- access to the current WebKitClient
WebKitClient was extended to include:
- access to the default locale
- access to the current time
- methods to start/stop the shared timer
- method to get work scheduled on the main thread
- methods to access cookies
- method to prefetch hostnames
R=dglazkov
Review URL: http://codereview.chromium.org/27276
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@10665 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue/chromium_bridge_impl.cc')
-rw-r--r-- | webkit/glue/chromium_bridge_impl.cc | 106 |
1 files changed, 3 insertions, 103 deletions
diff --git a/webkit/glue/chromium_bridge_impl.cc b/webkit/glue/chromium_bridge_impl.cc index 8c701a4..3af3a53 100644 --- a/webkit/glue/chromium_bridge_impl.cc +++ b/webkit/glue/chromium_bridge_impl.cc @@ -25,6 +25,8 @@ #include "Widget.h" #include <wtf/CurrentTime.h> +#include "WebKit.h" + #undef LOG #include "base/file_util.h" #include "base/message_loop.h" @@ -93,28 +95,6 @@ ChromeClientImpl* ToChromeClient(WebCore::Widget* widget) { namespace WebCore { -// Cookies -------------------------------------------------------------------- - -void ChromiumBridge::setCookies( - const KURL& url, const KURL& policy_url, const String& cookie) { - webkit_glue::SetCookie( - webkit_glue::KURLToGURL(url), - webkit_glue::KURLToGURL(policy_url), - webkit_glue::StringToStdString(cookie)); -} - -String ChromiumBridge::cookies(const KURL& url, const KURL& policy_url) { - return webkit_glue::StdStringToString(webkit_glue::GetCookies( - webkit_glue::KURLToGURL(url), - webkit_glue::KURLToGURL(policy_url))); -} - -// DNS ------------------------------------------------------------------------ - -void ChromiumBridge::prefetchDNS(const String& hostname) { - webkit_glue::PrefetchDns(webkit_glue::StringToStdString(hostname)); -} - // Font ----------------------------------------------------------------------- #if defined(OS_WIN) @@ -129,18 +109,6 @@ void ChromiumBridge::notifyJSOutOfMemory(Frame* frame) { webkit_glue::NotifyJSOutOfMemory(frame); } -// Language ------------------------------------------------------------------- - -String ChromiumBridge::computedDefaultLanguage() { - return webkit_glue::StdWStringToString(webkit_glue::GetWebKitLocale()); -} - -// LayoutTestMode ------------------------------------------------------------- - -bool ChromiumBridge::layoutTestMode() { - return webkit_glue::IsLayoutTestMode(); -} - // Plugin --------------------------------------------------------------------- bool ChromiumBridge::plugins(bool refresh, Vector<PluginInfo*>* results) { @@ -231,7 +199,7 @@ PassRefPtr<Image> ChromiumBridge::loadPlatformImageResource(const char* name) { } else if (!strcmp(name, "linuxRadioOn")) { resource_id = IDR_LINUX_RADIO_ON; } else if (!strcmp(name, "deleteButton")) { - if (webkit_glue::IsLayoutTestMode()) { + if (WebKit::layoutTestMode()) { RefPtr<Image> image = BitmapImage::create(); // Create a red 30x30 square used only in layout tests. const char red_square[] = @@ -289,65 +257,6 @@ IntRect ChromiumBridge::screenAvailableRect(Widget* widget) { webkit_glue::GetScreenInfo(ToNativeId(widget)).available_rect); } -// SharedTimers ---------------------------------------------------------------- -// Called by SharedTimerChromium.cpp - -class SharedTimerTask; - -// We maintain a single active timer and a single active task for -// setting timers directly on the platform. -static SharedTimerTask* shared_timer_task; -static void (*shared_timer_function)(); - -// Timer task to run in the chrome message loop. -class SharedTimerTask : public Task { - public: - SharedTimerTask(void (*callback)()) : callback_(callback) {} - - virtual void Run() { - if (!callback_) - return; - // Since we only have one task running at a time, verify 'this' is it - DCHECK(shared_timer_task == this); - shared_timer_task = NULL; - callback_(); - } - - void Cancel() { - callback_ = NULL; - } - - private: - void (*callback_)(); - DISALLOW_COPY_AND_ASSIGN(SharedTimerTask); -}; - -void ChromiumBridge::setSharedTimerFiredFunction(void (*func)()) { - shared_timer_function = func; -} - -void ChromiumBridge::setSharedTimerFireTime(double fire_time) { - DCHECK(shared_timer_function); - int interval = static_cast<int>((fire_time - WTF::currentTime()) * 1000); - if (interval < 0) - interval = 0; - - stopSharedTimer(); - - // Verify that we didn't leak the task or timer objects. - DCHECK(shared_timer_task == NULL); - shared_timer_task = new SharedTimerTask(shared_timer_function); - MessageLoop::current()->PostDelayedTask(FROM_HERE, shared_timer_task, - interval); -} - -void ChromiumBridge::stopSharedTimer() { - if (!shared_timer_task) - return; - shared_timer_task->Cancel(); - shared_timer_task = NULL; -} - // StatsCounters -------------------------------------------------------------- void ChromiumBridge::decrementStatsCounter(const char* name) { @@ -366,15 +275,6 @@ void ChromiumBridge::initV8CounterFunction() { } #endif -// SystemTime ----------------------------------------------------------------- -// Called by SystemTimeChromium.cpp - -double ChromiumBridge::currentTime() { - // TODO(mbelshe): This can be deleted; SystemTimeChromium does not need this - // anymore. - return base::Time::Now().ToDoubleT(); -} - // Theming -------------------------------------------------------------------- #if PLATFORM(WIN_OS) |