| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/app_list_button.h" | 5 #include "ash/common/shelf/app_list_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_item_types.h" | 11 #include "ash/common/shelf/shelf_item_types.h" |
| 12 #include "ash/common/shelf/shelf_view.h" | 12 #include "ash/common/shelf/shelf_view.h" |
| 13 #include "ash/common/shelf/wm_shelf.h" | 13 #include "ash/common/shelf/wm_shelf.h" |
| 14 #include "ash/common/shelf/wm_shelf_util.h" | 14 #include "ash/common/shelf/wm_shelf_util.h" |
| 15 #include "ash/common/system/tray/tray_popup_utils.h" |
| 15 #include "ash/common/wm_shell.h" | 16 #include "ash/common/wm_shell.h" |
| 16 #include "ash/public/cpp/shelf_types.h" | 17 #include "ash/public/cpp/shelf_types.h" |
| 17 #include "base/command_line.h" | 18 #include "base/command_line.h" |
| 18 #include "grit/ash_resources.h" | 19 #include "grit/ash_resources.h" |
| 19 #include "grit/ash_strings.h" | 20 #include "grit/ash_strings.h" |
| 20 #include "ui/accessibility/ax_node_data.h" | 21 #include "ui/accessibility/ax_node_data.h" |
| 21 #include "ui/app_list/app_list_switches.h" | 22 #include "ui/app_list/app_list_switches.h" |
| 22 #include "ui/base/l10n/l10n_util.h" | 23 #include "ui/base/l10n/l10n_util.h" |
| 23 #include "ui/base/resource/resource_bundle.h" | 24 #include "ui/base/resource/resource_bundle.h" |
| 24 #include "ui/gfx/canvas.h" | 25 #include "ui/gfx/canvas.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 43 DCHECK(wm_shelf_); | 44 DCHECK(wm_shelf_); |
| 44 if (ash::MaterialDesignController::IsShelfMaterial()) { | 45 if (ash::MaterialDesignController::IsShelfMaterial()) { |
| 45 SetInkDropMode(InkDropMode::ON_NO_GESTURE_HANDLER); | 46 SetInkDropMode(InkDropMode::ON_NO_GESTURE_HANDLER); |
| 46 set_ink_drop_base_color(kShelfInkDropBaseColor); | 47 set_ink_drop_base_color(kShelfInkDropBaseColor); |
| 47 set_ink_drop_visible_opacity(kShelfInkDropVisibleOpacity); | 48 set_ink_drop_visible_opacity(kShelfInkDropVisibleOpacity); |
| 48 } | 49 } |
| 49 SetAccessibleName( | 50 SetAccessibleName( |
| 50 l10n_util::GetStringUTF16(IDS_ASH_SHELF_APP_LIST_LAUNCHER_TITLE)); | 51 l10n_util::GetStringUTF16(IDS_ASH_SHELF_APP_LIST_LAUNCHER_TITLE)); |
| 51 SetSize( | 52 SetSize( |
| 52 gfx::Size(GetShelfConstant(SHELF_SIZE), GetShelfConstant(SHELF_SIZE))); | 53 gfx::Size(GetShelfConstant(SHELF_SIZE), GetShelfConstant(SHELF_SIZE))); |
| 53 SetFocusPainter(views::Painter::CreateSolidFocusPainter( | 54 SetFocusPainter(TrayPopupUtils::CreateFocusPainter()); |
| 54 kFocusBorderColor, gfx::Insets(1, 1, 1, 1))); | |
| 55 set_notify_action(CustomButton::NOTIFY_ON_PRESS); | 55 set_notify_action(CustomButton::NOTIFY_ON_PRESS); |
| 56 } | 56 } |
| 57 | 57 |
| 58 AppListButton::~AppListButton() {} | 58 AppListButton::~AppListButton() {} |
| 59 | 59 |
| 60 void AppListButton::OnAppListShown() { | 60 void AppListButton::OnAppListShown() { |
| 61 if (ash::MaterialDesignController::IsShelfMaterial()) | 61 if (ash::MaterialDesignController::IsShelfMaterial()) |
| 62 AnimateInkDrop(views::InkDropState::ACTIVATED, nullptr); | 62 AnimateInkDrop(views::InkDropState::ACTIVATED, nullptr); |
| 63 else | 63 else |
| 64 SchedulePaint(); | 64 SchedulePaint(); |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 int center = std::max(width(), height()) / 2.f; | 290 int center = std::max(width(), height()) / 2.f; |
| 291 gfx::Point centroid(center, center); | 291 gfx::Point centroid(center, center); |
| 292 // For the left shelf alignment, we need to right-justify. For other shelf | 292 // For the left shelf alignment, we need to right-justify. For other shelf |
| 293 // alignments, left/top justification (i.e. no adjustments are necessary). | 293 // alignments, left/top justification (i.e. no adjustments are necessary). |
| 294 if (SHELF_ALIGNMENT_LEFT == wm_shelf_->GetAlignment()) | 294 if (SHELF_ALIGNMENT_LEFT == wm_shelf_->GetAlignment()) |
| 295 centroid.set_x(width() - center); | 295 centroid.set_x(width() - center); |
| 296 return centroid; | 296 return centroid; |
| 297 } | 297 } |
| 298 | 298 |
| 299 } // namespace ash | 299 } // namespace ash |
| OLD | NEW |