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

Side by Side Diff: ash/common/system/chromeos/palette/common_palette_tool.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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/chromeos/palette/common_palette_tool.h" 5 #include "ash/common/system/chromeos/palette/common_palette_tool.h"
6 6
7 #include "ash/common/shelf/shelf_constants.h" 7 #include "ash/common/shelf/shelf_constants.h"
8 #include "ash/common/system/chromeos/palette/palette_ids.h" 8 #include "ash/common/system/chromeos/palette/palette_ids.h"
9 #include "ash/common/system/chromeos/palette/palette_tool_manager.h" 9 #include "ash/common/system/chromeos/palette/palette_tool_manager.h"
10 #include "ash/common/system/tray/hover_highlight_view.h" 10 #include "ash/common/system/tray/hover_highlight_view.h"
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 } 90 }
91 91
92 views::View* CommonPaletteTool::CreateDefaultView(const base::string16& name) { 92 views::View* CommonPaletteTool::CreateDefaultView(const base::string16& name) {
93 gfx::ImageSkia icon = 93 gfx::ImageSkia icon =
94 CreateVectorIcon(GetPaletteIcon(), kMenuIconSize, gfx::kChromeIconGrey); 94 CreateVectorIcon(GetPaletteIcon(), kMenuIconSize, gfx::kChromeIconGrey);
95 gfx::ImageSkia check = CreateVectorIcon(gfx::VectorIconId::CHECK_CIRCLE, 95 gfx::ImageSkia check = CreateVectorIcon(gfx::VectorIconId::CHECK_CIRCLE,
96 kMenuIconSize, gfx::kGoogleGreen700); 96 kMenuIconSize, gfx::kGoogleGreen700);
97 97
98 highlight_view_ = new HoverHighlightView(this); 98 highlight_view_ = new HoverHighlightView(this);
99 highlight_view_->SetBorder( 99 highlight_view_->SetBorder(
100 views::Border::CreateEmptyBorder(0, kMenuExtraMarginFromLeftEdge, 0, 0)); 100 views::CreateEmptyBorder(0, kMenuExtraMarginFromLeftEdge, 0, 0));
101 const int interior_button_padding = (kMenuButtonSize - kMenuIconSize) / 2; 101 const int interior_button_padding = (kMenuButtonSize - kMenuIconSize) / 2;
102 highlight_view_->AddIconAndLabelCustomSize(icon, name, false, kMenuIconSize, 102 highlight_view_->AddIconAndLabelCustomSize(icon, name, false, kMenuIconSize,
103 interior_button_padding, 103 interior_button_padding,
104 kTrayPopupPaddingHorizontal); 104 kTrayPopupPaddingHorizontal);
105 highlight_view_->AddRightIcon(check, kMenuIconSize); 105 highlight_view_->AddRightIcon(check, kMenuIconSize);
106 highlight_view_->set_custom_height(kMenuButtonSize); 106 highlight_view_->set_custom_height(kMenuButtonSize);
107 highlight_view_->text_label()->SetFontList(GetLabelFont()); 107 highlight_view_->text_label()->SetFontList(GetLabelFont());
108 108
109 if (enabled()) { 109 if (enabled()) {
110 highlight_view_->SetAccessiblityState( 110 highlight_view_->SetAccessiblityState(
111 HoverHighlightView::AccessibilityState::CHECKED_CHECKBOX); 111 HoverHighlightView::AccessibilityState::CHECKED_CHECKBOX);
112 } else { 112 } else {
113 highlight_view_->SetRightIconVisible(false); 113 highlight_view_->SetRightIconVisible(false);
114 highlight_view_->SetAccessiblityState( 114 highlight_view_->SetAccessiblityState(
115 HoverHighlightView::AccessibilityState::UNCHECKED_CHECKBOX); 115 HoverHighlightView::AccessibilityState::UNCHECKED_CHECKBOX);
116 } 116 }
117 117
118 return highlight_view_; 118 return highlight_view_;
119 } 119 }
120 120
121 } // namespace ash 121 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/system/chromeos/network/vpn_list_view.cc ('k') | ash/common/system/chromeos/palette/palette_tray.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698