OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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/launcher/overflow_button.h" | 5 #include "ash/launcher/overflow_button.h" |
6 | 6 |
7 #include "ash/shelf/shelf_layout_manager.h" | 7 #include "ash/shelf/shelf_layout_manager.h" |
8 #include "grit/ash_resources.h" | 8 #include "grit/ash_resources.h" |
9 #include "grit/ash_strings.h" | 9 #include "grit/ash_strings.h" |
10 #include "third_party/skia/include/core/SkPaint.h" | 10 #include "third_party/skia/include/core/SkPaint.h" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 | 48 |
49 } // namesapce | 49 } // namesapce |
50 | 50 |
51 OverflowButton::OverflowButton(views::ButtonListener* listener) | 51 OverflowButton::OverflowButton(views::ButtonListener* listener) |
52 : CustomButton(listener), | 52 : CustomButton(listener), |
53 image_(NULL) { | 53 image_(NULL) { |
54 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 54 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
55 image_ = rb.GetImageNamed(IDR_AURA_LAUNCHER_OVERFLOW).ToImageSkia(); | 55 image_ = rb.GetImageNamed(IDR_AURA_LAUNCHER_OVERFLOW).ToImageSkia(); |
56 | 56 |
57 set_accessibility_focusable(true); | 57 set_accessibility_focusable(true); |
58 SetAccessibleName( | 58 SetAccessibleName(l10n_util::GetStringUTF16(IDS_ASH_SHELF_OVERFLOW_NAME)); |
59 l10n_util::GetStringUTF16(IDS_AURA_LAUNCHER_OVERFLOW_NAME)); | |
60 } | 59 } |
61 | 60 |
62 | 61 OverflowButton::~OverflowButton() {} |
63 OverflowButton::~OverflowButton() { | |
64 } | |
65 | 62 |
66 void OverflowButton::OnShelfAlignmentChanged() { | 63 void OverflowButton::OnShelfAlignmentChanged() { |
67 SchedulePaint(); | 64 SchedulePaint(); |
68 } | 65 } |
69 | 66 |
70 void OverflowButton::PaintBackground(gfx::Canvas* canvas, int alpha) { | 67 void OverflowButton::PaintBackground(gfx::Canvas* canvas, int alpha) { |
71 gfx::Rect bounds(GetContentsBounds()); | 68 gfx::Rect bounds(GetContentsBounds()); |
72 gfx::Rect rect(0, 0, kButtonHoverSize, kButtonHoverSize); | 69 gfx::Rect rect(0, 0, kButtonHoverSize, kButtonHoverSize); |
73 ShelfLayoutManager* shelf = | 70 ShelfLayoutManager* shelf = |
74 ShelfLayoutManager::ForLauncher(GetWidget()->GetNativeView()); | 71 ShelfLayoutManager::ForLauncher(GetWidget()->GetNativeView()); |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 } else { | 142 } else { |
146 canvas->DrawImageInt(*image_, | 143 canvas->DrawImageInt(*image_, |
147 kButtonHoverSize - image_->width(), | 144 kButtonHoverSize - image_->width(), |
148 rect.y() + (rect.height() - image_->height()) / 2); | 145 rect.y() + (rect.height() - image_->height()) / 2); |
149 } | 146 } |
150 canvas->Restore(); | 147 canvas->Restore(); |
151 } | 148 } |
152 | 149 |
153 } // namespace internal | 150 } // namespace internal |
154 } // namespace ash | 151 } // namespace ash |
OLD | NEW |