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

Side by Side Diff: ash/common/system/tray/tray_background_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
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/common/system/tray/tray_background_view.h" 5 #include "ash/common/system/tray/tray_background_view.h"
6 6
7 #include "ash/common/material_design/material_design_controller.h" 7 #include "ash/common/material_design/material_design_controller.h"
8 #include "ash/common/shelf/shelf_constants.h" 8 #include "ash/common/shelf/shelf_constants.h"
9 #include "ash/common/shelf/wm_shelf.h" 9 #include "ash/common/shelf/wm_shelf.h"
10 #include "ash/common/shelf/wm_shelf_util.h" 10 #include "ash/common/shelf/wm_shelf_util.h"
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 const gfx::Insets insets( 229 const gfx::Insets insets(
230 ash::MaterialDesignController::IsShelfMaterial() 230 ash::MaterialDesignController::IsShelfMaterial()
231 ? is_horizontal ? gfx::Insets(0, kHitRegionPadding, 0, 231 ? is_horizontal ? gfx::Insets(0, kHitRegionPadding, 0,
232 kHitRegionPadding + kSeparatorWidth) 232 kHitRegionPadding + kSeparatorWidth)
233 : gfx::Insets(kHitRegionPadding, 0, 233 : gfx::Insets(kHitRegionPadding, 0,
234 kHitRegionPadding + kSeparatorWidth, 0) 234 kHitRegionPadding + kSeparatorWidth, 0)
235 : gfx::Insets(kBackgroundAdjustPadding)); 235 : gfx::Insets(kBackgroundAdjustPadding));
236 const gfx::Insets margin( 236 const gfx::Insets margin(
237 is_horizontal ? gfx::Insets(cross_axis_margin_, main_axis_margin_) 237 is_horizontal ? gfx::Insets(cross_axis_margin_, main_axis_margin_)
238 : gfx::Insets(main_axis_margin_, cross_axis_margin_)); 238 : gfx::Insets(main_axis_margin_, cross_axis_margin_));
239 SetBorder(views::Border::CreateEmptyBorder(insets + margin)); 239 SetBorder(views::CreateEmptyBorder(insets + margin));
240 240
241 views::BoxLayout* layout = new views::BoxLayout(orientation, 0, 0, 0); 241 views::BoxLayout* layout = new views::BoxLayout(orientation, 0, 0, 0);
242 if (!ash::MaterialDesignController::IsShelfMaterial()) 242 if (!ash::MaterialDesignController::IsShelfMaterial())
243 layout->SetDefaultFlex(1); 243 layout->SetDefaultFlex(1);
244 layout->set_minimum_cross_axis_size(kTrayItemSize); 244 layout->set_minimum_cross_axis_size(kTrayItemSize);
245 views::View::SetLayoutManager(layout); 245 views::View::SetLayoutManager(layout);
246 246
247 PreferredSizeChanged(); 247 PreferredSizeChanged();
248 } 248 }
249 249
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
566 paint.setAntiAlias(true); 566 paint.setAntiAlias(true);
567 567
568 const gfx::Rect bounds = horizontal_shelf ? gfx::Rect(x, y, width, height) 568 const gfx::Rect bounds = horizontal_shelf ? gfx::Rect(x, y, width, height)
569 : gfx::Rect(y, x, height, width); 569 : gfx::Rect(y, x, height, width);
570 gfx::RectF rect(gfx::ScaleRect(gfx::RectF(bounds), scale)); 570 gfx::RectF rect(gfx::ScaleRect(gfx::RectF(bounds), scale));
571 canvas->DrawLine(horizontal_shelf ? rect.top_right() : rect.bottom_left(), 571 canvas->DrawLine(horizontal_shelf ? rect.top_right() : rect.bottom_left(),
572 rect.bottom_right(), paint); 572 rect.bottom_right(), paint);
573 } 573 }
574 574
575 } // namespace ash 575 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/system/tray/system_tray_bubble.cc ('k') | ash/common/system/tray/tray_details_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698