Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(289)

Side by Side Diff: ash/system/tray/tray_utils.cc

Issue 1914093002: Refactors DockedWindowLayoutManager in terms of ash/wm/common (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@nuke_aura_window
Patch Set: merge 2 trunk Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/system/tray/tray_utils.h" 5 #include "ash/system/tray/tray_utils.h"
6 6
7 #include "ash/shelf/shelf_util.h" 7 #include "ash/shelf/shelf_util.h"
8 #include "ash/system/tray/tray_constants.h" 8 #include "ash/system/tray/tray_constants.h"
9 #include "ash/system/tray/tray_item_view.h" 9 #include "ash/system/tray/tray_item_view.h"
10 #include "ui/accessibility/ax_view_state.h" 10 #include "ui/accessibility/ax_view_state.h"
11 #include "ui/gfx/font_list.h" 11 #include "ui/gfx/font_list.h"
12 #include "ui/gfx/geometry/vector2d.h" 12 #include "ui/gfx/geometry/vector2d.h"
13 #include "ui/views/border.h" 13 #include "ui/views/border.h"
14 #include "ui/views/controls/label.h" 14 #include "ui/views/controls/label.h"
15 15
16 namespace ash { 16 namespace ash {
17 17
18 void SetupLabelForTray(views::Label* label) { 18 void SetupLabelForTray(views::Label* label) {
19 label->SetFontList(gfx::FontList().Derive(1, gfx::Font::BOLD)); 19 label->SetFontList(gfx::FontList().Derive(1, gfx::Font::BOLD));
20 label->SetAutoColorReadabilityEnabled(false); 20 label->SetAutoColorReadabilityEnabled(false);
21 label->SetEnabledColor(SK_ColorWHITE); 21 label->SetEnabledColor(SK_ColorWHITE);
22 label->SetBackgroundColor(SkColorSetARGB(0, 255, 255, 255)); 22 label->SetBackgroundColor(SkColorSetARGB(0, 255, 255, 255));
23 label->SetShadows(gfx::ShadowValues( 23 label->SetShadows(gfx::ShadowValues(
24 1, 24 1,
25 gfx::ShadowValue(gfx::Vector2d(0, 1), 0, SkColorSetARGB(64, 0, 0, 0)))); 25 gfx::ShadowValue(gfx::Vector2d(0, 1), 0, SkColorSetARGB(64, 0, 0, 0))));
26 } 26 }
27 27
28 void SetTrayImageItemBorder(views::View* tray_view, 28 void SetTrayImageItemBorder(views::View* tray_view,
29 ShelfAlignment alignment) { 29 wm::ShelfAlignment alignment) {
30 if (IsHorizontalAlignment(alignment)) { 30 if (IsHorizontalAlignment(alignment)) {
31 tray_view->SetBorder(views::Border::CreateEmptyBorder( 31 tray_view->SetBorder(views::Border::CreateEmptyBorder(
32 0, kTrayImageItemHorizontalPaddingBottomAlignment, 0, 32 0, kTrayImageItemHorizontalPaddingBottomAlignment, 0,
33 kTrayImageItemHorizontalPaddingBottomAlignment)); 33 kTrayImageItemHorizontalPaddingBottomAlignment));
34 } else { 34 } else {
35 tray_view->SetBorder(views::Border::CreateEmptyBorder( 35 tray_view->SetBorder(views::Border::CreateEmptyBorder(
36 kTrayImageItemVerticalPaddingVerticalAlignment, 36 kTrayImageItemVerticalPaddingVerticalAlignment,
37 kTrayImageItemHorizontalPaddingVerticalAlignment, 37 kTrayImageItemHorizontalPaddingVerticalAlignment,
38 kTrayImageItemVerticalPaddingVerticalAlignment, 38 kTrayImageItemVerticalPaddingVerticalAlignment,
39 kTrayImageItemHorizontalPaddingVerticalAlignment)); 39 kTrayImageItemHorizontalPaddingVerticalAlignment));
40 } 40 }
41 } 41 }
42 42
43 void SetTrayLabelItemBorder(TrayItemView* tray_view, 43 void SetTrayLabelItemBorder(TrayItemView* tray_view,
44 ShelfAlignment alignment) { 44 wm::ShelfAlignment alignment) {
45 if (IsHorizontalAlignment(alignment)) { 45 if (IsHorizontalAlignment(alignment)) {
46 tray_view->SetBorder(views::Border::CreateEmptyBorder( 46 tray_view->SetBorder(views::Border::CreateEmptyBorder(
47 0, kTrayLabelItemHorizontalPaddingBottomAlignment, 0, 47 0, kTrayLabelItemHorizontalPaddingBottomAlignment, 0,
48 kTrayLabelItemHorizontalPaddingBottomAlignment)); 48 kTrayLabelItemHorizontalPaddingBottomAlignment));
49 } else { 49 } else {
50 // Center the label for vertical launcher alignment. 50 // Center the label for vertical launcher alignment.
51 int horizontal_padding = std::max(0, 51 int horizontal_padding = std::max(0,
52 (tray_view->GetPreferredSize().width() - 52 (tray_view->GetPreferredSize().width() -
53 tray_view->label()->GetPreferredSize().width()) / 2); 53 tray_view->label()->GetPreferredSize().width()) / 2);
54 tray_view->SetBorder(views::Border::CreateEmptyBorder( 54 tray_view->SetBorder(views::Border::CreateEmptyBorder(
(...skipping 13 matching lines...) Expand all
68 // Do not descend into static text labels which may compute their own labels 68 // Do not descend into static text labels which may compute their own labels
69 // recursively. 69 // recursively.
70 if (temp_state.role == ui::AX_ROLE_STATIC_TEXT) 70 if (temp_state.role == ui::AX_ROLE_STATIC_TEXT)
71 return; 71 return;
72 72
73 for (int i = 0; i < view->child_count(); ++i) 73 for (int i = 0; i < view->child_count(); ++i)
74 GetAccessibleLabelFromDescendantViews(view->child_at(i), out_labels); 74 GetAccessibleLabelFromDescendantViews(view->child_at(i), out_labels);
75 } 75 }
76 76
77 } // namespace ash 77 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698