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

Side by Side Diff: ash/shelf/shelf_widget.cc

Issue 883063003: Revert of Fix shelf dimming on secondary display (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 unified diff | Download patch
« no previous file with comments | « ash/shelf/shelf_layout_manager_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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/shelf/shelf_widget.h" 5 #include "ash/shelf/shelf_widget.h"
6 6
7 #include "ash/ash_switches.h" 7 #include "ash/ash_switches.h"
8 #include "ash/focus_cycler.h" 8 #include "ash/focus_cycler.h"
9 #include "ash/root_window_controller.h" 9 #include "ash/root_window_controller.h"
10 #include "ash/session/session_state_delegate.h" 10 #include "ash/session/session_state_delegate.h"
(...skipping 18 matching lines...) Expand all
29 #include "ui/compositor/layer.h" 29 #include "ui/compositor/layer.h"
30 #include "ui/compositor/scoped_layer_animation_settings.h" 30 #include "ui/compositor/scoped_layer_animation_settings.h"
31 #include "ui/events/event_constants.h" 31 #include "ui/events/event_constants.h"
32 #include "ui/gfx/canvas.h" 32 #include "ui/gfx/canvas.h"
33 #include "ui/gfx/image/image.h" 33 #include "ui/gfx/image/image.h"
34 #include "ui/gfx/image/image_skia_operations.h" 34 #include "ui/gfx/image/image_skia_operations.h"
35 #include "ui/gfx/skbitmap_operations.h" 35 #include "ui/gfx/skbitmap_operations.h"
36 #include "ui/views/accessible_pane_view.h" 36 #include "ui/views/accessible_pane_view.h"
37 #include "ui/views/widget/widget.h" 37 #include "ui/views/widget/widget.h"
38 #include "ui/views/widget/widget_delegate.h" 38 #include "ui/views/widget/widget_delegate.h"
39 #include "ui/wm/core/coordinate_conversion.h"
40 #include "ui/wm/core/easy_resize_window_targeter.h" 39 #include "ui/wm/core/easy_resize_window_targeter.h"
41 #include "ui/wm/public/activation_client.h" 40 #include "ui/wm/public/activation_client.h"
42 41
43 namespace { 42 namespace {
44 // Size of black border at bottom (or side) of shelf. 43 // Size of black border at bottom (or side) of shelf.
45 const int kNumBlackPixels = 3; 44 const int kNumBlackPixels = 3;
46 // Alpha to paint dimming image with. 45 // Alpha to paint dimming image with.
47 const int kDimAlpha = 128; 46 const int kDimAlpha = 128;
48 47
49 // The time to dim and un-dim. 48 // The time to dim and un-dim.
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 } 206 }
208 207
209 DimmerView::DimmerEventFilter::~DimmerEventFilter() { 208 DimmerView::DimmerEventFilter::~DimmerEventFilter() {
210 ash::Shell::GetInstance()->RemovePreTargetHandler(this); 209 ash::Shell::GetInstance()->RemovePreTargetHandler(this);
211 } 210 }
212 211
213 void DimmerView::DimmerEventFilter::OnMouseEvent(ui::MouseEvent* event) { 212 void DimmerView::DimmerEventFilter::OnMouseEvent(ui::MouseEvent* event) {
214 if (event->type() != ui::ET_MOUSE_MOVED && 213 if (event->type() != ui::ET_MOUSE_MOVED &&
215 event->type() != ui::ET_MOUSE_DRAGGED) 214 event->type() != ui::ET_MOUSE_DRAGGED)
216 return; 215 return;
217 216 bool inside = owner_->GetBoundsInScreen().Contains(event->root_location());
218 gfx::Point screen_point(event->location());
219 ::wm::ConvertPointToScreen(static_cast<aura::Window*>(event->target()),
220 &screen_point);
221 bool inside = owner_->GetBoundsInScreen().Contains(screen_point);
222 if (mouse_inside_ || touch_inside_ != inside || touch_inside_) 217 if (mouse_inside_ || touch_inside_ != inside || touch_inside_)
223 owner_->SetHovered(inside || touch_inside_); 218 owner_->SetHovered(inside || touch_inside_);
224 mouse_inside_ = inside; 219 mouse_inside_ = inside;
225 } 220 }
226 221
227 void DimmerView::DimmerEventFilter::OnTouchEvent(ui::TouchEvent* event) { 222 void DimmerView::DimmerEventFilter::OnTouchEvent(ui::TouchEvent* event) {
228 bool touch_inside = false; 223 bool touch_inside = false;
229 if (event->type() != ui::ET_TOUCH_RELEASED && 224 if (event->type() != ui::ET_TOUCH_RELEASED &&
230 event->type() != ui::ET_TOUCH_CANCELLED) { 225 event->type() != ui::ET_TOUCH_CANCELLED)
231 gfx::Point screen_point(event->location()); 226 touch_inside = owner_->GetBoundsInScreen().Contains(event->root_location());
232 ::wm::ConvertPointToScreen(static_cast<aura::Window*>(event->target()),
233 &screen_point);
234 touch_inside = owner_->GetBoundsInScreen().Contains(screen_point);
235 }
236 227
237 if (mouse_inside_ || touch_inside_ != mouse_inside_ || touch_inside) 228 if (mouse_inside_ || touch_inside_ != mouse_inside_ || touch_inside)
238 owner_->SetHovered(mouse_inside_ || touch_inside); 229 owner_->SetHovered(mouse_inside_ || touch_inside);
239 touch_inside_ = touch_inside; 230 touch_inside_ = touch_inside;
240 } 231 }
241 232
242 using ash::ShelfLayoutManager; 233 using ash::ShelfLayoutManager;
243 234
244 // ShelfWindowTargeter makes it easier to resize windows with the mouse when the 235 // ShelfWindowTargeter makes it easier to resize windows with the mouse when the
245 // window-edge slightly overlaps with the shelf edge. The targeter also makes it 236 // window-edge slightly overlaps with the shelf edge. The targeter also makes it
(...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after
838 DCHECK(delegate_view_); 829 DCHECK(delegate_view_);
839 return delegate_view_->disable_dimming_animations_for_test(); 830 return delegate_view_->disable_dimming_animations_for_test();
840 } 831 }
841 832
842 void ShelfWidget::WillDeleteShelf() { 833 void ShelfWidget::WillDeleteShelf() {
843 shelf_layout_manager_->RemoveObserver(this); 834 shelf_layout_manager_->RemoveObserver(this);
844 shelf_layout_manager_ = NULL; 835 shelf_layout_manager_ = NULL;
845 } 836 }
846 837
847 } // namespace ash 838 } // namespace ash
OLDNEW
« no previous file with comments | « ash/shelf/shelf_layout_manager_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698