[DevTools] Reenable some DevTools tests, which should be fixed on blink side.
[chromium-blink-merge.git] / pdf / control.h
blobbabb37a2c0dcf94110259973bccc66ddd1df2d7b
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef PDF_CONTROL_H_
6 #define PDF_CONTROL_H_
8 #include <list>
10 #include "base/basictypes.h"
11 #include "ppapi/c/dev/pp_cursor_type_dev.h"
12 #include "ppapi/cpp/rect.h"
14 namespace pp {
15 class ImageData;
16 class InputEvent;
17 class Instance;
20 namespace chrome_pdf {
22 const uint32 kInvalidControlId = 0;
24 class Control {
25 public:
26 class Owner {
27 public:
28 virtual ~Owner() {}
29 virtual void OnEvent(uint32 control_id, uint32 event_id, void* data) = 0;
30 virtual void Invalidate(uint32 control_id, const pp::Rect& rc) = 0;
31 virtual uint32 ScheduleTimer(uint32 control_id, uint32 timeout_ms) = 0;
32 virtual void SetEventCapture(uint32 control_id, bool set_capture) = 0;
33 virtual void SetCursor(uint32 control_id,
34 PP_CursorType_Dev cursor_type) = 0;
35 virtual pp::Instance* GetInstance() = 0;
38 Control();
39 virtual ~Control();
40 virtual bool Create(uint32 id, const pp::Rect& rc,
41 bool visible, Owner* owner);
43 virtual void Paint(pp::ImageData* image_data, const pp::Rect& rc) {}
44 virtual bool HandleEvent(const pp::InputEvent& event);
45 virtual void OnTimerFired(uint32 timer_id) {}
46 virtual void EventCaptureReleased() {}
48 // Paint control into multiple destination rects.
49 virtual void PaintMultipleRects(pp::ImageData* image_data,
50 const std::list<pp::Rect>& rects);
52 virtual void Show(bool visible, bool invalidate);
53 virtual void AdjustTransparency(uint8 transparency, bool invalidate);
54 virtual void MoveBy(const pp::Point& offset, bool invalidate);
55 virtual void SetRect(const pp::Rect& rc, bool invalidate);
57 void MoveTo(const pp::Point& origin, bool invalidate);
59 uint32 id() const { return id_; }
60 const pp::Rect& rect() const { return rc_; }
61 bool visible() const { return visible_; }
62 Owner* owner() { return owner_; }
63 uint8 transparency() const { return transparency_; }
65 private:
66 uint32 id_;
67 pp::Rect rc_;
68 bool visible_;
69 Owner* owner_;
70 uint8 transparency_;
73 typedef Control::Owner ControlOwner;
75 } // namespace chrome_pdf
77 #endif // PDF_CONTROL_H_