[osx] Whitelist NSException thrown by Cocoa on Yosemite.
[chromium-blink-merge.git] / pdf / page_indicator.h
blob0d06ee1a0b04701ff7c043db32c087e7c6a364bc
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_
8 #include <string>
9 #include <vector>
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 {
26 public:
27 PageIndicator();
28 virtual ~PageIndicator();
29 virtual bool CreatePageIndicator(
30 uint32 id,
31 bool visible,
32 Control::Owner* delegate,
33 NumberImageGenerator* number_image_generator,
34 bool always_visible);
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
46 // height.
47 int GetYPosition(
48 int vertical_scrollbar_y, int document_height, int plugin_height);
50 // Control interface.
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();
57 private:
58 void ResetFadeOutTimer();
60 int current_page_;
61 pp::ImageData background_;
62 NumberImageGenerator* number_image_generator_;
63 uint32 fade_out_timer_id_;
64 uint32 splash_timeout_;
65 uint32 fade_timeout_;
67 bool always_visible_;
70 } // namespace chrome_pdf
72 #endif // PDF_PAGE_INDICATOR_H_