| 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/common/system/tray/tray_background_view.h" | 5 #include "ash/common/system/tray/tray_background_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "ash/common/ash_constants.h" |
| 9 #include "ash/common/material_design/material_design_controller.h" | 10 #include "ash/common/material_design/material_design_controller.h" |
| 10 #include "ash/common/shelf/shelf_constants.h" | 11 #include "ash/common/shelf/shelf_constants.h" |
| 11 #include "ash/common/shelf/wm_shelf.h" | 12 #include "ash/common/shelf/wm_shelf.h" |
| 12 #include "ash/common/shelf/wm_shelf_util.h" | 13 #include "ash/common/shelf/wm_shelf_util.h" |
| 13 #include "ash/common/system/status_area_widget.h" | 14 #include "ash/common/system/status_area_widget.h" |
| 14 #include "ash/common/system/tray/system_tray.h" | 15 #include "ash/common/system/tray/system_tray.h" |
| 15 #include "ash/common/system/tray/tray_constants.h" | 16 #include "ash/common/system/tray/tray_constants.h" |
| 16 #include "ash/common/system/tray/tray_event_filter.h" | 17 #include "ash/common/system/tray/tray_event_filter.h" |
| 17 #include "ash/common/wm_lookup.h" | 18 #include "ash/common/wm_lookup.h" |
| 18 #include "ash/common/wm_shell.h" | 19 #include "ash/common/wm_shell.h" |
| (...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 560 ActionableView::HandlePerformActionResult(action_performed, event); | 561 ActionableView::HandlePerformActionResult(action_performed, event); |
| 561 } | 562 } |
| 562 | 563 |
| 563 gfx::Rect TrayBackgroundView::GetFocusBounds() { | 564 gfx::Rect TrayBackgroundView::GetFocusBounds() { |
| 564 // The tray itself expands to the right and bottom edge of the screen to make | 565 // The tray itself expands to the right and bottom edge of the screen to make |
| 565 // sure clicking on the edges brings up the popup. However, the focus border | 566 // sure clicking on the edges brings up the popup. However, the focus border |
| 566 // should be only around the container. | 567 // should be only around the container. |
| 567 return GetContentsBounds(); | 568 return GetContentsBounds(); |
| 568 } | 569 } |
| 569 | 570 |
| 571 void TrayBackgroundView::OnPaintFocus(gfx::Canvas* canvas) { |
| 572 gfx::Rect paint_bounds(GetFocusBounds()); |
| 573 paint_bounds.Inset(2, -2, 3, -2); |
| 574 canvas->DrawSolidFocusRect(paint_bounds, kFocusBorderColor); |
| 575 } |
| 576 |
| 570 void TrayBackgroundView::OnPaint(gfx::Canvas* canvas) { | 577 void TrayBackgroundView::OnPaint(gfx::Canvas* canvas) { |
| 571 ActionableView::OnPaint(canvas); | 578 ActionableView::OnPaint(canvas); |
| 572 if (!MaterialDesignController::IsShelfMaterial() || | 579 if (!MaterialDesignController::IsShelfMaterial() || |
| 573 shelf()->GetBackgroundType() == | 580 shelf()->GetBackgroundType() == |
| 574 ShelfBackgroundType::SHELF_BACKGROUND_DEFAULT || | 581 ShelfBackgroundType::SHELF_BACKGROUND_DEFAULT || |
| 575 !is_separator_visible_) { | 582 !is_separator_visible_) { |
| 576 return; | 583 return; |
| 577 } | 584 } |
| 578 // In the given |canvas|, draws a 1x32px separator line 4 pixel to the right | 585 // In the given |canvas|, draws a 1x32px separator line 4 pixel to the right |
| 579 // of the TrayBackgroundView. | 586 // of the TrayBackgroundView. |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 622 // TODO(mohsen): Remove this extra size when resize is handled properly (see | 629 // TODO(mohsen): Remove this extra size when resize is handled properly (see |
| 623 // https://crbug.com/666175). | 630 // https://crbug.com/666175). |
| 624 const int icon_size = | 631 const int icon_size = |
| 625 kTrayIconSize + 2 * GetTrayConstant(TRAY_IMAGE_ITEM_PADDING); | 632 kTrayIconSize + 2 * GetTrayConstant(TRAY_IMAGE_ITEM_PADDING); |
| 626 bounds.set_width(bounds.width() + 2 * icon_size); | 633 bounds.set_width(bounds.width() + 2 * icon_size); |
| 627 bounds.set_height(bounds.height() + 2 * icon_size); | 634 bounds.set_height(bounds.height() + 2 * icon_size); |
| 628 return bounds; | 635 return bounds; |
| 629 } | 636 } |
| 630 | 637 |
| 631 } // namespace ash | 638 } // namespace ash |
| OLD | NEW |