| 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 "chrome/browser/chromeos/ui/focus_ring_layer.h" | 5 #include "chrome/browser/chromeos/ui/focus_ring_layer.h" |
| 6 | 6 |
| 7 #include "ash/system/tray/actionable_view.h" | 7 #include "ash/system/tray/actionable_view.h" |
| 8 #include "ash/system/tray/tray_background_view.h" | 8 #include "ash/system/tray/tray_background_view.h" |
| 9 #include "ash/system/tray/tray_popup_header_button.h" | 9 #include "ash/system/tray/tray_popup_header_button.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 gfx::Rect view_bounds = view->GetContentsBounds(); | 75 gfx::Rect view_bounds = view->GetContentsBounds(); |
| 76 | 76 |
| 77 // Workarounds that attempts to pick a better bounds. | 77 // Workarounds that attempts to pick a better bounds. |
| 78 if (view->GetClassName() == views::LabelButton::kViewClassName) { | 78 if (view->GetClassName() == views::LabelButton::kViewClassName) { |
| 79 view_bounds = view->GetLocalBounds(); | 79 view_bounds = view->GetLocalBounds(); |
| 80 view_bounds.Inset(2, 2, 2, 2); | 80 view_bounds.Inset(2, 2, 2, 2); |
| 81 } | 81 } |
| 82 | 82 |
| 83 // Workarounds for system tray items that have customized focus borders. The | 83 // Workarounds for system tray items that have customized focus borders. The |
| 84 // insets here must be consistent with the ones used by those classes. | 84 // insets here must be consistent with the ones used by those classes. |
| 85 if (view->GetClassName() == | 85 if (view->GetClassName() == ash::ActionableView::kViewClassName) { |
| 86 ash::internal::ActionableView::kViewClassName) { | |
| 87 view_bounds = view->GetLocalBounds(); | 86 view_bounds = view->GetLocalBounds(); |
| 88 view_bounds.Inset(1, 1, 3, 3); | 87 view_bounds.Inset(1, 1, 3, 3); |
| 89 } else if (view->GetClassName() == | 88 } else if (view->GetClassName() == ash::TrayBackgroundView::kViewClassName) { |
| 90 ash::internal::TrayBackgroundView::kViewClassName) { | |
| 91 view_bounds.Inset(1, 1, 3, 3); | 89 view_bounds.Inset(1, 1, 3, 3); |
| 92 } else if (view->GetClassName() == | 90 } else if (view->GetClassName() == |
| 93 ash::internal::TrayPopupHeaderButton::kViewClassName) { | 91 ash::TrayPopupHeaderButton::kViewClassName) { |
| 94 view_bounds = view->GetLocalBounds(); | 92 view_bounds = view->GetLocalBounds(); |
| 95 view_bounds.Inset(2, 1, 2, 2); | 93 view_bounds.Inset(2, 1, 2, 2); |
| 96 } | 94 } |
| 97 | 95 |
| 98 focus_ring_ = view->ConvertRectToWidget(view_bounds); | 96 focus_ring_ = view->ConvertRectToWidget(view_bounds); |
| 99 Update(); | 97 Update(); |
| 100 } | 98 } |
| 101 | 99 |
| 102 void FocusRingLayer::OnPaintLayer(gfx::Canvas* canvas) { | 100 void FocusRingLayer::OnPaintLayer(gfx::Canvas* canvas) { |
| 103 if (focus_ring_.IsEmpty()) | 101 if (focus_ring_.IsEmpty()) |
| (...skipping 24 matching lines...) Expand all Loading... |
| 128 | 126 |
| 129 void FocusRingLayer::OnDeviceScaleFactorChanged(float device_scale_factor) { | 127 void FocusRingLayer::OnDeviceScaleFactorChanged(float device_scale_factor) { |
| 130 Update(); | 128 Update(); |
| 131 } | 129 } |
| 132 | 130 |
| 133 base::Closure FocusRingLayer::PrepareForLayerBoundsChange() { | 131 base::Closure FocusRingLayer::PrepareForLayerBoundsChange() { |
| 134 return base::Bind(&base::DoNothing); | 132 return base::Bind(&base::DoNothing); |
| 135 } | 133 } |
| 136 | 134 |
| 137 } // namespace chromeos | 135 } // namespace chromeos |
| OLD | NEW |