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

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

Issue 224113005: Eliminate ash::internal namespace (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 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 | « ash/system/tray/tray_background_view.h ('k') | ash/system/tray/tray_bar_button_with_title.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/tray_background_view.h" 5 #include "ash/system/tray/tray_background_view.h"
6 6
7 #include "ash/ash_switches.h" 7 #include "ash/ash_switches.h"
8 #include "ash/root_window_controller.h" 8 #include "ash/root_window_controller.h"
9 #include "ash/screen_util.h" 9 #include "ash/screen_util.h"
10 #include "ash/shelf/shelf_layout_manager.h" 10 #include "ash/shelf/shelf_layout_manager.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 const int kTrayContainerVerticalPaddingVerticalAlignment = 1; 43 const int kTrayContainerVerticalPaddingVerticalAlignment = 1;
44 const int kTrayContainerHorizontalPaddingVerticalAlignment = 1; 44 const int kTrayContainerHorizontalPaddingVerticalAlignment = 1;
45 45
46 const int kAnimationDurationForPopupMS = 200; 46 const int kAnimationDurationForPopupMS = 200;
47 47
48 } // namespace 48 } // namespace
49 49
50 using views::TrayBubbleView; 50 using views::TrayBubbleView;
51 51
52 namespace ash { 52 namespace ash {
53 namespace internal {
54 53
55 // static 54 // static
56 const char TrayBackgroundView::kViewClassName[] = "tray/TrayBackgroundView"; 55 const char TrayBackgroundView::kViewClassName[] = "tray/TrayBackgroundView";
57 56
58 // Used to track when the anchor widget changes position on screen so that the 57 // Used to track when the anchor widget changes position on screen so that the
59 // bubble position can be updated. 58 // bubble position can be updated.
60 class TrayBackgroundView::TrayWidgetObserver : public views::WidgetObserver { 59 class TrayBackgroundView::TrayWidgetObserver : public views::WidgetObserver {
61 public: 60 public:
62 explicit TrayWidgetObserver(TrayBackgroundView* host) 61 explicit TrayWidgetObserver(TrayBackgroundView* host)
63 : host_(host) { 62 : host_(host) {
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, 0); 308 new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, 0);
310 layout->set_spread_blank_space(true); 309 layout->set_spread_blank_space(true);
311 views::View::SetLayoutManager(layout); 310 views::View::SetLayoutManager(layout);
312 } 311 }
313 PreferredSizeChanged(); 312 PreferredSizeChanged();
314 } 313 }
315 314
316 //////////////////////////////////////////////////////////////////////////////// 315 ////////////////////////////////////////////////////////////////////////////////
317 // TrayBackgroundView 316 // TrayBackgroundView
318 317
319 TrayBackgroundView::TrayBackgroundView( 318 TrayBackgroundView::TrayBackgroundView(StatusAreaWidget* status_area_widget)
320 internal::StatusAreaWidget* status_area_widget)
321 : status_area_widget_(status_area_widget), 319 : status_area_widget_(status_area_widget),
322 tray_container_(NULL), 320 tray_container_(NULL),
323 shelf_alignment_(SHELF_ALIGNMENT_BOTTOM), 321 shelf_alignment_(SHELF_ALIGNMENT_BOTTOM),
324 background_(NULL), 322 background_(NULL),
325 hide_background_animator_(this, 0, kTrayBackgroundAlpha), 323 hide_background_animator_(this, 0, kTrayBackgroundAlpha),
326 hover_background_animator_( 324 hover_background_animator_(
327 this, 0, kTrayBackgroundHoverAlpha - kTrayBackgroundAlpha), 325 this,
326 0,
327 kTrayBackgroundHoverAlpha - kTrayBackgroundAlpha),
328 hovered_(false), 328 hovered_(false),
329 draw_background_as_active_(false), 329 draw_background_as_active_(false),
330 widget_observer_(new TrayWidgetObserver(this)) { 330 widget_observer_(new TrayWidgetObserver(this)) {
331 set_notify_enter_exit_on_child(true); 331 set_notify_enter_exit_on_child(true);
332 332
333 // Initially we want to paint the background, but without the hover effect. 333 // Initially we want to paint the background, but without the hover effect.
334 hide_background_animator_.SetPaintsBackground( 334 hide_background_animator_.SetPaintsBackground(
335 true, BACKGROUND_CHANGE_IMMEDIATE); 335 true, BACKGROUND_CHANGE_IMMEDIATE);
336 hover_background_animator_.SetPaintsBackground( 336 hover_background_animator_.SetPaintsBackground(
337 false, BACKGROUND_CHANGE_IMMEDIATE); 337 false, BACKGROUND_CHANGE_IMMEDIATE);
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
415 AddChildView(contents); 415 AddChildView(contents);
416 } 416 }
417 417
418 void TrayBackgroundView::SetPaintsBackground( 418 void TrayBackgroundView::SetPaintsBackground(
419 bool value, BackgroundAnimatorChangeType change_type) { 419 bool value, BackgroundAnimatorChangeType change_type) {
420 DCHECK(!ash::switches::UseAlternateShelfLayout()); 420 DCHECK(!ash::switches::UseAlternateShelfLayout());
421 hide_background_animator_.SetPaintsBackground(value, change_type); 421 hide_background_animator_.SetPaintsBackground(value, change_type);
422 } 422 }
423 423
424 void TrayBackgroundView::SetContentsBackground() { 424 void TrayBackgroundView::SetContentsBackground() {
425 background_ = new internal::TrayBackground(this); 425 background_ = new TrayBackground(this);
426 tray_container_->set_background(background_); 426 tray_container_->set_background(background_);
427 } 427 }
428 428
429 ShelfLayoutManager* TrayBackgroundView::GetShelfLayoutManager() { 429 ShelfLayoutManager* TrayBackgroundView::GetShelfLayoutManager() {
430 return ShelfLayoutManager::ForShelf(GetWidget()->GetNativeView()); 430 return ShelfLayoutManager::ForShelf(GetWidget()->GetNativeView());
431 } 431 }
432 432
433 void TrayBackgroundView::SetShelfAlignment(ShelfAlignment alignment) { 433 void TrayBackgroundView::SetShelfAlignment(ShelfAlignment alignment) {
434 shelf_alignment_ = alignment; 434 shelf_alignment_ = alignment;
435 SetTrayBorder(); 435 SetTrayBorder();
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
500 bubble_widget->GetNativeWindow(), 500 bubble_widget->GetNativeWindow(),
501 wm::ANIMATE_HIDE); 501 wm::ANIMATE_HIDE);
502 wm::SetWindowVisibilityAnimationDuration( 502 wm::SetWindowVisibilityAnimationDuration(
503 bubble_widget->GetNativeWindow(), 503 bubble_widget->GetNativeWindow(),
504 base::TimeDelta::FromMilliseconds(kAnimationDurationForPopupMS)); 504 base::TimeDelta::FromMilliseconds(kAnimationDurationForPopupMS));
505 } 505 }
506 506
507 aura::Window* TrayBackgroundView::GetBubbleWindowContainer() const { 507 aura::Window* TrayBackgroundView::GetBubbleWindowContainer() const {
508 return ash::Shell::GetContainer( 508 return ash::Shell::GetContainer(
509 tray_container()->GetWidget()->GetNativeWindow()->GetRootWindow(), 509 tray_container()->GetWidget()->GetNativeWindow()->GetRootWindow(),
510 ash::internal::kShellWindowId_SettingBubbleContainer); 510 ash::kShellWindowId_SettingBubbleContainer);
511 } 511 }
512 512
513 gfx::Rect TrayBackgroundView::GetBubbleAnchorRect( 513 gfx::Rect TrayBackgroundView::GetBubbleAnchorRect(
514 views::Widget* anchor_widget, 514 views::Widget* anchor_widget,
515 TrayBubbleView::AnchorType anchor_type, 515 TrayBubbleView::AnchorType anchor_type,
516 TrayBubbleView::AnchorAlignment anchor_alignment) const { 516 TrayBubbleView::AnchorAlignment anchor_alignment) const {
517 gfx::Rect rect; 517 gfx::Rect rect;
518 if (anchor_widget && anchor_widget->IsVisible()) { 518 if (anchor_widget && anchor_widget->IsVisible()) {
519 rect = anchor_widget->GetWindowBoundsInScreen(); 519 rect = anchor_widget->GetWindowBoundsInScreen();
520 if (anchor_type == TrayBubbleView::ANCHOR_TYPE_TRAY) { 520 if (anchor_type == TrayBubbleView::ANCHOR_TYPE_TRAY) {
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
613 SchedulePaint(); 613 SchedulePaint();
614 } 614 }
615 615
616 void TrayBackgroundView::UpdateBubbleViewArrow( 616 void TrayBackgroundView::UpdateBubbleViewArrow(
617 views::TrayBubbleView* bubble_view) { 617 views::TrayBubbleView* bubble_view) {
618 if (switches::UseAlternateShelfLayout()) 618 if (switches::UseAlternateShelfLayout())
619 return; 619 return;
620 620
621 aura::Window* root_window = 621 aura::Window* root_window =
622 bubble_view->GetWidget()->GetNativeView()->GetRootWindow(); 622 bubble_view->GetWidget()->GetNativeView()->GetRootWindow();
623 ash::internal::ShelfLayoutManager* shelf = 623 ash::ShelfLayoutManager* shelf = ShelfLayoutManager::ForShelf(root_window);
624 ShelfLayoutManager::ForShelf(root_window);
625 bubble_view->SetArrowPaintType( 624 bubble_view->SetArrowPaintType(
626 (shelf && shelf->IsVisible()) ? 625 (shelf && shelf->IsVisible()) ?
627 views::BubbleBorder::PAINT_NORMAL : 626 views::BubbleBorder::PAINT_NORMAL :
628 views::BubbleBorder::PAINT_TRANSPARENT); 627 views::BubbleBorder::PAINT_TRANSPARENT);
629 } 628 }
630 629
631 } // namespace internal
632 } // namespace ash 630 } // namespace ash
OLDNEW
« no previous file with comments | « ash/system/tray/tray_background_view.h ('k') | ash/system/tray/tray_bar_button_with_title.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698