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

Side by Side Diff: athena/wm/window_overview_mode.cc

Issue 416243004: Enable touch text selection on Athena (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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 | Annotate | Revision Log
« athena/main/athena_main.cc ('K') | « athena/wm/window_manager_impl.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 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 "athena/wm/window_overview_mode.h" 5 #include "athena/wm/window_overview_mode.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <functional> 8 #include <functional>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 103
104 // Prepare the desired transforms for all the windows, and set the initial 104 // Prepare the desired transforms for all the windows, and set the initial
105 // state on the windows. 105 // state on the windows.
106 ComputeTerminalStatesForAllWindows(); 106 ComputeTerminalStatesForAllWindows();
107 SetInitialWindowStates(); 107 SetInitialWindowStates();
108 } 108 }
109 109
110 virtual ~WindowOverviewModeImpl() { 110 virtual ~WindowOverviewModeImpl() {
111 container_->set_target_handler(container_->delegate()); 111 container_->set_target_handler(container_->delegate());
112 112
113 aura::Window::Windows windows = container_->children(); 113 aura::Window::Windows windows = GetNormalWindows();
sadrul 2014/07/25 20:43:14 Mikhail has a CL up (https://codereview.chromium.o
mohsen 2014/07/30 22:49:46 I talked to Mikhail and his patch might take a whi
114 if (windows.empty()) 114 if (windows.empty())
115 return; 115 return;
116 std::for_each(windows.begin(), windows.end(), &RestoreWindowState); 116 std::for_each(windows.begin(), windows.end(), &RestoreWindowState);
117 } 117 }
118 118
119 private: 119 private:
120 aura::Window::Windows GetNormalWindows() const {
121 aura::Window::Windows windows;
122 const aura::Window::Windows& children = container_->children();
123 for (aura::Window::Windows::const_iterator iter = children.begin();
124 iter != children.end();
125 iter++) {
126 if ((*iter)->type() == ui::wm::WINDOW_TYPE_NORMAL)
127 windows.push_back(*iter);
128 }
129 return windows;
130 }
131
120 // Computes the transforms for all windows in both the topmost and bottom-most 132 // Computes the transforms for all windows in both the topmost and bottom-most
121 // positions. The transforms are set in the |kWindowOverviewState| property of 133 // positions. The transforms are set in the |kWindowOverviewState| property of
122 // the windows. 134 // the windows.
123 void ComputeTerminalStatesForAllWindows() { 135 void ComputeTerminalStatesForAllWindows() {
124 aura::Window::Windows windows = container_->children(); 136 aura::Window::Windows windows = GetNormalWindows();
125 size_t window_count = windows.size(); 137 size_t window_count = windows.size();
126 size_t index = 0; 138 size_t index = 0;
127 const gfx::Size container_size = container_->bounds().size(); 139 const gfx::Size container_size = container_->bounds().size();
128 140
129 const int kGapBetweenWindowsBottom = 10; 141 const int kGapBetweenWindowsBottom = 10;
130 const int kGapBetweenWindowsTop = 5; 142 const int kGapBetweenWindowsTop = 5;
131 const float kMinScale = 0.6f; 143 const float kMinScale = 0.6f;
132 const float kMaxScale = 0.95f; 144 const float kMaxScale = 0.95f;
133 145
134 for (aura::Window::Windows::reverse_iterator iter = windows.rbegin(); 146 for (aura::Window::Windows::reverse_iterator iter = windows.rbegin();
(...skipping 17 matching lines...) Expand all
152 state->top = top_transform; 164 state->top = top_transform;
153 state->bottom = bottom_transform; 165 state->bottom = bottom_transform;
154 state->progress = 0.f; 166 state->progress = 0.f;
155 state->shadow = CreateShadowForWindow(window); 167 state->shadow = CreateShadowForWindow(window);
156 window->SetProperty(kWindowOverviewState, state); 168 window->SetProperty(kWindowOverviewState, state);
157 } 169 }
158 } 170 }
159 171
160 // Sets the initial position for the windows for the overview mode. 172 // Sets the initial position for the windows for the overview mode.
161 void SetInitialWindowStates() { 173 void SetInitialWindowStates() {
162 aura::Window::Windows windows = container_->children(); 174 aura::Window::Windows windows = GetNormalWindows();
163 size_t window_count = windows.size(); 175 size_t window_count = windows.size();
164 // The initial overview state of the topmost three windows. 176 // The initial overview state of the topmost three windows.
165 const float kInitialProgress[] = { 0.5f, 0.05f, 0.01f }; 177 const float kInitialProgress[] = { 0.5f, 0.05f, 0.01f };
166 for (size_t i = 0; i < window_count; ++i) { 178 for (size_t i = 0; i < window_count; ++i) {
167 float progress = 0.f; 179 float progress = 0.f;
168 aura::Window* window = windows[window_count - 1 - i]; 180 aura::Window* window = windows[window_count - 1 - i];
169 if (i < arraysize(kInitialProgress)) 181 if (i < arraysize(kInitialProgress))
170 progress = kInitialProgress[i]; 182 progress = kInitialProgress[i];
171 183
172 scoped_refptr<ui::LayerAnimator> animator = 184 scoped_refptr<ui::LayerAnimator> animator =
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 targeter->FindTargetForLocatedEvent(container_, event)); 227 targeter->FindTargetForLocatedEvent(container_, event));
216 while (target && target->parent() != container_) 228 while (target && target->parent() != container_)
217 target = target->parent(); 229 target = target->parent();
218 return target; 230 return target;
219 } 231 }
220 232
221 // Scroll the window list by |delta_y| amount. |delta_y| is negative when 233 // Scroll the window list by |delta_y| amount. |delta_y| is negative when
222 // scrolling up; and positive when scrolling down. 234 // scrolling up; and positive when scrolling down.
223 void DoScroll(float delta_y) { 235 void DoScroll(float delta_y) {
224 const float kEpsilon = 1e-3f; 236 const float kEpsilon = 1e-3f;
225 aura::Window::Windows windows = container_->children(); 237 aura::Window::Windows windows = GetNormalWindows();
226 float delta_y_p = std::abs(delta_y) / GetScrollableHeight(); 238 float delta_y_p = std::abs(delta_y) / GetScrollableHeight();
227 if (delta_y < 0) { 239 if (delta_y < 0) {
228 // Scroll up. Start with the top-most (i.e. behind-most in terms of 240 // Scroll up. Start with the top-most (i.e. behind-most in terms of
229 // z-index) window, and try to scroll them up. 241 // z-index) window, and try to scroll them up.
230 for (aura::Window::Windows::iterator iter = windows.begin(); 242 for (aura::Window::Windows::iterator iter = windows.begin();
231 delta_y_p > kEpsilon && iter != windows.end(); 243 delta_y_p > kEpsilon && iter != windows.end();
232 ++iter) { 244 ++iter) {
233 aura::Window* window = (*iter); 245 aura::Window* window = (*iter);
234 WindowOverviewState* state = window->GetProperty(kWindowOverviewState); 246 WindowOverviewState* state = window->GetProperty(kWindowOverviewState);
235 if (state->progress > kEpsilon) { 247 if (state->progress > kEpsilon) {
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 316
305 // static 317 // static
306 scoped_ptr<WindowOverviewMode> WindowOverviewMode::Create( 318 scoped_ptr<WindowOverviewMode> WindowOverviewMode::Create(
307 aura::Window* container, 319 aura::Window* container,
308 WindowOverviewModeDelegate* delegate) { 320 WindowOverviewModeDelegate* delegate) {
309 return scoped_ptr<WindowOverviewMode>( 321 return scoped_ptr<WindowOverviewMode>(
310 new WindowOverviewModeImpl(container, delegate)); 322 new WindowOverviewModeImpl(container, delegate));
311 } 323 }
312 324
313 } // namespace athena 325 } // namespace athena
OLDNEW
« athena/main/athena_main.cc ('K') | « athena/wm/window_manager_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698