OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ui/app_list/views/progress_bar_view.h" | 5 #include "ui/app_list/views/progress_bar_view.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "grit/ui_resources.h" | 9 #include "grit/ui_resources.h" |
10 #include "ui/base/resource/resource_bundle.h" | 10 #include "ui/base/resource/resource_bundle.h" |
| 11 #include "ui/gfx/geometry/insets.h" |
11 #include "ui/gfx/image/image_skia.h" | 12 #include "ui/gfx/image/image_skia.h" |
12 #include "ui/gfx/insets.h" | |
13 #include "ui/views/painter.h" | 13 #include "ui/views/painter.h" |
14 | 14 |
15 namespace app_list { | 15 namespace app_list { |
16 | 16 |
17 namespace { | 17 namespace { |
18 | 18 |
19 // Image assets for the bar part. | 19 // Image assets for the bar part. |
20 const int kProgressBarImages[] = { | 20 const int kProgressBarImages[] = { |
21 IDR_APP_LIST_ITEM_PROGRESS_LEFT, | 21 IDR_APP_LIST_ITEM_PROGRESS_LEFT, |
22 IDR_APP_LIST_ITEM_PROGRESS_CENTER, | 22 IDR_APP_LIST_ITEM_PROGRESS_CENTER, |
(...skipping 30 matching lines...) Expand all Loading... |
53 const int bar_width = paint_size.width() - kBarEndWidth; | 53 const int bar_width = paint_size.width() - kBarEndWidth; |
54 DCHECK_GE(bar_width, 0); | 54 DCHECK_GE(bar_width, 0); |
55 | 55 |
56 // Map normalized value in [0,1] to the pixel width in | 56 // Map normalized value in [0,1] to the pixel width in |
57 // [kBarEndWidth, view_size.width()]. | 57 // [kBarEndWidth, view_size.width()]. |
58 paint_size.set_width(kBarEndWidth + bar_width * GetNormalizedValue()); | 58 paint_size.set_width(kBarEndWidth + bar_width * GetNormalizedValue()); |
59 bar_painter_->Paint(canvas, paint_size); | 59 bar_painter_->Paint(canvas, paint_size); |
60 } | 60 } |
61 | 61 |
62 } // namespace app_list | 62 } // namespace app_list |
OLD | NEW |