| OLD | NEW |
| 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/root_window_controller.h" | 7 #include "ash/root_window_controller.h" |
| 8 #include "ash/screen_util.h" | 8 #include "ash/screen_util.h" |
| 9 #include "ash/shelf/shelf_layout_manager.h" | 9 #include "ash/shelf/shelf_layout_manager.h" |
| 10 #include "ash/shelf/shelf_widget.h" | 10 #include "ash/shelf/shelf_widget.h" |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 | 65 |
| 66 // Used to track when the anchor widget changes position on screen so that the | 66 // Used to track when the anchor widget changes position on screen so that the |
| 67 // bubble position can be updated. | 67 // bubble position can be updated. |
| 68 class TrayBackgroundView::TrayWidgetObserver : public views::WidgetObserver { | 68 class TrayBackgroundView::TrayWidgetObserver : public views::WidgetObserver { |
| 69 public: | 69 public: |
| 70 explicit TrayWidgetObserver(TrayBackgroundView* host) | 70 explicit TrayWidgetObserver(TrayBackgroundView* host) |
| 71 : host_(host) { | 71 : host_(host) { |
| 72 } | 72 } |
| 73 | 73 |
| 74 virtual void OnWidgetBoundsChanged(views::Widget* widget, | 74 virtual void OnWidgetBoundsChanged(views::Widget* widget, |
| 75 const gfx::Rect& new_bounds) OVERRIDE { | 75 const gfx::Rect& new_bounds) override { |
| 76 host_->AnchorUpdated(); | 76 host_->AnchorUpdated(); |
| 77 } | 77 } |
| 78 | 78 |
| 79 virtual void OnWidgetVisibilityChanged(views::Widget* widget, | 79 virtual void OnWidgetVisibilityChanged(views::Widget* widget, |
| 80 bool visible) OVERRIDE { | 80 bool visible) override { |
| 81 host_->AnchorUpdated(); | 81 host_->AnchorUpdated(); |
| 82 } | 82 } |
| 83 | 83 |
| 84 private: | 84 private: |
| 85 TrayBackgroundView* host_; | 85 TrayBackgroundView* host_; |
| 86 | 86 |
| 87 DISALLOW_COPY_AND_ASSIGN(TrayWidgetObserver); | 87 DISALLOW_COPY_AND_ASSIGN(TrayWidgetObserver); |
| 88 }; | 88 }; |
| 89 | 89 |
| 90 class TrayBackground : public views::Background { | 90 class TrayBackground : public views::Background { |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 void set_color(SkColor color) { color_ = color; } | 156 void set_color(SkColor color) { color_ = color; } |
| 157 void set_alpha(int alpha) { color_ = SkColorSetARGB(alpha, 0, 0, 0); } | 157 void set_alpha(int alpha) { color_ = SkColorSetARGB(alpha, 0, 0, 0); } |
| 158 | 158 |
| 159 private: | 159 private: |
| 160 ShelfWidget* GetShelfWidget() const { | 160 ShelfWidget* GetShelfWidget() const { |
| 161 return RootWindowController::ForWindow(tray_background_view_-> | 161 return RootWindowController::ForWindow(tray_background_view_-> |
| 162 status_area_widget()->GetNativeWindow())->shelf(); | 162 status_area_widget()->GetNativeWindow())->shelf(); |
| 163 } | 163 } |
| 164 | 164 |
| 165 // Overridden from views::Background. | 165 // Overridden from views::Background. |
| 166 virtual void Paint(gfx::Canvas* canvas, views::View* view) const OVERRIDE { | 166 virtual void Paint(gfx::Canvas* canvas, views::View* view) const override { |
| 167 int orientation = kImageHorizontal; | 167 int orientation = kImageHorizontal; |
| 168 ShelfWidget* shelf_widget = GetShelfWidget(); | 168 ShelfWidget* shelf_widget = GetShelfWidget(); |
| 169 if (shelf_widget && | 169 if (shelf_widget && |
| 170 !shelf_widget->shelf_layout_manager()->IsHorizontalAlignment()) | 170 !shelf_widget->shelf_layout_manager()->IsHorizontalAlignment()) |
| 171 orientation = kImageVertical; | 171 orientation = kImageVertical; |
| 172 | 172 |
| 173 int state = kImageTypeDefault; | 173 int state = kImageTypeDefault; |
| 174 if (tray_background_view_->draw_background_as_active()) | 174 if (tray_background_view_->draw_background_as_active()) |
| 175 state = kImageTypePressed; | 175 state = kImageTypePressed; |
| 176 else if (shelf_widget && shelf_widget->GetDimsShelf()) | 176 else if (shelf_widget && shelf_widget->GetDimsShelf()) |
| (...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 657 background_->set_alpha(kTrayBackgroundAlpha); | 657 background_->set_alpha(kTrayBackgroundAlpha); |
| 658 SchedulePaint(); | 658 SchedulePaint(); |
| 659 } | 659 } |
| 660 | 660 |
| 661 void TrayBackgroundView::UpdateBubbleViewArrow( | 661 void TrayBackgroundView::UpdateBubbleViewArrow( |
| 662 views::TrayBubbleView* bubble_view) { | 662 views::TrayBubbleView* bubble_view) { |
| 663 // Nothing to do here. | 663 // Nothing to do here. |
| 664 } | 664 } |
| 665 | 665 |
| 666 } // namespace ash | 666 } // namespace ash |
| OLD | NEW |