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_PAGE_INDICATOR_H_
6 #define PDF_PAGE_INDICATOR_H_
11 #include "pdf/control.h"
12 #include "pdf/fading_control.h"
13 #include "ppapi/cpp/image_data.h"
14 #include "ppapi/cpp/point.h"
15 #include "ppapi/cpp/rect.h"
17 namespace chrome_pdf
{
19 class NumberImageGenerator
;
21 const uint32 kPageIndicatorScrollFadeTimeoutMs
= 240;
22 const uint32 kPageIndicatorInitialFadeTimeoutMs
= 960;
23 const uint32 kPageIndicatorSplashTimeoutMs
= 2000;
25 class PageIndicator
: public FadingControl
{
28 virtual ~PageIndicator();
29 virtual bool CreatePageIndicator(
32 Control::Owner
* delegate
,
33 NumberImageGenerator
* number_image_generator
,
36 void Configure(const pp::Point
& origin
, const pp::ImageData
& background
);
38 int current_page() const { return current_page_
; }
39 void set_current_page(int current_page
);
41 virtual void Splash();
42 void Splash(uint32 splash_timeout
, uint32 page_timeout
);
44 // Returns the y position where the page indicator should be drawn given the
45 // position of the scrollbar and the total document height and the plugin
48 int vertical_scrollbar_y
, int document_height
, int plugin_height
);
51 virtual void Paint(pp::ImageData
* image_data
, const pp::Rect
& rc
);
52 virtual void OnTimerFired(uint32 timer_id
);
54 // FadingControl interface.
55 virtual void OnFadeInComplete();
58 void ResetFadeOutTimer();
61 pp::ImageData background_
;
62 NumberImageGenerator
* number_image_generator_
;
63 uint32 fade_out_timer_id_
;
64 uint32 splash_timeout_
;
70 } // namespace chrome_pdf
72 #endif // PDF_PAGE_INDICATOR_H_