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

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

Issue 2489883005: Fix a couple issues with sticky headers (Closed)
Patch Set: fix crash 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/tray/tray_popup_utils.h" 5 #include "ash/common/system/tray/tray_popup_utils.h"
6 6
7 #include "ash/common/ash_constants.h" 7 #include "ash/common/ash_constants.h"
8 #include "ash/common/ash_view_ids.h"
8 #include "ash/common/material_design/material_design_controller.h" 9 #include "ash/common/material_design/material_design_controller.h"
9 #include "ash/common/session/session_state_delegate.h" 10 #include "ash/common/session/session_state_delegate.h"
10 #include "ash/common/system/tray/fixed_sized_image_view.h" 11 #include "ash/common/system/tray/fixed_sized_image_view.h"
11 #include "ash/common/system/tray/tray_constants.h" 12 #include "ash/common/system/tray/tray_constants.h"
12 #include "ash/common/system/tray/tray_popup_label_button.h" 13 #include "ash/common/system/tray/tray_popup_label_button.h"
13 #include "ash/common/system/tray/tray_popup_label_button_border.h" 14 #include "ash/common/system/tray/tray_popup_label_button_border.h"
14 #include "ash/common/wm_shell.h" 15 #include "ash/common/wm_shell.h"
15 #include "ui/views/animation/ink_drop_impl.h" 16 #include "ui/views/animation/ink_drop_impl.h"
17 #include "ui/views/background.h"
16 #include "ui/views/border.h" 18 #include "ui/views/border.h"
17 #include "ui/views/controls/button/button.h" 19 #include "ui/views/controls/button/button.h"
18 #include "ui/views/controls/button/label_button.h" 20 #include "ui/views/controls/button/label_button.h"
19 #include "ui/views/controls/button/md_text_button.h" 21 #include "ui/views/controls/button/md_text_button.h"
20 #include "ui/views/controls/image_view.h" 22 #include "ui/views/controls/image_view.h"
21 #include "ui/views/controls/label.h" 23 #include "ui/views/controls/label.h"
22 #include "ui/views/controls/separator.h" 24 #include "ui/views/controls/separator.h"
23 #include "ui/views/controls/slider.h" 25 #include "ui/views/controls/slider.h"
24 #include "ui/views/layout/box_layout.h" 26 #include "ui/views/layout/box_layout.h"
25 #include "ui/views/layout/fill_layout.h" 27 #include "ui/views/layout/fill_layout.h"
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 if (is_material) { 185 if (is_material) {
184 slider->SetBorder( 186 slider->SetBorder(
185 views::CreateEmptyBorder(gfx::Insets(0, kTrayPopupSliderPaddingMD))); 187 views::CreateEmptyBorder(gfx::Insets(0, kTrayPopupSliderPaddingMD)));
186 } else { 188 } else {
187 slider->SetBorder( 189 slider->SetBorder(
188 views::CreateEmptyBorder(0, 0, 0, kTrayPopupPaddingBetweenItems)); 190 views::CreateEmptyBorder(0, 0, 0, kTrayPopupPaddingBetweenItems));
189 } 191 }
190 return slider; 192 return slider;
191 } 193 }
192 194
195 void TrayPopupUtils::ConfigureAsStickyHeader(views::View* view) {
196 view->set_id(VIEW_ID_STICKY_HEADER);
197 view->set_background(
198 views::Background::CreateSolidBackground(kBackgroundColor));
199 view->SetBorder(
200 views::CreateEmptyBorder(gfx::Insets(kMenuSeparatorVerticalPadding, 0)));
201 }
202
193 void TrayPopupUtils::ConfigureContainer(TriView::Container container, 203 void TrayPopupUtils::ConfigureContainer(TriView::Container container,
194 views::View* container_view) { 204 views::View* container_view) {
195 container_view->SetBorder(CreateDefaultBorder(container)); 205 container_view->SetBorder(CreateDefaultBorder(container));
196 container_view->SetLayoutManager( 206 container_view->SetLayoutManager(
197 CreateDefaultLayoutManager(container).release()); 207 CreateDefaultLayoutManager(container).release());
198 } 208 }
199 209
200 void TrayPopupUtils::ConfigureDefaultSizeAndFlex(TriView* tri_view, 210 void TrayPopupUtils::ConfigureDefaultSizeAndFlex(TriView* tri_view,
201 TriView::Container container) { 211 TriView::Container container) {
202 switch (container) { 212 switch (container) {
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 0, GetTrayConstant(TRAY_POPUP_ITEM_MORE_REGION_HORIZONTAL_INSET), 0, 290 0, GetTrayConstant(TRAY_POPUP_ITEM_MORE_REGION_HORIZONTAL_INSET), 0,
281 GetTrayConstant(TRAY_POPUP_ITEM_MORE_REGION_HORIZONTAL_INSET)); 291 GetTrayConstant(TRAY_POPUP_ITEM_MORE_REGION_HORIZONTAL_INSET));
282 break; 292 break;
283 } 293 }
284 // Required by some compilers. 294 // Required by some compilers.
285 NOTREACHED(); 295 NOTREACHED();
286 return nullptr; 296 return nullptr;
287 } 297 }
288 298
289 } // namespace ash 299 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698