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

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

Issue 9813020: Adjust uber tray spacing around avatar and draw avatar using rounded rectangle. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge with master. Created 8 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | ash/system/user/tray_user.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/system/tray/system_tray.h" 5 #include "ash/system/tray/system_tray.h"
6 6
7 #include "ash/shell.h" 7 #include "ash/shell.h"
8 #include "ash/shell/panel_window.h" 8 #include "ash/shell/panel_window.h"
9 #include "ash/shell_window_ids.h" 9 #include "ash/shell_window_ids.h"
10 #include "ash/system/tray/tray_constants.h" 10 #include "ash/system/tray/tray_constants.h"
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 void set_alpha(int alpha) { alpha_ = alpha; } 251 void set_alpha(int alpha) { alpha_ = alpha; }
252 252
253 private: 253 private:
254 // Overridden from views::Background. 254 // Overridden from views::Background.
255 virtual void Paint(gfx::Canvas* canvas, views::View* view) const OVERRIDE { 255 virtual void Paint(gfx::Canvas* canvas, views::View* view) const OVERRIDE {
256 SkPaint paint; 256 SkPaint paint;
257 paint.setAntiAlias(true); 257 paint.setAntiAlias(true);
258 paint.setStyle(SkPaint::kFill_Style); 258 paint.setStyle(SkPaint::kFill_Style);
259 paint.setColor(SkColorSetARGB(alpha_, 0, 0, 0)); 259 paint.setColor(SkColorSetARGB(alpha_, 0, 0, 0));
260 SkPath path; 260 SkPath path;
261 gfx::Rect bounds(view->GetContentsBounds()); 261 gfx::Rect bounds(view->bounds());
262 SkScalar radius = SkIntToScalar(4); 262 SkScalar radius = SkIntToScalar(4);
263 path.addRoundRect(gfx::RectToSkRect(bounds), radius, radius); 263 path.addRoundRect(gfx::RectToSkRect(bounds), radius, radius);
264 canvas->sk_canvas()->drawPath(path, paint); 264 canvas->sk_canvas()->drawPath(path, paint);
265 } 265 }
266 266
267 int alpha_; 267 int alpha_;
268 268
269 DISALLOW_COPY_AND_ASSIGN(SystemTrayBackground); 269 DISALLOW_COPY_AND_ASSIGN(SystemTrayBackground);
270 }; 270 };
271 271
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 update_observer_(NULL), 404 update_observer_(NULL),
405 user_observer_(NULL), 405 user_observer_(NULL),
406 bubble_(NULL), 406 bubble_(NULL),
407 popup_(NULL), 407 popup_(NULL),
408 mouse_in_tray_(false), 408 mouse_in_tray_(false),
409 background_(new internal::SystemTrayBackground), 409 background_(new internal::SystemTrayBackground),
410 ALLOW_THIS_IN_INITIALIZER_LIST( 410 ALLOW_THIS_IN_INITIALIZER_LIST(
411 background_animator_(this, 0, kTrayBackgroundAlpha)) { 411 background_animator_(this, 0, kTrayBackgroundAlpha)) {
412 container_ = new views::View; 412 container_ = new views::View;
413 container_->SetLayoutManager(new views::BoxLayout( 413 container_->SetLayoutManager(new views::BoxLayout(
414 views::BoxLayout::kHorizontal, 5, 0, kTrayPaddingBetweenItems)); 414 views::BoxLayout::kHorizontal, 0, 0, kTrayPaddingBetweenItems));
415 container_->set_background(background_); 415 container_->set_background(background_);
416 container_->set_border(
417 views::Border::CreateEmptyBorder(1, kTrayPaddingBetweenItems, 1, 1));
416 set_border(views::Border::CreateEmptyBorder(0, 0, 418 set_border(views::Border::CreateEmptyBorder(0, 0,
417 kPaddingFromBottomOfScreen, kPaddingFromRightEdgeOfScreen)); 419 kPaddingFromBottomOfScreen, kPaddingFromRightEdgeOfScreen));
418 set_notify_enter_exit_on_child(true); 420 set_notify_enter_exit_on_child(true);
419 set_focusable(true); 421 set_focusable(true);
420 SetLayoutManager(new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, 0)); 422 SetLayoutManager(new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, 0));
421 AddChildView(container_); 423 AddChildView(container_);
422 424
423 // Initially we want to paint the background. 425 // Initially we want to paint the background.
424 SetPaintsBackground(true, internal::BackgroundAnimator::CHANGE_IMMEDIATE); 426 SetPaintsBackground(true, internal::BackgroundAnimator::CHANGE_IMMEDIATE);
425 } 427 }
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
576 } 578 }
577 579
578 void SystemTray::UpdateBackground(int alpha) { 580 void SystemTray::UpdateBackground(int alpha) {
579 if (mouse_in_tray_) 581 if (mouse_in_tray_)
580 alpha += kTrayBackgroundHoverAlpha - kTrayBackgroundAlpha; 582 alpha += kTrayBackgroundHoverAlpha - kTrayBackgroundAlpha;
581 background_->set_alpha(alpha); 583 background_->set_alpha(alpha);
582 SchedulePaint(); 584 SchedulePaint();
583 } 585 }
584 586
585 } // namespace ash 587 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ash/system/user/tray_user.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698