OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/common/shelf/shelf_button.h" | 5 #include "ash/common/shelf/shelf_button.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "ash/common/ash_constants.h" | 9 #include "ash/common/ash_constants.h" |
10 #include "ash/common/material_design/material_design_controller.h" | 10 #include "ash/common/material_design/material_design_controller.h" |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 | 139 |
140 class ShelfButton::BarView : public views::ImageView, | 140 class ShelfButton::BarView : public views::ImageView, |
141 public ShelfButtonAnimation::Observer { | 141 public ShelfButtonAnimation::Observer { |
142 public: | 142 public: |
143 BarView(WmShelf* wm_shelf) | 143 BarView(WmShelf* wm_shelf) |
144 : wm_shelf_(wm_shelf), | 144 : wm_shelf_(wm_shelf), |
145 show_attention_(false), | 145 show_attention_(false), |
146 animation_end_time_(base::TimeTicks()), | 146 animation_end_time_(base::TimeTicks()), |
147 animating_(false) { | 147 animating_(false) { |
148 // Make sure the events reach the parent view for handling. | 148 // Make sure the events reach the parent view for handling. |
149 set_interactive(false); | 149 set_can_process_events_within_subtree(false); |
150 } | 150 } |
151 | 151 |
152 ~BarView() override { | 152 ~BarView() override { |
153 if (show_attention_) | 153 if (show_attention_) |
154 ShelfButtonAnimation::GetInstance()->RemoveObserver(this); | 154 ShelfButtonAnimation::GetInstance()->RemoveObserver(this); |
155 } | 155 } |
156 | 156 |
157 // views::View: | 157 // views::View: |
158 void OnPaint(gfx::Canvas* canvas) override { | 158 void OnPaint(gfx::Canvas* canvas) override { |
159 if (show_attention_) { | 159 if (show_attention_) { |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 gfx::ShadowValue(gfx::Vector2d(0, 0), 1, SkColorSetARGB(0x54, 0, 0, 0)), | 269 gfx::ShadowValue(gfx::Vector2d(0, 0), 1, SkColorSetARGB(0x54, 0, 0, 0)), |
270 }; | 270 }; |
271 icon_shadows_.assign(kShadows, kShadows + arraysize(kShadows)); | 271 icon_shadows_.assign(kShadows, kShadows + arraysize(kShadows)); |
272 | 272 |
273 // TODO: refactor the layers so each button doesn't require 2. | 273 // TODO: refactor the layers so each button doesn't require 2. |
274 icon_view_->SetPaintToLayer(); | 274 icon_view_->SetPaintToLayer(); |
275 icon_view_->layer()->SetFillsBoundsOpaquely(false); | 275 icon_view_->layer()->SetFillsBoundsOpaquely(false); |
276 icon_view_->SetHorizontalAlignment(views::ImageView::CENTER); | 276 icon_view_->SetHorizontalAlignment(views::ImageView::CENTER); |
277 icon_view_->SetVerticalAlignment(views::ImageView::LEADING); | 277 icon_view_->SetVerticalAlignment(views::ImageView::LEADING); |
278 // Do not make this interactive, so that events are sent to ShelfView. | 278 // Do not make this interactive, so that events are sent to ShelfView. |
279 icon_view_->set_interactive(false); | 279 icon_view_->set_can_process_events_within_subtree(false); |
280 | 280 |
281 AddChildView(bar_); | 281 AddChildView(bar_); |
282 AddChildView(icon_view_); | 282 AddChildView(icon_view_); |
283 } | 283 } |
284 | 284 |
285 ShelfButton::~ShelfButton() { | 285 ShelfButton::~ShelfButton() { |
286 if (destroyed_flag_) | 286 if (destroyed_flag_) |
287 *destroyed_flag_ = true; | 287 *destroyed_flag_ = true; |
288 } | 288 } |
289 | 289 |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
595 bar_->SetHorizontalAlignment(views::ImageView::TRAILING); | 595 bar_->SetHorizontalAlignment(views::ImageView::TRAILING); |
596 bar_->SetVerticalAlignment(views::ImageView::CENTER); | 596 bar_->SetVerticalAlignment(views::ImageView::CENTER); |
597 break; | 597 break; |
598 } | 598 } |
599 bar_->SchedulePaint(); | 599 bar_->SchedulePaint(); |
600 } | 600 } |
601 bar_->SetVisible(bar_id != 0 && state_ != STATE_NORMAL); | 601 bar_->SetVisible(bar_id != 0 && state_ != STATE_NORMAL); |
602 } | 602 } |
603 | 603 |
604 } // namespace ash | 604 } // namespace ash |
OLD | NEW |