diff options
author | harrym@chromium.org <harrym@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-09 02:50:58 +0000 |
---|---|---|
committer | harrym@chromium.org <harrym@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-09 02:50:58 +0000 |
commit | 478c6c3aa0165dfd120993c5ec0757d594e70fe6 (patch) | |
tree | 3dd95bfe585e857e3672c9cfa1e705e6cdd19416 /ash/system | |
parent | 62ad3097ac2d96a2e8c65769a997702e7f0a755b (diff) | |
download | chromium_src-478c6c3aa0165dfd120993c5ec0757d594e70fe6.zip chromium_src-478c6c3aa0165dfd120993c5ec0757d594e70fe6.tar.gz chromium_src-478c6c3aa0165dfd120993c5ec0757d594e70fe6.tar.bz2 |
Refactor: Shelf Widget
Refactor the classes related with displaying the shelf (background behind the launcher/status area widget) to be a separate class. Removing background delegates from the launcher and status area widget (represented on tray views).
TBR=ben@chromium.org
BUG=163002
Review URL: https://chromiumcodereview.appspot.com/12313118
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@187122 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash/system')
-rw-r--r-- | ash/system/ime/tray_ime.cc | 2 | ||||
-rw-r--r-- | ash/system/session_length_limit/tray_session_length_limit.cc | 2 | ||||
-rw-r--r-- | ash/system/status_area_widget.cc | 12 | ||||
-rw-r--r-- | ash/system/status_area_widget.h | 8 | ||||
-rw-r--r-- | ash/system/status_area_widget_delegate.h | 2 | ||||
-rw-r--r-- | ash/system/tray/system_tray.cc | 2 | ||||
-rw-r--r-- | ash/system/tray/system_tray_item.h | 2 | ||||
-rw-r--r-- | ash/system/tray/system_tray_unittest.cc | 7 | ||||
-rw-r--r-- | ash/system/tray/tray_background_view.cc | 25 | ||||
-rw-r--r-- | ash/system/tray/tray_background_view.h | 11 | ||||
-rw-r--r-- | ash/system/tray/tray_event_filter.cc | 2 | ||||
-rw-r--r-- | ash/system/tray/tray_item_view.cc | 2 | ||||
-rw-r--r-- | ash/system/tray/tray_views.h | 2 | ||||
-rw-r--r-- | ash/system/tray_update.cc | 5 | ||||
-rw-r--r-- | ash/system/web_notification/web_notification_tray.cc | 2 | ||||
-rw-r--r-- | ash/system/web_notification/web_notification_tray_unittest.cc | 5 |
16 files changed, 30 insertions, 61 deletions
diff --git a/ash/system/ime/tray_ime.cc b/ash/system/ime/tray_ime.cc index a0460b7..c931f46 100644 --- a/ash/system/ime/tray_ime.cc +++ b/ash/system/ime/tray_ime.cc @@ -7,6 +7,7 @@ #include <vector> #include "ash/root_window_controller.h" +#include "ash/shelf/shelf_widget.h" #include "ash/shell.h" #include "ash/system/tray/hover_highlight_view.h" #include "ash/system/tray/system_tray.h" @@ -17,7 +18,6 @@ #include "ash/system/tray/tray_item_more.h" #include "ash/system/tray/tray_item_view.h" #include "ash/system/tray/tray_notification_view.h" -#include "ash/wm/shelf_layout_manager.h" #include "base/logging.h" #include "base/timer.h" #include "base/utf_string_conversions.h" diff --git a/ash/system/session_length_limit/tray_session_length_limit.cc b/ash/system/session_length_limit/tray_session_length_limit.cc index d9c3588..54dbc02 100644 --- a/ash/system/session_length_limit/tray_session_length_limit.cc +++ b/ash/system/session_length_limit/tray_session_length_limit.cc @@ -6,7 +6,7 @@ #include <cmath> -#include "ash/shelf_types.h" +#include "ash/shelf/shelf_types.h" #include "ash/shell.h" #include "ash/system/tray/system_tray.h" #include "ash/system/tray/system_tray_delegate.h" diff --git a/ash/system/status_area_widget.cc b/ash/system/status_area_widget.cc index 527edf2..0701097 100644 --- a/ash/system/status_area_widget.cc +++ b/ash/system/status_area_widget.cc @@ -5,6 +5,8 @@ #include "ash/system/status_area_widget.h" #include "ash/root_window_controller.h" +#include "ash/shelf/shelf_layout_manager.h" +#include "ash/shelf/shelf_widget.h" #include "ash/shell.h" #include "ash/shell_delegate.h" #include "ash/shell_window_ids.h" @@ -13,7 +15,6 @@ #include "ash/system/tray/system_tray.h" #include "ash/system/tray/system_tray_delegate.h" #include "ash/system/web_notification/web_notification_tray.h" -#include "ash/wm/shelf_layout_manager.h" #include "ash/wm/window_properties.h" #include "base/i18n/time_formatting.h" #include "ui/aura/window.h" @@ -108,15 +109,6 @@ void StatusAreaWidget::SetShelfAlignment(ShelfAlignment alignment) { status_area_widget_delegate_->UpdateLayout(); } -void StatusAreaWidget::SetPaintsBackground( - bool value, - internal::BackgroundAnimator::ChangeType change_type) { - if (system_tray_) - system_tray_->SetPaintsBackground(value, change_type); - if (web_notification_tray_) - web_notification_tray_->SetPaintsBackground(value, change_type); -} - void StatusAreaWidget::SetHideWebNotifications(bool hide) { if (web_notification_tray_) web_notification_tray_->SetHidePopupBubble(hide); diff --git a/ash/system/status_area_widget.h b/ash/system/status_area_widget.h index c83a735..03a78a4 100644 --- a/ash/system/status_area_widget.h +++ b/ash/system/status_area_widget.h @@ -6,8 +6,7 @@ #define ASH_SYSTEM_STATUS_AREA_WIDGET_H_ #include "ash/ash_export.h" -#include "ash/launcher/background_animator.h" -#include "ash/shelf_types.h" +#include "ash/shelf/shelf_types.h" #include "ash/system/user/login_status.h" #include "ui/views/widget/widget.h" @@ -36,11 +35,6 @@ class ASH_EXPORT StatusAreaWidget : public views::Widget { // Update the alignment of the widget and tray views. void SetShelfAlignment(ShelfAlignment alignment); - // Update whether to paint a background for each tray view. - void SetPaintsBackground( - bool value, - internal::BackgroundAnimator::ChangeType change_type); - // Set the visibility state of web notifications. void SetHideWebNotifications(bool hide); diff --git a/ash/system/status_area_widget_delegate.h b/ash/system/status_area_widget_delegate.h index 84b1c2e..c7820ea 100644 --- a/ash/system/status_area_widget_delegate.h +++ b/ash/system/status_area_widget_delegate.h @@ -6,7 +6,7 @@ #define ASH_SYSTEM_STATUS_AREA_WIDGET_DELEGATE_H_ #include "ash/ash_export.h" -#include "ash/shelf_types.h" +#include "ash/shelf/shelf_types.h" #include "ash/wm/gestures/shelf_gesture_handler.h" #include "ui/gfx/image/image_skia.h" #include "ui/views/accessible_pane_view.h" diff --git a/ash/system/tray/system_tray.cc b/ash/system/tray/system_tray.cc index 0b17757..6962514 100644 --- a/ash/system/tray/system_tray.cc +++ b/ash/system/tray/system_tray.cc @@ -5,6 +5,7 @@ #include "ash/system/tray/system_tray.h" #include "ash/ash_switches.h" +#include "ash/shelf/shelf_layout_manager.h" #include "ash/shell.h" #include "ash/shell/panel_window.h" #include "ash/shell_window_ids.h" @@ -32,7 +33,6 @@ #include "ash/system/tray_update.h" #include "ash/system/user/login_status.h" #include "ash/system/user/tray_user.h" -#include "ash/wm/shelf_layout_manager.h" #include "base/command_line.h" #include "base/logging.h" #include "base/timer.h" diff --git a/ash/system/tray/system_tray_item.h b/ash/system/tray/system_tray_item.h index d643a94c..29fdf8a 100644 --- a/ash/system/tray/system_tray_item.h +++ b/ash/system/tray/system_tray_item.h @@ -6,7 +6,7 @@ #define ASH_SYSTEM_TRAY_SYSTEM_TRAY_ITEM_H_ #include "ash/ash_export.h" -#include "ash/shelf_types.h" +#include "ash/shelf/shelf_types.h" #include "ash/system/user/login_status.h" #include "base/basictypes.h" #include "base/compiler_specific.h" diff --git a/ash/system/tray/system_tray_unittest.cc b/ash/system/tray/system_tray_unittest.cc index ac693e3..ca1db67 100644 --- a/ash/system/tray/system_tray_unittest.cc +++ b/ash/system/tray/system_tray_unittest.cc @@ -7,6 +7,7 @@ #include <vector> #include "ash/root_window_controller.h" +#include "ash/shelf/shelf_widget.h" #include "ash/system/status_area_widget.h" #include "ash/system/tray/system_tray_item.h" #include "ash/test/ash_test_base.h" @@ -26,8 +27,8 @@ namespace test { namespace { SystemTray* GetSystemTray() { - return Shell::GetPrimaryRootWindowController()->status_area_widget()-> - system_tray(); + return Shell::GetPrimaryRootWindowController()->shelf()-> + status_area_widget()->system_tray(); } // Trivial item implementation that tracks its views for testing. @@ -288,7 +289,7 @@ TEST_F(SystemTrayTest, BubbleCreationTypesTest) { // tray extends to the correct edge of the screen. TEST_F(SystemTrayTest, TrayBoundsInWidget) { internal::StatusAreaWidget* widget = - Shell::GetPrimaryRootWindowController()->status_area_widget(); + Shell::GetPrimaryRootWindowController()->shelf()->status_area_widget(); SystemTray* tray = widget->system_tray(); // Test in bottom alignment. Bottom and right edges of the view should be diff --git a/ash/system/tray/tray_background_view.cc b/ash/system/tray/tray_background_view.cc index ebe77cd..68c6b62 100644 --- a/ash/system/tray/tray_background_view.cc +++ b/ash/system/tray/tray_background_view.cc @@ -4,9 +4,9 @@ #include "ash/system/tray/tray_background_view.h" -#include "ash/launcher/background_animator.h" #include "ash/root_window_controller.h" #include "ash/screen_ash.h" +#include "ash/shelf/shelf_layout_manager.h" #include "ash/shell.h" #include "ash/shell_window_ids.h" #include "ash/system/status_area_widget.h" @@ -14,7 +14,6 @@ #include "ash/system/tray/tray_constants.h" #include "ash/system/tray/tray_event_filter.h" #include "ash/wm/property_util.h" -#include "ash/wm/shelf_layout_manager.h" #include "ash/wm/window_animations.h" #include "ui/aura/root_window.h" #include "ui/aura/window.h" @@ -28,7 +27,6 @@ namespace { -const SkColor kTrayBackgroundAlpha = 100; const SkColor kTrayBackgroundHoverAlpha = 150; // Adjust the size of TrayContainer with additional padding. @@ -72,7 +70,7 @@ class TrayBackgroundView::TrayWidgetObserver : public views::WidgetObserver { class TrayBackground : public views::Background { public: - TrayBackground() : alpha_(kTrayBackgroundAlpha) {} + TrayBackground() : alpha_(0) {} virtual ~TrayBackground() {} void set_alpha(int alpha) { alpha_ = alpha; } @@ -167,16 +165,13 @@ TrayBackgroundView::TrayBackgroundView( tray_container_(NULL), shelf_alignment_(SHELF_ALIGNMENT_BOTTOM), background_(NULL), - ALLOW_THIS_IN_INITIALIZER_LIST(hide_background_animator_( - this, 0, kTrayBackgroundAlpha)), ALLOW_THIS_IN_INITIALIZER_LIST(hover_background_animator_( - this, 0, kTrayBackgroundHoverAlpha - kTrayBackgroundAlpha)), + this, 0, kTrayBackgroundHoverAlpha)), ALLOW_THIS_IN_INITIALIZER_LIST(widget_observer_( new TrayWidgetObserver(this))) { set_notify_enter_exit_on_child(true); // Initially we want to paint the background, but without the hover effect. - SetPaintsBackground(true, internal::BackgroundAnimator::CHANGE_IMMEDIATE); hover_background_animator_.SetPaintsBackground(false, internal::BackgroundAnimator::CHANGE_IMMEDIATE); @@ -235,8 +230,7 @@ bool TrayBackgroundView::PerformAction(const ui::Event& event) { void TrayBackgroundView::UpdateBackground(int alpha) { if (background_) { - background_->set_alpha(hide_background_animator_.alpha() + - hover_background_animator_.alpha()); + background_->set_alpha(hover_background_animator_.alpha()); } SchedulePaint(); } @@ -251,15 +245,8 @@ void TrayBackgroundView::SetContentsBackground() { tray_container_->set_background(background_); } -void TrayBackgroundView::SetPaintsBackground( - bool value, - internal::BackgroundAnimator::ChangeType change_type) { - hide_background_animator_.SetPaintsBackground(value, change_type); -} - ShelfLayoutManager* TrayBackgroundView::GetShelfLayoutManager() { - return - RootWindowController::ForLauncher(GetWidget()->GetNativeView())->shelf(); + return ShelfLayoutManager::ForLauncher(GetWidget()->GetNativeView()); } void TrayBackgroundView::SetShelfAlignment(ShelfAlignment alignment) { @@ -387,7 +374,7 @@ void TrayBackgroundView::UpdateBubbleViewArrow( aura::RootWindow* root_window = bubble_view->GetWidget()->GetNativeView()->GetRootWindow(); ash::internal::ShelfLayoutManager* shelf = - ash::GetRootWindowController(root_window)->shelf(); + ShelfLayoutManager::ForLauncher(root_window); bubble_view->SetArrowPaintType( shelf->IsVisible() ? views::BubbleBorder::PAINT_NORMAL : views::BubbleBorder::PAINT_TRANSPARENT); diff --git a/ash/system/tray/tray_background_view.h b/ash/system/tray/tray_background_view.h index 8b136655..39f2a4c 100644 --- a/ash/system/tray/tray_background_view.h +++ b/ash/system/tray/tray_background_view.h @@ -6,8 +6,8 @@ #define ASH_SYSTEM_TRAY_TRAY_BACKGROUND_VIEW_H_ #include "ash/ash_export.h" -#include "ash/launcher/background_animator.h" -#include "ash/shelf_types.h" +#include "ash/shelf/background_animator.h" +#include "ash/shelf/shelf_types.h" #include "ash/system/tray/actionable_view.h" #include "ui/views/bubble/tray_bubble_view.h" @@ -100,12 +100,6 @@ class ASH_EXPORT TrayBackgroundView : public ActionableView, // Creates and sets contents background to |background_|. void SetContentsBackground(); - // Sets whether the tray paints a background. Default is true, but is set to - // false if a window overlaps the shelf. - void SetPaintsBackground( - bool value, - internal::BackgroundAnimator::ChangeType change_type); - // Initializes animations for the bubble. void InitializeBubbleAnimations(views::Widget* bubble_widget); @@ -155,7 +149,6 @@ class ASH_EXPORT TrayBackgroundView : public ActionableView, // Owned by the view passed to SetContents(). internal::TrayBackground* background_; - internal::BackgroundAnimator hide_background_animator_; internal::BackgroundAnimator hover_background_animator_; scoped_ptr<TrayWidgetObserver> widget_observer_; scoped_ptr<TrayEventFilter> tray_event_filter_; diff --git a/ash/system/tray/tray_event_filter.cc b/ash/system/tray/tray_event_filter.cc index f2192e5..949b2f9 100644 --- a/ash/system/tray/tray_event_filter.cc +++ b/ash/system/tray/tray_event_filter.cc @@ -5,6 +5,7 @@ #include "ash/system/tray/tray_event_filter.h" #include "ash/root_window_controller.h" +#include "ash/shelf/shelf_layout_manager.h" #include "ash/shell.h" #include "ash/shell_window_ids.h" #include "ash/system/tray/tray_background_view.h" @@ -12,7 +13,6 @@ #include "ash/system/tray/tray_constants.h" #include "ash/system/tray/tray_event_filter.h" #include "ash/wm/property_util.h" -#include "ash/wm/shelf_layout_manager.h" #include "ui/aura/client/screen_position_client.h" #include "ui/aura/root_window.h" #include "ui/aura/window.h" diff --git a/ash/system/tray/tray_item_view.cc b/ash/system/tray/tray_item_view.cc index ae778ae..426ff52 100644 --- a/ash/system/tray/tray_item_view.cc +++ b/ash/system/tray/tray_item_view.cc @@ -4,7 +4,7 @@ #include "ash/system/tray/tray_item_view.h" -#include "ash/shelf_types.h" +#include "ash/shelf/shelf_types.h" #include "ash/system/tray/system_tray.h" #include "ash/system/tray/system_tray_item.h" #include "ui/base/animation/slide_animation.h" diff --git a/ash/system/tray/tray_views.h b/ash/system/tray/tray_views.h index 06632ca..d50c946 100644 --- a/ash/system/tray/tray_views.h +++ b/ash/system/tray/tray_views.h @@ -6,7 +6,7 @@ #define ASH_SYSTEM_TRAY_TRAY_VIEWS_H_ #include "ash/ash_export.h" -#include "ash/shelf_types.h" +#include "ash/shelf/shelf_types.h" #include "ui/gfx/font.h" #include "ui/gfx/size.h" #include "ui/views/controls/button/custom_button.h" diff --git a/ash/system/tray_update.cc b/ash/system/tray_update.cc index f448e30..e56d8c1 100644 --- a/ash/system/tray_update.cc +++ b/ash/system/tray_update.cc @@ -5,6 +5,8 @@ #include "ash/system/tray_update.h" #include "ash/root_window_controller.h" +#include "ash/shelf/shelf_layout_manager.h" +#include "ash/shelf/shelf_widget.h" #include "ash/shell.h" #include "ash/system/status_area_widget.h" #include "ash/system/tray/fixed_sized_image_view.h" @@ -13,7 +15,6 @@ #include "ash/system/tray/system_tray_notifier.h" #include "ash/system/tray/tray_constants.h" #include "ash/system/tray/tray_views.h" -#include "ash/wm/shelf_layout_manager.h" #include "base/time.h" #include "base/timer.h" #include "grit/ash_resources.h" @@ -110,7 +111,7 @@ class UpdateNagger : public ui::LayerAnimationObserver { virtual ~UpdateNagger() { internal::StatusAreaWidget* status_area = - Shell::GetPrimaryRootWindowController()->status_area_widget(); + Shell::GetPrimaryRootWindowController()->shelf()->status_area_widget(); if (status_area) { status_area->system_tray()->GetWidget()->GetNativeView()->layer()-> GetAnimator()->RemoveObserver(this); diff --git a/ash/system/web_notification/web_notification_tray.cc b/ash/system/web_notification/web_notification_tray.cc index 98f3770..38ca581 100644 --- a/ash/system/web_notification/web_notification_tray.cc +++ b/ash/system/web_notification/web_notification_tray.cc @@ -5,13 +5,13 @@ #include "ash/system/web_notification/web_notification_tray.h" #include "ash/root_window_controller.h" +#include "ash/shelf/shelf_layout_manager.h" #include "ash/shell.h" #include "ash/shell_window_ids.h" #include "ash/system/status_area_widget.h" #include "ash/system/tray/tray_background_view.h" #include "ash/system/tray/tray_bubble_wrapper.h" #include "ash/system/tray/tray_constants.h" -#include "ash/wm/shelf_layout_manager.h" #include "grit/ash_resources.h" #include "grit/ash_strings.h" #include "ui/aura/root_window.h" diff --git a/ash/system/web_notification/web_notification_tray_unittest.cc b/ash/system/web_notification/web_notification_tray_unittest.cc index 7895d18..a53f970 100644 --- a/ash/system/web_notification/web_notification_tray_unittest.cc +++ b/ash/system/web_notification/web_notification_tray_unittest.cc @@ -7,6 +7,7 @@ #include <vector> #include "ash/root_window_controller.h" +#include "ash/shelf/shelf_widget.h" #include "ash/system/status_area_widget.h" #include "ash/system/tray/system_tray_item.h" #include "ash/test/ash_test_base.h" @@ -33,8 +34,8 @@ namespace ash { namespace { WebNotificationTray* GetWebNotificationTray() { - return Shell::GetPrimaryRootWindowController()->status_area_widget()-> - web_notification_tray(); + return Shell::GetPrimaryRootWindowController()->shelf()-> + status_area_widget()->web_notification_tray(); } message_center::MessageCenter* get_message_center() { |