| 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/common/shelf/overflow_button.h" | 5 #include "ash/common/shelf/overflow_button.h" |
| 6 | 6 |
| 7 #include "ash/common/ash_constants.h" | 7 #include "ash/common/ash_constants.h" |
| 8 #include "ash/common/material_design/material_design_controller.h" | 8 #include "ash/common/material_design/material_design_controller.h" |
| 9 #include "ash/common/shelf/ink_drop_button_listener.h" | 9 #include "ash/common/shelf/ink_drop_button_listener.h" |
| 10 #include "ash/common/shelf/shelf_constants.h" | 10 #include "ash/common/shelf/shelf_constants.h" |
| 11 #include "ash/common/shelf/shelf_view.h" | 11 #include "ash/common/shelf/shelf_view.h" |
| 12 #include "ash/common/shelf/wm_shelf.h" | 12 #include "ash/common/shelf/wm_shelf.h" |
| 13 #include "ash/common/shelf/wm_shelf_util.h" | 13 #include "ash/common/shelf/wm_shelf_util.h" |
| 14 #include "ash/resources/vector_icons/vector_icons.h" |
| 14 #include "base/memory/ptr_util.h" | 15 #include "base/memory/ptr_util.h" |
| 15 #include "grit/ash_resources.h" | 16 #include "grit/ash_resources.h" |
| 16 #include "grit/ash_strings.h" | 17 #include "grit/ash_strings.h" |
| 17 #include "third_party/skia/include/core/SkPaint.h" | 18 #include "third_party/skia/include/core/SkPaint.h" |
| 18 #include "third_party/skia/include/core/SkPath.h" | 19 #include "third_party/skia/include/core/SkPath.h" |
| 19 #include "ui/base/l10n/l10n_util.h" | 20 #include "ui/base/l10n/l10n_util.h" |
| 20 #include "ui/base/resource/resource_bundle.h" | 21 #include "ui/base/resource/resource_bundle.h" |
| 21 #include "ui/gfx/canvas.h" | 22 #include "ui/gfx/canvas.h" |
| 22 #include "ui/gfx/image/image_skia_operations.h" | 23 #include "ui/gfx/image/image_skia_operations.h" |
| 23 #include "ui/gfx/paint_vector_icon.h" | 24 #include "ui/gfx/paint_vector_icon.h" |
| 24 #include "ui/gfx/skbitmap_operations.h" | 25 #include "ui/gfx/skbitmap_operations.h" |
| 25 #include "ui/gfx/skia_util.h" | 26 #include "ui/gfx/skia_util.h" |
| 26 #include "ui/gfx/transform.h" | 27 #include "ui/gfx/transform.h" |
| 27 #include "ui/gfx/vector_icons_public.h" | |
| 28 #include "ui/views/animation/flood_fill_ink_drop_ripple.h" | 28 #include "ui/views/animation/flood_fill_ink_drop_ripple.h" |
| 29 #include "ui/views/animation/ink_drop_impl.h" | 29 #include "ui/views/animation/ink_drop_impl.h" |
| 30 #include "ui/views/animation/ink_drop_mask.h" | 30 #include "ui/views/animation/ink_drop_mask.h" |
| 31 | 31 |
| 32 namespace ash { | 32 namespace ash { |
| 33 | 33 |
| 34 OverflowButton::OverflowButton(ShelfView* shelf_view, WmShelf* wm_shelf) | 34 OverflowButton::OverflowButton(ShelfView* shelf_view, WmShelf* wm_shelf) |
| 35 : CustomButton(nullptr), | 35 : CustomButton(nullptr), |
| 36 bottom_image_(nullptr), | 36 bottom_image_(nullptr), |
| 37 shelf_view_(shelf_view), | 37 shelf_view_(shelf_view), |
| 38 wm_shelf_(wm_shelf), | 38 wm_shelf_(wm_shelf), |
| 39 background_alpha_(0) { | 39 background_alpha_(0) { |
| 40 DCHECK(shelf_view_); | 40 DCHECK(shelf_view_); |
| 41 if (MaterialDesignController::IsShelfMaterial()) { | 41 if (MaterialDesignController::IsShelfMaterial()) { |
| 42 SetInkDropMode(InkDropMode::ON); | 42 SetInkDropMode(InkDropMode::ON); |
| 43 set_ink_drop_base_color(kShelfInkDropBaseColor); | 43 set_ink_drop_base_color(kShelfInkDropBaseColor); |
| 44 set_ink_drop_visible_opacity(kShelfInkDropVisibleOpacity); | 44 set_ink_drop_visible_opacity(kShelfInkDropVisibleOpacity); |
| 45 set_hide_ink_drop_when_showing_context_menu(false); | 45 set_hide_ink_drop_when_showing_context_menu(false); |
| 46 bottom_image_md_ = | 46 bottom_image_md_ = CreateVectorIcon(kShelfOverflowIcon, kShelfIconColor); |
| 47 CreateVectorIcon(gfx::VectorIconId::SHELF_OVERFLOW, kShelfIconColor); | |
| 48 bottom_image_ = &bottom_image_md_; | 47 bottom_image_ = &bottom_image_md_; |
| 49 } else { | 48 } else { |
| 50 bottom_image_ = ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( | 49 bottom_image_ = ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( |
| 51 IDR_ASH_SHELF_OVERFLOW); | 50 IDR_ASH_SHELF_OVERFLOW); |
| 52 } | 51 } |
| 53 | 52 |
| 54 SetFocusBehavior(FocusBehavior::ACCESSIBLE_ONLY); | 53 SetFocusBehavior(FocusBehavior::ACCESSIBLE_ONLY); |
| 55 SetAccessibleName(l10n_util::GetStringUTF16(IDS_ASH_SHELF_OVERFLOW_NAME)); | 54 SetAccessibleName(l10n_util::GetStringUTF16(IDS_ASH_SHELF_OVERFLOW_NAME)); |
| 56 } | 55 } |
| 57 | 56 |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 bounds = | 198 bounds = |
| 200 gfx::Rect(bounds.x() + (bounds.width() - background->width()) / 2, | 199 gfx::Rect(bounds.x() + (bounds.width() - background->width()) / 2, |
| 201 bounds.y() + kShelfItemInset, background->width(), | 200 bounds.y() + kShelfItemInset, background->width(), |
| 202 background->height()); | 201 background->height()); |
| 203 } | 202 } |
| 204 } | 203 } |
| 205 return bounds; | 204 return bounds; |
| 206 } | 205 } |
| 207 | 206 |
| 208 } // namespace ash | 207 } // namespace ash |
| OLD | NEW |