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

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: Rebased and addressed comments 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 12 matching lines...) Expand all
200 // Adjust the size of status tray dark background by adding additional 205 // Adjust the size of status tray dark background by adding additional
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(views::Border::CreateEmptyBorder(gfx::Insets(padding) + margin_));
211 views::Border::CreateEmptyBorder(padding, padding, padding, padding)); 216 } else {
217 SetBorder(views::Border::CreateEmptyBorder(margin_));
212 } 218 }
213 219
214 views::BoxLayout* layout = new views::BoxLayout(orientation, 0, 0, 0); 220 views::BoxLayout* layout = new views::BoxLayout(orientation, 0, 0, 0);
215 layout->SetDefaultFlex(1); 221 layout->SetDefaultFlex(1);
216 views::View::SetLayoutManager(layout); 222 views::View::SetLayoutManager(layout);
217 PreferredSizeChanged(); 223 PreferredSizeChanged();
218 } 224 }
219 225
220 //////////////////////////////////////////////////////////////////////////////// 226 ////////////////////////////////////////////////////////////////////////////////
221 // TrayBackgroundView 227 // TrayBackgroundView
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
499 } 505 }
500 506
501 void TrayBackgroundView::UpdateShelfItemBackground(int alpha) { 507 void TrayBackgroundView::UpdateShelfItemBackground(int alpha) {
502 if (background_) { 508 if (background_) {
503 background_->set_alpha(alpha); 509 background_->set_alpha(alpha);
504 SchedulePaint(); 510 SchedulePaint();
505 } 511 }
506 } 512 }
507 513
508 } // namespace ash 514 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698