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_PROGRESS_CONTROL_H_
6 #define PDF_PROGRESS_CONTROL_H_
11 #include "pdf/control.h"
12 #include "pdf/fading_control.h"
13 #include "ppapi/cpp/image_data.h"
15 namespace chrome_pdf
{
17 class ProgressControl
: public FadingControl
{
19 static const double kCompleted
;
21 enum ProgressEventIds
{
22 EVENT_ID_PROGRESS_COMPLETED
,
26 virtual ~ProgressControl();
27 virtual bool CreateProgressControl(uint32 id
,
29 Control::Owner
* delegate
,
32 const std::vector
<pp::ImageData
>& images
,
33 const pp::ImageData
& background
,
34 const std::string
& text
);
35 void Reconfigure(const pp::ImageData
& background
,
36 const std::vector
<pp::ImageData
>& images
,
39 static void CalculateLayout(pp::Instance
* instance
,
40 const std::vector
<pp::ImageData
>& images
,
41 const pp::ImageData
& background
,
42 const std::string
& text
,
49 virtual void Paint(pp::ImageData
* image_data
, const pp::Rect
& rc
);
51 // ProgressControl interface
52 // Set progress indicator in percents from 0% to 100%.
53 virtual void SetProgress(double progress
);
56 void PrepareBackground();
57 void AdjustBackground();
58 size_t GetImageIngex() const;
62 std::vector
<pp::ImageData
> images_
;
63 pp::ImageData background_
;
64 pp::ImageData ctrl_background_
;
70 } // namespace chrome_pdf
72 #endif // PDF_PROGRESS_CONTROL_H_