ProfileManager doesn't depend on "--login-profile" switch.
[chromium-blink-merge.git] / pdf / thumbnail_control.h
blobd10a32896d6f580fa090db4134861b5d34945c1b
1 // Copyright (c) 2010 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_THUMBNAIL_CONTROL_H_
6 #define PDF_THUMBNAIL_CONTROL_H_
8 #include <map>
9 #include <vector>
11 #include "pdf/control.h"
12 #include "pdf/pdf_engine.h"
13 #include "ppapi/cpp/input_event.h"
15 namespace chrome_pdf {
17 class NumberImageGenerator;
19 class ThumbnailControl : public Control {
20 public:
21 enum ThumbnailEventIds {
22 EVENT_ID_THUMBNAIL_SELECTED = 100,
25 explicit ThumbnailControl();
26 virtual ~ThumbnailControl();
28 // Sets current position of the thumnail control.
29 void SetPosition(int position, int total, bool invalidate);
30 void SlideIn();
31 void SlideOut();
33 virtual bool CreateThumbnailControl(
34 uint32 id, const pp::Rect& rc,
35 bool visible, Owner* owner, PDFEngine* engine,
36 NumberImageGenerator* number_image_generator);
38 // Control interface.
39 virtual void Show(bool visible, bool invalidate);
40 virtual void Paint(pp::ImageData* image_data, const pp::Rect& rc);
41 virtual bool HandleEvent(const pp::InputEvent& event);
42 virtual void OnTimerFired(uint32 timer_id);
44 virtual void ResetEngine(PDFEngine* engine);
46 private:
47 void ClearCache();
49 struct PageInfo {
50 int index;
51 pp::Rect rect;
54 PDFEngine* engine_;
55 pp::Rect visible_rect_;
56 std::vector<PageInfo> visible_pages_;
57 std::map<int, pp::ImageData*> image_cache_;
58 int sliding_width_;
59 int sliding_shift_;
60 int sliding_timeout_;
61 uint32 sliding_timer_id_;
62 NumberImageGenerator* number_image_generator_;
65 } // namespace chrome_pdf
67 #endif // PDF_THUMBNAIL_CONTROL_H_