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

Unified Diff: ash/system/tray/tray_background_view.cc

Issue 12313118: Refactor: Shelf Widget (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 7 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: ash/system/tray/tray_background_view.cc
diff --git a/ash/system/tray/tray_background_view.cc b/ash/system/tray/tray_background_view.cc
index ebe77cd4bfc5822735a531492e4a6b16518c8ae1..b8d94a195d908aab5f7aa4b4c18c465b6bf8e7d3 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"
@@ -27,8 +26,6 @@
#include "ui/views/layout/box_layout.h"
namespace {
-
-const SkColor kTrayBackgroundAlpha = 100;
const SkColor kTrayBackgroundHoverAlpha = 150;
// Adjust the size of TrayContainer with additional padding.
@@ -72,7 +69,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 +164,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 +229,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 +244,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 +373,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);

Powered by Google App Engine
This is Rietveld 408576698