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/wm/overview/window_selector.h" | 5 #include "ash/wm/overview/window_selector.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <functional> | 8 #include <functional> |
9 #include <set> | 9 #include <set> |
10 #include <utility> | 10 #include <utility> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "ash/accessibility_delegate.h" | 13 #include "ash/accessibility_delegate.h" |
14 #include "ash/accessibility_types.h" | 14 #include "ash/accessibility_types.h" |
15 #include "ash/metrics/user_metrics_action.h" | 15 #include "ash/metrics/user_metrics_action.h" |
16 #include "ash/public/cpp/shell_window_ids.h" | 16 #include "ash/public/cpp/shell_window_ids.h" |
17 #include "ash/root_window_controller.h" | 17 #include "ash/root_window_controller.h" |
18 #include "ash/screen_util.h" | 18 #include "ash/screen_util.h" |
19 #include "ash/shelf/shelf.h" | 19 #include "ash/shelf/shelf.h" |
20 #include "ash/shell.h" | 20 #include "ash/shell.h" |
21 #include "ash/shell_port.h" | 21 #include "ash/shell_port.h" |
22 #include "ash/wm/mru_window_tracker.h" | 22 #include "ash/wm/mru_window_tracker.h" |
23 #include "ash/wm/overview/overview_window_drag_controller.h" | |
23 #include "ash/wm/overview/window_grid.h" | 24 #include "ash/wm/overview/window_grid.h" |
24 #include "ash/wm/overview/window_selector_delegate.h" | 25 #include "ash/wm/overview/window_selector_delegate.h" |
25 #include "ash/wm/overview/window_selector_item.h" | 26 #include "ash/wm/overview/window_selector_item.h" |
26 #include "ash/wm/panels/panel_layout_manager.h" | 27 #include "ash/wm/panels/panel_layout_manager.h" |
28 #include "ash/wm/splitview/split_view_controller.h" | |
27 #include "ash/wm/switchable_windows.h" | 29 #include "ash/wm/switchable_windows.h" |
28 #include "ash/wm/window_state.h" | 30 #include "ash/wm/window_state.h" |
29 #include "ash/wm/window_util.h" | 31 #include "ash/wm/window_util.h" |
30 #include "base/auto_reset.h" | 32 #include "base/auto_reset.h" |
31 #include "base/command_line.h" | 33 #include "base/command_line.h" |
32 #include "base/metrics/histogram_macros.h" | 34 #include "base/metrics/histogram_macros.h" |
33 #include "third_party/skia/include/core/SkPath.h" | 35 #include "third_party/skia/include/core/SkPath.h" |
34 #include "ui/base/resource/resource_bundle.h" | 36 #include "ui/base/resource/resource_bundle.h" |
35 #include "ui/compositor/layer.h" | 37 #include "ui/compositor/layer.h" |
36 #include "ui/compositor/scoped_layer_animation_settings.h" | 38 #include "ui/compositor/scoped_layer_animation_settings.h" |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
131 | 133 |
132 DISALLOW_COPY_AND_ASSIGN(RoundedContainerView); | 134 DISALLOW_COPY_AND_ASSIGN(RoundedContainerView); |
133 }; | 135 }; |
134 | 136 |
135 // Triggers a shelf visibility update on all root window controllers. | 137 // Triggers a shelf visibility update on all root window controllers. |
136 void UpdateShelfVisibility() { | 138 void UpdateShelfVisibility() { |
137 for (aura::Window* root : Shell::GetAllRootWindows()) | 139 for (aura::Window* root : Shell::GetAllRootWindows()) |
138 Shelf::ForWindow(root)->UpdateVisibilityState(); | 140 Shelf::ForWindow(root)->UpdateVisibilityState(); |
139 } | 141 } |
140 | 142 |
143 // Returns the bounds for the overview window grids according to the split view | |
144 // state. | |
145 gfx::Rect GetGridsBoundsInScreen(aura::Window* root_window) { | |
146 gfx::Rect bounds_in_screen; | |
147 if (Shell::Get()->IsSplitViewModeActive()) { | |
148 SplitViewController::State state = | |
149 Shell::Get()->split_view_controller()->state(); | |
150 DCHECK(state != SplitViewController::NOSNAP); | |
151 if (state == SplitViewController::RIGHT_SNAPPED) { | |
152 // Open overview in the left side of the screen. | |
153 bounds_in_screen = | |
154 Shell::Get()->split_view_controller()->GetLeftWindowBoundsInScreen( | |
oshima
2017/06/14 00:19:27
it's probably better to have
GetSnappedWindowBoun
xdai1
2017/06/15 22:11:41
Done.
| |
155 root_window); | |
156 } else if (state == SplitViewController::LEFT_SNAPPED) { | |
157 // Open overview in the right side of the screen. | |
158 bounds_in_screen = | |
159 Shell::Get()->split_view_controller()->GetRightWindowBoundsInScreen( | |
160 root_window); | |
161 } | |
162 } else { | |
163 bounds_in_screen = ScreenUtil::GetDisplayWorkAreaBoundsInParent( | |
164 root_window->GetChildById(kShellWindowId_DefaultContainer)); | |
165 ::wm::ConvertRectToScreen(root_window, &bounds_in_screen); | |
166 } | |
167 | |
168 return bounds_in_screen; | |
169 } | |
170 | |
141 gfx::Rect GetTextFilterPosition(aura::Window* root_window) { | 171 gfx::Rect GetTextFilterPosition(aura::Window* root_window) { |
142 gfx::Rect total_bounds = ScreenUtil::GetDisplayWorkAreaBoundsInParent( | 172 gfx::Rect total_bounds = GetGridsBoundsInScreen(root_window); |
143 root_window->GetChildById(kShellWindowId_DefaultContainer)); | |
144 ::wm::ConvertRectToScreen(root_window, &total_bounds); | |
145 return gfx::Rect( | 173 return gfx::Rect( |
146 0.5 * (total_bounds.width() - | 174 0.5 * (total_bounds.width() - |
147 std::min(kTextFilterWidth, total_bounds.width())), | 175 std::min(kTextFilterWidth, total_bounds.width())) + |
176 total_bounds.x(), | |
148 total_bounds.y() + total_bounds.height() * kTextFilterTopScreenProportion, | 177 total_bounds.y() + total_bounds.height() * kTextFilterTopScreenProportion, |
149 std::min(kTextFilterWidth, total_bounds.width()), kTextFilterHeight); | 178 std::min(kTextFilterWidth, total_bounds.width()), kTextFilterHeight); |
150 } | 179 } |
151 | 180 |
152 // Initializes the text filter on the top of the main root window and requests | 181 // Initializes the text filter on the top of the main root window and requests |
153 // focus on its textfield. Uses |image| to place an icon to the left of the text | 182 // focus on its textfield. Uses |image| to place an icon to the left of the text |
154 // field. | 183 // field. |
155 views::Widget* CreateTextFilter(views::TextfieldController* controller, | 184 views::Widget* CreateTextFilter(views::TextfieldController* controller, |
156 aura::Window* root_window, | 185 aura::Window* root_window, |
157 const gfx::ImageSkia& image, | 186 const gfx::ImageSkia& image, |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
264 aura::Window* container = | 293 aura::Window* container = |
265 root->GetChildById(wm::kSwitchableWindowContainerIds[i]); | 294 root->GetChildById(wm::kSwitchableWindowContainerIds[i]); |
266 container->AddObserver(this); | 295 container->AddObserver(this); |
267 observed_windows_.insert(container); | 296 observed_windows_.insert(container); |
268 } | 297 } |
269 | 298 |
270 // Hide the callout widgets for panels. It is safe to call this for | 299 // Hide the callout widgets for panels. It is safe to call this for |
271 // root windows that don't contain any panel windows. | 300 // root windows that don't contain any panel windows. |
272 PanelLayoutManager::Get(root)->SetShowCalloutWidgets(false); | 301 PanelLayoutManager::Get(root)->SetShowCalloutWidgets(false); |
273 | 302 |
274 std::unique_ptr<WindowGrid> grid(new WindowGrid(root, windows, this)); | 303 std::unique_ptr<WindowGrid> grid( |
304 new WindowGrid(root, windows, this, GetGridsBoundsInScreen(root))); | |
275 if (grid->empty()) | 305 if (grid->empty()) |
276 continue; | 306 continue; |
277 num_items_ += grid->size(); | 307 num_items_ += grid->size(); |
278 grid_list_.push_back(std::move(grid)); | 308 grid_list_.push_back(std::move(grid)); |
279 } | 309 } |
280 | 310 |
281 { | 311 { |
282 // The calls to WindowGrid::PrepareForOverview() and CreateTextFilter(...) | 312 // The calls to WindowGrid::PrepareForOverview() and CreateTextFilter(...) |
283 // requires some LayoutManagers (ie PanelLayoutManager) to perform layouts | 313 // requires some LayoutManagers (ie PanelLayoutManager) to perform layouts |
284 // so that windows are correctly visible and properly animated in overview | 314 // so that windows are correctly visible and properly animated in overview |
(...skipping 16 matching lines...) Expand all Loading... | |
301 kTextFilterIconColor); | 331 kTextFilterIconColor); |
302 aura::Window* root_window = Shell::GetPrimaryRootWindow(); | 332 aura::Window* root_window = Shell::GetPrimaryRootWindow(); |
303 text_filter_widget_.reset(CreateTextFilter(this, root_window, search_image_, | 333 text_filter_widget_.reset(CreateTextFilter(this, root_window, search_image_, |
304 &text_filter_bottom_)); | 334 &text_filter_bottom_)); |
305 } | 335 } |
306 | 336 |
307 DCHECK(!grid_list_.empty()); | 337 DCHECK(!grid_list_.empty()); |
308 UMA_HISTOGRAM_COUNTS_100("Ash.WindowSelector.Items", num_items_); | 338 UMA_HISTOGRAM_COUNTS_100("Ash.WindowSelector.Items", num_items_); |
309 | 339 |
310 Shell::Get()->activation_client()->AddObserver(this); | 340 Shell::Get()->activation_client()->AddObserver(this); |
341 Shell::Get()->split_view_controller()->AddObserver(this); | |
311 | 342 |
312 display::Screen::GetScreen()->AddObserver(this); | 343 display::Screen::GetScreen()->AddObserver(this); |
313 ShellPort::Get()->RecordUserMetricsAction(UMA_WINDOW_OVERVIEW); | 344 ShellPort::Get()->RecordUserMetricsAction(UMA_WINDOW_OVERVIEW); |
314 // Send an a11y alert. | 345 // Send an a11y alert. |
315 Shell::Get()->accessibility_delegate()->TriggerAccessibilityAlert( | 346 Shell::Get()->accessibility_delegate()->TriggerAccessibilityAlert( |
316 A11Y_ALERT_WINDOW_OVERVIEW_MODE_ENTERED); | 347 A11Y_ALERT_WINDOW_OVERVIEW_MODE_ENTERED); |
317 | 348 |
318 UpdateShelfVisibility(); | 349 UpdateShelfVisibility(); |
319 } | 350 } |
320 | 351 |
321 // NOTE: The work done in Shutdown() is not done in the destructor because it | 352 // NOTE: The work done in Shutdown() is not done in the destructor because it |
322 // may cause other, unrelated classes, (ie PanelLayoutManager) to make indirect | 353 // may cause other, unrelated classes, (ie PanelLayoutManager) to make indirect |
323 // calls to restoring_minimized_windows() on a partially destructed object. | 354 // calls to restoring_minimized_windows() on a partially destructed object. |
324 void WindowSelector::Shutdown() { | 355 void WindowSelector::Shutdown() { |
325 is_shut_down_ = true; | 356 is_shut_down_ = true; |
326 // Stop observing screen metrics changes first to avoid auto-positioning | 357 // Stop observing screen metrics changes first to avoid auto-positioning |
327 // windows in response to work area changes from window activation. | 358 // windows in response to work area changes from window activation. |
328 display::Screen::GetScreen()->RemoveObserver(this); | 359 display::Screen::GetScreen()->RemoveObserver(this); |
329 | 360 |
361 // Stop observing split view state changes before restoring window focus. | |
362 // Otherwise the activation of the window triggers OnSplitViewStateChanged() | |
363 // that will call into this function again. | |
364 Shell::Get()->split_view_controller()->RemoveObserver(this); | |
365 | |
330 size_t remaining_items = 0; | 366 size_t remaining_items = 0; |
331 for (std::unique_ptr<WindowGrid>& window_grid : grid_list_) { | 367 for (std::unique_ptr<WindowGrid>& window_grid : grid_list_) { |
332 for (const auto& window_selector_item : window_grid->window_list()) | 368 for (const auto& window_selector_item : window_grid->window_list()) |
333 window_selector_item->RestoreWindow(); | 369 window_selector_item->RestoreWindow(); |
334 remaining_items += window_grid->size(); | 370 remaining_items += window_grid->size(); |
335 } | 371 } |
336 | 372 |
337 // Setting focus after restoring windows' state avoids unnecessary animations. | 373 // Setting focus after restoring windows' state avoids unnecessary animations. |
338 ResetFocusRestoreWindow(true); | 374 ResetFocusRestoreWindow(true); |
339 RemoveAllObservers(); | 375 RemoveAllObservers(); |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
439 } | 475 } |
440 } | 476 } |
441 item->EnsureVisible(); | 477 item->EnsureVisible(); |
442 wm::GetWindowState(window)->Activate(); | 478 wm::GetWindowState(window)->Activate(); |
443 } | 479 } |
444 | 480 |
445 void WindowSelector::WindowClosing(WindowSelectorItem* window) { | 481 void WindowSelector::WindowClosing(WindowSelectorItem* window) { |
446 grid_list_[selected_grid_index_]->WindowClosing(window); | 482 grid_list_[selected_grid_index_]->WindowClosing(window); |
447 } | 483 } |
448 | 484 |
485 void WindowSelector::SetBoundsForWindowGridsInScreen(const gfx::Rect bounds) { | |
486 for (std::unique_ptr<WindowGrid>& grid : grid_list_) | |
487 grid->SetBoundsInScreen(bounds); | |
488 } | |
489 | |
490 void WindowSelector::RemoveWindowSelectorItem(WindowSelectorItem* item) { | |
491 if (item->GetWindow()->HasObserver(this)) { | |
492 item->GetWindow()->RemoveObserver(this); | |
493 observed_windows_.erase(item->GetWindow()); | |
494 if (item->GetWindow() == restore_focus_window_) | |
495 restore_focus_window_ = nullptr; | |
496 } | |
497 | |
498 // Remove |item| from the corresponding grid. | |
499 for (std::unique_ptr<WindowGrid>& grid : grid_list_) { | |
500 if (grid->Contains(item->GetWindow())) { | |
501 grid->RemoveItem(item); | |
502 break; | |
503 } | |
504 } | |
505 } | |
506 | |
507 void WindowSelector::InitiateDrag(WindowSelectorItem* item, | |
508 const gfx::Point& location_in_screen) { | |
509 window_drag_controller_.reset(new OverviewWindowDragController(this)); | |
oshima
2017/06/14 00:19:27
MakeUnique
xdai1
2017/06/15 22:11:42
reset is better here since |window_drag_controller
| |
510 window_drag_controller_->InitiateDrag(item, location_in_screen); | |
511 } | |
512 | |
513 void WindowSelector::Drag(WindowSelectorItem* item, | |
514 const gfx::Point& location_in_screen) { | |
515 DCHECK(window_drag_controller_.get()); | |
oshima
2017/06/14 00:19:27
it'll crash immediately, so you don't need this.
xdai1
2017/06/15 22:11:41
I don't understand. Why will it crash immediately?
| |
516 window_drag_controller_->Drag(item, location_in_screen); | |
517 } | |
518 | |
519 void WindowSelector::CompleteDrag(WindowSelectorItem* item) { | |
520 DCHECK(window_drag_controller_.get()); | |
oshima
2017/06/14 00:19:27
same here
xdai1
2017/06/15 22:11:41
ditto
| |
521 window_drag_controller_->CompleteDrag(item); | |
522 } | |
523 | |
449 bool WindowSelector::HandleKeyEvent(views::Textfield* sender, | 524 bool WindowSelector::HandleKeyEvent(views::Textfield* sender, |
450 const ui::KeyEvent& key_event) { | 525 const ui::KeyEvent& key_event) { |
451 if (key_event.type() != ui::ET_KEY_PRESSED) | 526 if (key_event.type() != ui::ET_KEY_PRESSED) |
452 return false; | 527 return false; |
453 | 528 |
454 switch (key_event.key_code()) { | 529 switch (key_event.key_code()) { |
455 case ui::VKEY_ESCAPE: | 530 case ui::VKEY_ESCAPE: |
456 CancelSelection(); | 531 CancelSelection(); |
457 break; | 532 break; |
458 case ui::VKEY_UP: | 533 case ui::VKEY_UP: |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
505 | 580 |
506 void WindowSelector::OnDisplayAdded(const display::Display& display) {} | 581 void WindowSelector::OnDisplayAdded(const display::Display& display) {} |
507 | 582 |
508 void WindowSelector::OnDisplayRemoved(const display::Display& display) { | 583 void WindowSelector::OnDisplayRemoved(const display::Display& display) { |
509 // TODO(flackr): Keep window selection active on remaining displays. | 584 // TODO(flackr): Keep window selection active on remaining displays. |
510 CancelSelection(); | 585 CancelSelection(); |
511 } | 586 } |
512 | 587 |
513 void WindowSelector::OnDisplayMetricsChanged(const display::Display& display, | 588 void WindowSelector::OnDisplayMetricsChanged(const display::Display& display, |
514 uint32_t metrics) { | 589 uint32_t metrics) { |
590 // Re-calculate the bounds for the window grids and position all the windows. | |
591 for (std::unique_ptr<WindowGrid>& grid : grid_list_) { | |
592 SetBoundsForWindowGridsInScreen( | |
593 GetGridsBoundsInScreen(const_cast<aura::Window*>(grid->root_window()))); | |
594 } | |
515 PositionWindows(/* animate */ false); | 595 PositionWindows(/* animate */ false); |
516 RepositionTextFilterOnDisplayMetricsChange(); | 596 RepositionTextFilterOnDisplayMetricsChange(); |
517 } | 597 } |
518 | 598 |
519 void WindowSelector::OnWindowHierarchyChanged( | 599 void WindowSelector::OnWindowHierarchyChanged( |
520 const HierarchyChangeParams& params) { | 600 const HierarchyChangeParams& params) { |
521 // Only care about newly added children of |observed_windows_|. | 601 // Only care about newly added children of |observed_windows_|. |
522 if (!observed_windows_.count(params.receiver) || | 602 if (!observed_windows_.count(params.receiver) || |
523 !observed_windows_.count(params.new_parent)) { | 603 !observed_windows_.count(params.new_parent)) { |
524 return; | 604 return; |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
567 windows.begin(), windows.end(), | 647 windows.begin(), windows.end(), |
568 [gained_active](const std::unique_ptr<WindowSelectorItem>& window) { | 648 [gained_active](const std::unique_ptr<WindowSelectorItem>& window) { |
569 return window->Contains(gained_active); | 649 return window->Contains(gained_active); |
570 }); | 650 }); |
571 | 651 |
572 if (iter == windows.end() && showing_text_filter_ && | 652 if (iter == windows.end() && showing_text_filter_ && |
573 lost_active == GetTextFilterWidgetWindow()) { | 653 lost_active == GetTextFilterWidgetWindow()) { |
574 return; | 654 return; |
575 } | 655 } |
576 | 656 |
657 if (Shell::Get()->IsSplitViewModeActive()) | |
658 return; | |
oshima
2017/06/14 00:19:27
not clear to me why you need this. Can you elabora
xdai1
2017/06/15 22:11:41
The window activation might be caused by window sn
| |
659 | |
577 // Don't restore focus on exit if a window was just activated. | 660 // Don't restore focus on exit if a window was just activated. |
578 ResetFocusRestoreWindow(false); | 661 ResetFocusRestoreWindow(false); |
579 CancelSelection(); | 662 CancelSelection(); |
580 } | 663 } |
581 | 664 |
582 void WindowSelector::OnAttemptToReactivateWindow(aura::Window* request_active, | 665 void WindowSelector::OnAttemptToReactivateWindow(aura::Window* request_active, |
583 aura::Window* actual_active) { | 666 aura::Window* actual_active) { |
584 OnWindowActivated(ActivationReason::ACTIVATION_CLIENT, request_active, | 667 OnWindowActivated(ActivationReason::ACTIVATION_CLIENT, request_active, |
585 actual_active); | 668 actual_active); |
586 } | 669 } |
(...skipping 30 matching lines...) Expand all Loading... | |
617 for (auto iter = grid_list_.begin(); iter != grid_list_.end(); iter++) | 700 for (auto iter = grid_list_.begin(); iter != grid_list_.end(); iter++) |
618 (*iter)->FilterItems(new_contents); | 701 (*iter)->FilterItems(new_contents); |
619 | 702 |
620 // If the selection widget is not active, execute a Move() command so that it | 703 // If the selection widget is not active, execute a Move() command so that it |
621 // shows up on the first undimmed item. | 704 // shows up on the first undimmed item. |
622 if (grid_list_[selected_grid_index_]->is_selecting()) | 705 if (grid_list_[selected_grid_index_]->is_selecting()) |
623 return; | 706 return; |
624 Move(WindowSelector::RIGHT, false); | 707 Move(WindowSelector::RIGHT, false); |
625 } | 708 } |
626 | 709 |
627 aura::Window* WindowSelector::GetTextFilterWidgetWindow() { | 710 void WindowSelector::OnSplitViewStateChanged( |
628 return text_filter_widget_->GetNativeWindow(); | 711 SplitViewController::State previous_state, |
712 SplitViewController::State state) { | |
713 if (state != SplitViewController::NOSNAP) { | |
714 // Do not restore focus if a window was just snapped and activated. | |
715 ResetFocusRestoreWindow(false); | |
716 } | |
717 | |
718 if (state == SplitViewController::BOTH_SNAPPED) { | |
719 CancelSelection(); | |
720 } else if (state == SplitViewController::LEFT_SNAPPED) { | |
721 aura::Window* snapped_window = | |
722 Shell::Get()->split_view_controller()->left_window(); | |
723 gfx::Rect bounds_in_screen = | |
oshima
2017/06/14 00:19:27
nit: const
xdai1
2017/06/15 22:11:42
Done.
| |
724 Shell::Get()->split_view_controller()->GetRightWindowBoundsInScreen( | |
725 snapped_window); | |
726 SetBoundsForWindowGridsInScreen(bounds_in_screen); | |
727 } else if (state == SplitViewController::RIGHT_SNAPPED) { | |
728 aura::Window* snapped_window = | |
729 Shell::Get()->split_view_controller()->right_window(); | |
730 gfx::Rect bounds_in_screen = | |
oshima
2017/06/14 00:19:27
const
xdai1
2017/06/15 22:11:41
Done.
| |
731 Shell::Get()->split_view_controller()->GetLeftWindowBoundsInScreen( | |
732 snapped_window); | |
733 SetBoundsForWindowGridsInScreen(bounds_in_screen); | |
734 } else { | |
735 DCHECK(state == SplitViewController::NOSNAP); | |
oshima
2017/06/14 00:19:27
DCHECK_EQ
xdai1
2017/06/15 22:11:41
Done.
| |
736 // TODO(xdai): Decide what to do here. | |
737 } | |
629 } | 738 } |
630 | 739 |
631 void WindowSelector::PositionWindows(bool animate) { | 740 void WindowSelector::PositionWindows(bool animate) { |
632 for (std::unique_ptr<WindowGrid>& grid : grid_list_) | 741 for (std::unique_ptr<WindowGrid>& grid : grid_list_) |
633 grid->PositionWindows(animate); | 742 grid->PositionWindows(animate); |
634 } | 743 } |
635 | 744 |
745 aura::Window* WindowSelector::GetTextFilterWidgetWindow() { | |
746 return text_filter_widget_->GetNativeWindow(); | |
747 } | |
748 | |
636 void WindowSelector::RepositionTextFilterOnDisplayMetricsChange() { | 749 void WindowSelector::RepositionTextFilterOnDisplayMetricsChange() { |
637 const gfx::Rect rect = GetTextFilterPosition(Shell::GetPrimaryRootWindow()); | 750 const gfx::Rect rect = GetTextFilterPosition(Shell::GetPrimaryRootWindow()); |
638 text_filter_bottom_ = rect.bottom() + kTextFieldBottomMargin; | 751 text_filter_bottom_ = rect.bottom() + kTextFieldBottomMargin; |
639 text_filter_widget_->SetBounds(rect); | 752 text_filter_widget_->SetBounds(rect); |
640 | 753 |
641 gfx::Transform transform; | 754 gfx::Transform transform; |
642 transform.Translate( | 755 transform.Translate( |
643 0, text_filter_string_length_ == 0 ? -text_filter_bottom_ : 0); | 756 0, text_filter_string_length_ == 0 ? -text_filter_bottom_ : 0); |
644 aura::Window* text_filter_window = GetTextFilterWidgetWindow(); | 757 aura::Window* text_filter_window = GetTextFilterWidgetWindow(); |
645 text_filter_window->layer()->SetOpacity(text_filter_string_length_ == 0 ? 0 | 758 text_filter_window->layer()->SetOpacity(text_filter_string_length_ == 0 ? 0 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
679 for (size_t i = 0; i <= grid_list_.size() && | 792 for (size_t i = 0; i <= grid_list_.size() && |
680 grid_list_[selected_grid_index_]->Move(direction, animate); | 793 grid_list_[selected_grid_index_]->Move(direction, animate); |
681 i++) { | 794 i++) { |
682 selected_grid_index_ = | 795 selected_grid_index_ = |
683 (selected_grid_index_ + display_direction + grid_list_.size()) % | 796 (selected_grid_index_ + display_direction + grid_list_.size()) % |
684 grid_list_.size(); | 797 grid_list_.size(); |
685 } | 798 } |
686 } | 799 } |
687 | 800 |
688 } // namespace ash | 801 } // namespace ash |
OLD | NEW |