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

Side by Side Diff: ash/wm/resize_handle_window_targeter.cc

Issue 2095193002: clang-format all of //ash (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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/wm/power_button_controller.cc ('k') | ash/wm/resize_shadow.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/wm/resize_handle_window_targeter.h" 5 #include "ash/wm/resize_handle_window_targeter.h"
6 6
7 #include "ash/common/ash_constants.h" 7 #include "ash/common/ash_constants.h"
8 #include "ash/common/wm/window_state.h" 8 #include "ash/common/wm/window_state.h"
9 #include "ash/wm/immersive_fullscreen_controller.h" 9 #include "ash/wm/immersive_fullscreen_controller.h"
10 #include "ash/wm/window_state_aura.h" 10 #include "ash/wm/window_state_aura.h"
11 #include "ui/aura/window.h" 11 #include "ui/aura/window.h"
12 #include "ui/events/event.h" 12 #include "ui/events/event.h"
13 13
14 namespace ash { 14 namespace ash {
15 15
16 ResizeHandleWindowTargeter::ResizeHandleWindowTargeter( 16 ResizeHandleWindowTargeter::ResizeHandleWindowTargeter(
17 aura::Window* window, 17 aura::Window* window,
18 ImmersiveFullscreenController* controller) 18 ImmersiveFullscreenController* controller)
19 : window_(window), 19 : window_(window), immersive_controller_(controller) {
20 immersive_controller_(controller) {
21 wm::WindowState* window_state = wm::GetWindowState(window_); 20 wm::WindowState* window_state = wm::GetWindowState(window_);
22 OnPostWindowStateTypeChange(window_state, wm::WINDOW_STATE_TYPE_DEFAULT); 21 OnPostWindowStateTypeChange(window_state, wm::WINDOW_STATE_TYPE_DEFAULT);
23 window_state->AddObserver(this); 22 window_state->AddObserver(this);
24 window_->AddObserver(this); 23 window_->AddObserver(this);
25 } 24 }
26 25
27 ResizeHandleWindowTargeter::~ResizeHandleWindowTargeter() { 26 ResizeHandleWindowTargeter::~ResizeHandleWindowTargeter() {
28 if (window_) { 27 if (window_) {
29 window_->RemoveObserver(this); 28 window_->RemoveObserver(this);
30 wm::GetWindowState(window_)->RemoveObserver(this); 29 wm::GetWindowState(window_)->RemoveObserver(this);
31 } 30 }
32 } 31 }
33 32
34 void ResizeHandleWindowTargeter::OnPostWindowStateTypeChange( 33 void ResizeHandleWindowTargeter::OnPostWindowStateTypeChange(
35 wm::WindowState* window_state, 34 wm::WindowState* window_state,
36 wm::WindowStateType old_type) { 35 wm::WindowStateType old_type) {
37 if (window_state->IsMaximizedOrFullscreenOrPinned()) { 36 if (window_state->IsMaximizedOrFullscreenOrPinned()) {
38 frame_border_inset_ = gfx::Insets(); 37 frame_border_inset_ = gfx::Insets();
39 } else { 38 } else {
40 frame_border_inset_ = gfx::Insets(kResizeInsideBoundsSize, 39 frame_border_inset_ =
41 kResizeInsideBoundsSize, 40 gfx::Insets(kResizeInsideBoundsSize, kResizeInsideBoundsSize,
42 kResizeInsideBoundsSize, 41 kResizeInsideBoundsSize, kResizeInsideBoundsSize);
43 kResizeInsideBoundsSize);
44 } 42 }
45 } 43 }
46 44
47 void ResizeHandleWindowTargeter::OnWindowDestroying(aura::Window* window) { 45 void ResizeHandleWindowTargeter::OnWindowDestroying(aura::Window* window) {
48 CHECK_EQ(window_, window); 46 CHECK_EQ(window_, window);
49 wm::GetWindowState(window_)->RemoveObserver(this); 47 wm::GetWindowState(window_)->RemoveObserver(this);
50 window_ = NULL; 48 window_ = NULL;
51 } 49 }
52 50
53 aura::Window* ResizeHandleWindowTargeter::FindTargetForLocatedEvent( 51 aura::Window* ResizeHandleWindowTargeter::FindTargetForLocatedEvent(
54 aura::Window* window, 52 aura::Window* window,
55 ui::LocatedEvent* event) { 53 ui::LocatedEvent* event) {
56 if (window == window_) { 54 if (window == window_) {
57 gfx::Insets insets; 55 gfx::Insets insets;
58 if (immersive_controller_ && immersive_controller_->IsEnabled() && 56 if (immersive_controller_ && immersive_controller_->IsEnabled() &&
59 !immersive_controller_->IsRevealed() && 57 !immersive_controller_->IsRevealed() && event->IsTouchEvent()) {
60 event->IsTouchEvent()) {
61 // If the window is in immersive fullscreen, and top-of-window views are 58 // If the window is in immersive fullscreen, and top-of-window views are
62 // not revealed, then touch events towards the top of the window 59 // not revealed, then touch events towards the top of the window
63 // should not reach the child window so that touch gestures can be used to 60 // should not reach the child window so that touch gestures can be used to
64 // reveal the top-of-windows views. This is needed because the child 61 // reveal the top-of-windows views. This is needed because the child
65 // window may consume touch events and prevent touch-scroll gesture from 62 // window may consume touch events and prevent touch-scroll gesture from
66 // being generated. 63 // being generated.
67 insets = gfx::Insets(kImmersiveFullscreenTopEdgeInset, 0, 0, 0); 64 insets = gfx::Insets(kImmersiveFullscreenTopEdgeInset, 0, 0, 0);
68 } else { 65 } else {
69 // If the event falls very close to the inside of the frame border, then 66 // If the event falls very close to the inside of the frame border, then
70 // target the window itself, so that the window can be resized easily. 67 // target the window itself, so that the window can be resized easily.
(...skipping 22 matching lines...) Expand all
93 aura::WindowTargeter* targeter = 90 aura::WindowTargeter* targeter =
94 static_cast<aura::WindowTargeter*>(parent->GetEventTargeter()); 91 static_cast<aura::WindowTargeter*>(parent->GetEventTargeter());
95 if (targeter) 92 if (targeter)
96 return targeter->SubtreeShouldBeExploredForEvent(window, event); 93 return targeter->SubtreeShouldBeExploredForEvent(window, event);
97 } 94 }
98 } 95 }
99 return aura::WindowTargeter::SubtreeShouldBeExploredForEvent(window, event); 96 return aura::WindowTargeter::SubtreeShouldBeExploredForEvent(window, event);
100 } 97 }
101 98
102 } // namespace ash 99 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/power_button_controller.cc ('k') | ash/wm/resize_shadow.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698