summaryrefslogtreecommitdiffstats
path: root/webkit/child/webkitplatformsupport_child_impl.h
blob: 5ba71d822a410ee1991072fb1be15c73f76988c2 (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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
// // Copyright 2013 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.

#ifndef WEBKIT_CHILD_WEBKITPLATFORMSUPPORT_CHILD_IMPL_H_
#define WEBKIT_CHILD_WEBKITPLATFORMSUPPORT_CHILD_IMPL_H_

#include "base/threading/thread_local_storage.h"
#include "webkit/child/webfallbackthemeengine_impl.h"
#include "webkit/child/webkit_child_export.h"
#include "webkit/child/webkitplatformsupport_impl.h"

#if defined(USE_DEFAULT_RENDER_THEME)
#include "webkit/child/webthemeengine_impl_default.h"
#elif defined(OS_WIN)
#include "webkit/child/webthemeengine_impl_win.h"
#elif defined(OS_MACOSX)
#include "webkit/child/webthemeengine_impl_mac.h"
#elif defined(OS_ANDROID)
#include "webkit/child/webthemeengine_impl_android.h"
#endif

namespace webkit_glue {

class FlingCurveConfiguration;

class WEBKIT_CHILD_EXPORT WebKitPlatformSupportChildImpl :
    public WebKitPlatformSupportImpl {
 public:
  WebKitPlatformSupportChildImpl();
  virtual ~WebKitPlatformSupportChildImpl();

  // Platform methods (partial implementation):
  virtual WebKit::WebThemeEngine* themeEngine();
  virtual WebKit::WebFallbackThemeEngine* fallbackThemeEngine();

  void SetFlingCurveParameters(
    const std::vector<float>& new_touchpad,
    const std::vector<float>& new_touchscreen);

  virtual WebKit::WebGestureCurve* createFlingAnimationCurve(
      int device_source,
      const WebKit::WebFloatPoint& velocity,
      const WebKit::WebSize& cumulative_scroll) OVERRIDE;

  virtual WebKit::WebThread* createThread(const char* name);
  virtual WebKit::WebThread* currentThread();

  virtual void didStartWorkerRunLoop(
      const WebKit::WebWorkerRunLoop& runLoop) OVERRIDE;
  virtual void didStopWorkerRunLoop(
      const WebKit::WebWorkerRunLoop& runLoop) OVERRIDE;

  virtual WebKit::WebDiscardableMemory* allocateAndLockDiscardableMemory(
      size_t bytes);

 private:
  static void DestroyCurrentThread(void*);

  WebThemeEngineImpl native_theme_engine_;
  WebFallbackThemeEngineImpl fallback_theme_engine_;
  base::ThreadLocalStorage::Slot current_thread_slot_;
  scoped_ptr<FlingCurveConfiguration> fling_curve_configuration_;
};

}  // namespace webkit_glue

#endif  // WEBKIT_CHILD_WEBKITPLATFORMSUPPORT_CHILD_IMPL_H_