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

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

Issue 2209443006: Show small notification icons in notification tray (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Include insets into border (and rename insets to margin) Created 4 years, 4 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 (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 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 UpdateLayout(); 168 UpdateLayout();
169 } 169 }
170 170
171 void TrayBackgroundView::TrayContainer::SetAlignment(ShelfAlignment alignment) { 171 void TrayBackgroundView::TrayContainer::SetAlignment(ShelfAlignment alignment) {
172 if (alignment_ == alignment) 172 if (alignment_ == alignment)
173 return; 173 return;
174 alignment_ = alignment; 174 alignment_ = alignment;
175 UpdateLayout(); 175 UpdateLayout();
176 } 176 }
177 177
178 void TrayBackgroundView::TrayContainer::SetMargin(const gfx::Insets& margin) {
179 margin_ = margin;
180 UpdateLayout();
181 }
182
178 gfx::Size TrayBackgroundView::TrayContainer::GetPreferredSize() const { 183 gfx::Size TrayBackgroundView::TrayContainer::GetPreferredSize() const {
179 if (size_.IsEmpty()) 184 if (size_.IsEmpty())
180 return views::View::GetPreferredSize(); 185 return views::View::GetPreferredSize();
181 return size_; 186 return size_;
182 } 187 }
183 188
184 void TrayBackgroundView::TrayContainer::ChildPreferredSizeChanged( 189 void TrayBackgroundView::TrayContainer::ChildPreferredSizeChanged(
185 views::View* child) { 190 views::View* child) {
186 PreferredSizeChanged(); 191 PreferredSizeChanged();
187 } 192 }
(...skipping 13 matching lines...) Expand all
201 // empty border. 206 // empty border.
202 views::BoxLayout::Orientation orientation = 207 views::BoxLayout::Orientation orientation =
203 IsHorizontalAlignment(alignment_) ? views::BoxLayout::kHorizontal 208 IsHorizontalAlignment(alignment_) ? views::BoxLayout::kHorizontal
204 : views::BoxLayout::kVertical; 209 : views::BoxLayout::kVertical;
205 210
206 if (!ash::MaterialDesignController::IsShelfMaterial()) { 211 if (!ash::MaterialDesignController::IsShelfMaterial()) {
207 // Additional padding used to adjust the user-visible size of status tray 212 // Additional padding used to adjust the user-visible size of status tray
208 // dark background. 213 // dark background.
209 const int padding = 3; 214 const int padding = 3;
210 SetBorder( 215 SetBorder(
211 views::Border::CreateEmptyBorder(padding, padding, padding, padding)); 216 views::Border::CreateEmptyBorder(gfx::Insets(padding) + margin_));
217 } else {
218 SetBorder(views::Border::CreateEmptyBorder(margin_));
212 } 219 }
213 220
214 views::BoxLayout* layout = new views::BoxLayout(orientation, 0, 0, 0); 221 views::BoxLayout* layout = new views::BoxLayout(orientation, 0, 0, 0);
215 layout->SetDefaultFlex(1); 222 layout->SetDefaultFlex(1);
216 views::View::SetLayoutManager(layout); 223 views::View::SetLayoutManager(layout);
217 PreferredSizeChanged(); 224 PreferredSizeChanged();
218 } 225 }
219 226
220 //////////////////////////////////////////////////////////////////////////////// 227 ////////////////////////////////////////////////////////////////////////////////
221 // TrayBackgroundView 228 // TrayBackgroundView
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
499 } 506 }
500 507
501 void TrayBackgroundView::UpdateShelfItemBackground(int alpha) { 508 void TrayBackgroundView::UpdateShelfItemBackground(int alpha) {
502 if (background_) { 509 if (background_) {
503 background_->set_alpha(alpha); 510 background_->set_alpha(alpha);
504 SchedulePaint(); 511 SchedulePaint();
505 } 512 }
506 } 513 }
507 514
508 } // namespace ash 515 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698