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 "ash/shelf/overflow_button.h" | 5 #include "ash/shelf/overflow_button.h" |
6 | 6 |
7 #include "ash/ash_constants.h" | |
7 #include "ash/ash_switches.h" | 8 #include "ash/ash_switches.h" |
8 #include "ash/common/material_design/material_design_controller.h" | 9 #include "ash/common/material_design/material_design_controller.h" |
9 #include "ash/common/shelf/shelf_constants.h" | 10 #include "ash/common/shelf/shelf_constants.h" |
10 #include "ash/shelf/shelf.h" | 11 #include "ash/shelf/shelf.h" |
11 #include "ash/shelf/shelf_layout_manager.h" | 12 #include "ash/shelf/shelf_layout_manager.h" |
12 #include "ash/shelf/shelf_widget.h" | 13 #include "ash/shelf/shelf_widget.h" |
13 #include "grit/ash_resources.h" | 14 #include "grit/ash_resources.h" |
14 #include "grit/ash_strings.h" | 15 #include "grit/ash_strings.h" |
15 #include "third_party/skia/include/core/SkPaint.h" | 16 #include "third_party/skia/include/core/SkPaint.h" |
16 #include "third_party/skia/include/core/SkPath.h" | 17 #include "third_party/skia/include/core/SkPath.h" |
17 #include "ui/base/l10n/l10n_util.h" | 18 #include "ui/base/l10n/l10n_util.h" |
18 #include "ui/base/resource/resource_bundle.h" | 19 #include "ui/base/resource/resource_bundle.h" |
19 #include "ui/gfx/animation/throb_animation.h" | 20 #include "ui/gfx/animation/throb_animation.h" |
20 #include "ui/gfx/canvas.h" | 21 #include "ui/gfx/canvas.h" |
21 #include "ui/gfx/image/image_skia_operations.h" | 22 #include "ui/gfx/image/image_skia_operations.h" |
23 #include "ui/gfx/paint_vector_icon.h" | |
22 #include "ui/gfx/skbitmap_operations.h" | 24 #include "ui/gfx/skbitmap_operations.h" |
23 #include "ui/gfx/skia_util.h" | 25 #include "ui/gfx/skia_util.h" |
24 #include "ui/gfx/transform.h" | 26 #include "ui/gfx/transform.h" |
27 #include "ui/gfx/vector_icons_public.h" | |
25 #include "ui/views/widget/widget.h" | 28 #include "ui/views/widget/widget.h" |
26 | 29 |
27 namespace ash { | 30 namespace ash { |
28 | 31 |
29 OverflowButton::OverflowButton(views::ButtonListener* listener, Shelf* shelf) | 32 OverflowButton::OverflowButton(views::ButtonListener* listener, Shelf* shelf) |
30 : CustomButton(listener), bottom_image_(nullptr), shelf_(shelf) { | 33 : CustomButton(listener), bottom_image_(nullptr), shelf_(shelf) { |
31 ui::ResourceBundle* rb = &ui::ResourceBundle::GetSharedInstance(); | 34 ui::ResourceBundle* rb = &ui::ResourceBundle::GetSharedInstance(); |
32 bottom_image_ = rb->GetImageNamed(IDR_ASH_SHELF_OVERFLOW).ToImageSkia(); | 35 bottom_image_md_ = |
James Cook
2016/06/09 19:24:48
I would only load the icon when MD is enabled.
tdanderson
2016/06/09 22:36:33
Done.
| |
36 CreateVectorIcon(gfx::VectorIconId::SHELF_OVERFLOW, kShelfIconColor); | |
37 bottom_image_ = MaterialDesignController::IsShelfMaterial() | |
38 ? &bottom_image_md_ | |
39 : rb->GetImageNamed(IDR_ASH_SHELF_OVERFLOW).ToImageSkia(); | |
33 | 40 |
34 SetFocusBehavior(FocusBehavior::ACCESSIBLE_ONLY); | 41 SetFocusBehavior(FocusBehavior::ACCESSIBLE_ONLY); |
35 SetAccessibleName(l10n_util::GetStringUTF16(IDS_ASH_SHELF_OVERFLOW_NAME)); | 42 SetAccessibleName(l10n_util::GetStringUTF16(IDS_ASH_SHELF_OVERFLOW_NAME)); |
36 } | 43 } |
37 | 44 |
38 OverflowButton::~OverflowButton() {} | 45 OverflowButton::~OverflowButton() {} |
39 | 46 |
40 void OverflowButton::OnShelfAlignmentChanged() { | 47 void OverflowButton::OnShelfAlignmentChanged() { |
41 SchedulePaint(); | 48 SchedulePaint(); |
42 } | 49 } |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
138 bounds.x() + (bounds.width() - background->width()) / 2, | 145 bounds.x() + (bounds.width() - background->width()) / 2, |
139 bounds.y() + ShelfLayoutManager::kShelfItemInset, | 146 bounds.y() + ShelfLayoutManager::kShelfItemInset, |
140 background->width(), background->height()); | 147 background->width(), background->height()); |
141 } | 148 } |
142 } | 149 } |
143 | 150 |
144 return bounds; | 151 return bounds; |
145 } | 152 } |
146 | 153 |
147 } // namespace ash | 154 } // namespace ash |
OLD | NEW |