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

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

Issue 2816193002: Introduce a type of View background that stays in sync with its host (Closed)
Patch Set: . Created 3 years, 8 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 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/system/tray/tray_popup_utils.h" 5 #include "ash/system/tray/tray_popup_utils.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <utility> 8 #include <utility>
9 9
10 #include "ash/ash_constants.h" 10 #include "ash/ash_constants.h"
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 } 204 }
205 205
206 views::Label* TrayPopupUtils::CreateDefaultLabel() { 206 views::Label* TrayPopupUtils::CreateDefaultLabel() {
207 views::Label* label = new views::Label(); 207 views::Label* label = new views::Label();
208 label->SetHorizontalAlignment(gfx::ALIGN_LEFT); 208 label->SetHorizontalAlignment(gfx::ALIGN_LEFT);
209 label->SetBorder( 209 label->SetBorder(
210 views::CreateEmptyBorder(0, 0, 0, kTrayPopupLabelRightPadding)); 210 views::CreateEmptyBorder(0, 0, 0, kTrayPopupLabelRightPadding));
211 // Frequently the label will paint to a layer that's non-opaque, so subpixel 211 // Frequently the label will paint to a layer that's non-opaque, so subpixel
212 // rendering won't work unless we explicitly set a background. See 212 // rendering won't work unless we explicitly set a background. See
213 // crbug.com/686363 213 // crbug.com/686363
214 label->set_background( 214 label->set_background(views::Background::CreateThemedSolidBackground(
215 views::Background::CreateSolidBackground(kBackgroundColor)); 215 label, ui::NativeTheme::kColorId_BubbleBackground));
216 label->SetBackgroundColor(kBackgroundColor);
217 return label; 216 return label;
218 } 217 }
219 218
220 views::ImageView* TrayPopupUtils::CreateMainImageView() { 219 views::ImageView* TrayPopupUtils::CreateMainImageView() {
221 return new FixedSizedImageView(kTrayPopupItemMinStartWidth, 220 return new FixedSizedImageView(kTrayPopupItemMinStartWidth,
222 kTrayPopupItemMinHeight); 221 kTrayPopupItemMinHeight);
223 } 222 }
224 223
225 views::ImageView* TrayPopupUtils::CreateMoreImageView() { 224 views::ImageView* TrayPopupUtils::CreateMoreImageView() {
226 views::ImageView* image = 225 views::ImageView* image =
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 button->SetFocusForPlatform(); 264 button->SetFocusForPlatform();
266 265
267 button->SetInkDropMode(views::InkDropHostView::InkDropMode::ON); 266 button->SetInkDropMode(views::InkDropHostView::InkDropMode::ON);
268 button->set_has_ink_drop_action_on_click(true); 267 button->set_has_ink_drop_action_on_click(true);
269 button->set_ink_drop_base_color(kTrayPopupInkDropBaseColor); 268 button->set_ink_drop_base_color(kTrayPopupInkDropBaseColor);
270 button->set_ink_drop_visible_opacity(kTrayPopupInkDropRippleOpacity); 269 button->set_ink_drop_visible_opacity(kTrayPopupInkDropRippleOpacity);
271 } 270 }
272 271
273 void TrayPopupUtils::ConfigureAsStickyHeader(views::View* view) { 272 void TrayPopupUtils::ConfigureAsStickyHeader(views::View* view) {
274 view->set_id(VIEW_ID_STICKY_HEADER); 273 view->set_id(VIEW_ID_STICKY_HEADER);
275 view->set_background( 274 view->set_background(views::Background::CreateThemedSolidBackground(
276 views::Background::CreateSolidBackground(kBackgroundColor)); 275 view, ui::NativeTheme::kColorId_BubbleBackground));
277 view->SetBorder( 276 view->SetBorder(
278 views::CreateEmptyBorder(gfx::Insets(kMenuSeparatorVerticalPadding, 0))); 277 views::CreateEmptyBorder(gfx::Insets(kMenuSeparatorVerticalPadding, 0)));
279 view->SetPaintToLayer(); 278 view->SetPaintToLayer();
280 view->layer()->SetFillsBoundsOpaquely(false); 279 view->layer()->SetFillsBoundsOpaquely(false);
281 } 280 }
282 281
283 void TrayPopupUtils::ShowStickyHeaderSeparator(views::View* view, 282 void TrayPopupUtils::ShowStickyHeaderSeparator(views::View* view,
284 bool show_separator) { 283 bool show_separator) {
285 if (show_separator) { 284 if (show_separator) {
286 view->SetBorder(views::CreatePaddedBorder( 285 view->SetBorder(views::CreatePaddedBorder(
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
446 445
447 void TrayPopupUtils::UpdateCheckMarkVisibility(HoverHighlightView* container, 446 void TrayPopupUtils::UpdateCheckMarkVisibility(HoverHighlightView* container,
448 bool visible) { 447 bool visible) {
449 container->SetRightViewVisible(visible); 448 container->SetRightViewVisible(visible);
450 container->SetAccessiblityState( 449 container->SetAccessiblityState(
451 visible ? HoverHighlightView::AccessibilityState::CHECKED_CHECKBOX 450 visible ? HoverHighlightView::AccessibilityState::CHECKED_CHECKBOX
452 : HoverHighlightView::AccessibilityState::UNCHECKED_CHECKBOX); 451 : HoverHighlightView::AccessibilityState::UNCHECKED_CHECKBOX);
453 } 452 }
454 453
455 } // namespace ash 454 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698