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

Side by Side Diff: ash/common/system/user/button_from_view.cc

Issue 2480813003: Reduce views::Border creation verbosity by promoting factory functions (Closed)
Patch Set: fix bad merge Created 4 years, 1 month 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
« no previous file with comments | « ash/common/system/tray/tray_utils.cc ('k') | ash/common/system/user/tray_user.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/system/user/button_from_view.h" 5 #include "ash/common/system/user/button_from_view.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/system/tray/tray_constants.h" 9 #include "ash/common/system/tray/tray_constants.h"
10 #include "ash/common/system/tray/tray_utils.h" 10 #include "ash/common/system/tray/tray_utils.h"
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 GetAccessibleLabelFromDescendantViews(child_at(i), labels); 99 GetAccessibleLabelFromDescendantViews(child_at(i), labels);
100 node_data->SetName(base::JoinString(labels, base::ASCIIToUTF16(" "))); 100 node_data->SetName(base::JoinString(labels, base::ASCIIToUTF16(" ")));
101 } 101 }
102 102
103 void ButtonFromView::ShowActive() { 103 void ButtonFromView::ShowActive() {
104 if (MaterialDesignController::IsSystemTrayMenuMaterial()) 104 if (MaterialDesignController::IsSystemTrayMenuMaterial())
105 return; 105 return;
106 bool border_visible = 106 bool border_visible =
107 (button_hovered_ && highlight_on_hover_) || show_border_; 107 (button_hovered_ && highlight_on_hover_) || show_border_;
108 SkColor border_color = border_visible ? kBorderColor : SK_ColorTRANSPARENT; 108 SkColor border_color = border_visible ? kBorderColor : SK_ColorTRANSPARENT;
109 SetBorder(views::Border::CreateSolidBorder(1, border_color)); 109 SetBorder(views::CreateSolidBorder(1, border_color));
110 if (highlight_on_hover_) { 110 if (highlight_on_hover_) {
111 SkColor background_color = 111 SkColor background_color =
112 button_hovered_ ? kHoverBackgroundColor : kBackgroundColor; 112 button_hovered_ ? kHoverBackgroundColor : kBackgroundColor;
113 content_->set_background( 113 content_->set_background(
114 views::Background::CreateSolidBackground(background_color)); 114 views::Background::CreateSolidBackground(background_color));
115 set_background(views::Background::CreateSolidBackground(background_color)); 115 set_background(views::Background::CreateSolidBackground(background_color));
116 } 116 }
117 SchedulePaint(); 117 SchedulePaint();
118 } 118 }
119 119
120 } // namespace tray 120 } // namespace tray
121 } // namespace ash 121 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/system/tray/tray_utils.cc ('k') | ash/common/system/user/tray_user.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698