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> |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 | 124 |
125 private: | 125 private: |
126 int corner_radius_; | 126 int corner_radius_; |
127 SkColor background_; | 127 SkColor background_; |
128 | 128 |
129 DISALLOW_COPY_AND_ASSIGN(RoundedContainerView); | 129 DISALLOW_COPY_AND_ASSIGN(RoundedContainerView); |
130 }; | 130 }; |
131 | 131 |
132 // Triggers a shelf visibility update on all root window controllers. | 132 // Triggers a shelf visibility update on all root window controllers. |
133 void UpdateShelfVisibility() { | 133 void UpdateShelfVisibility() { |
134 for (WmWindow* root : ShellPort::Get()->GetAllRootWindows()) | 134 for (aura::Window* root : Shell::GetAllRootWindows()) |
135 WmShelf::ForWindow(root)->UpdateVisibilityState(); | 135 WmShelf::ForWindow(root)->UpdateVisibilityState(); |
136 } | 136 } |
137 | 137 |
138 gfx::Rect GetTextFilterPosition(WmWindow* root_window) { | 138 gfx::Rect GetTextFilterPosition(WmWindow* root_window) { |
139 gfx::Rect total_bounds = root_window->ConvertRectToScreen( | 139 gfx::Rect total_bounds = root_window->ConvertRectToScreen( |
140 ScreenUtil::GetDisplayWorkAreaBoundsInParent( | 140 ScreenUtil::GetDisplayWorkAreaBoundsInParent( |
141 root_window->GetChildByShellWindowId(kShellWindowId_DefaultContainer) | 141 root_window->GetChildByShellWindowId(kShellWindowId_DefaultContainer) |
142 ->aura_window())); | 142 ->aura_window())); |
143 return gfx::Rect( | 143 return gfx::Rect( |
144 0.5 * (total_bounds.width() - | 144 0.5 * (total_bounds.width() - |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
292 // Do not call PrepareForOverview until all items are added to window_list_ | 292 // Do not call PrepareForOverview until all items are added to window_list_ |
293 // as we don't want to cause any window updates until all windows in | 293 // as we don't want to cause any window updates until all windows in |
294 // overview are observed. See http://crbug.com/384495. | 294 // overview are observed. See http://crbug.com/384495. |
295 for (std::unique_ptr<WindowGrid>& window_grid : grid_list_) { | 295 for (std::unique_ptr<WindowGrid>& window_grid : grid_list_) { |
296 window_grid->PrepareForOverview(); | 296 window_grid->PrepareForOverview(); |
297 window_grid->PositionWindows(true); | 297 window_grid->PositionWindows(true); |
298 } | 298 } |
299 | 299 |
300 search_image_ = gfx::CreateVectorIcon(ui::kSearchIcon, kTextFilterIconSize, | 300 search_image_ = gfx::CreateVectorIcon(ui::kSearchIcon, kTextFilterIconSize, |
301 kTextFilterIconColor); | 301 kTextFilterIconColor); |
302 WmWindow* root_window = shell_port->GetPrimaryRootWindow(); | 302 WmWindow* root_window = WmWindow::Get(Shell::GetPrimaryRootWindow()); |
303 text_filter_widget_.reset(CreateTextFilter(this, root_window, search_image_, | 303 text_filter_widget_.reset(CreateTextFilter(this, root_window, search_image_, |
304 &text_filter_bottom_)); | 304 &text_filter_bottom_)); |
305 } | 305 } |
306 | 306 |
307 DCHECK(!grid_list_.empty()); | 307 DCHECK(!grid_list_.empty()); |
308 UMA_HISTOGRAM_COUNTS_100("Ash.WindowSelector.Items", num_items_); | 308 UMA_HISTOGRAM_COUNTS_100("Ash.WindowSelector.Items", num_items_); |
309 | 309 |
310 Shell::Get()->activation_client()->AddObserver(this); | 310 Shell::Get()->activation_client()->AddObserver(this); |
311 | 311 |
312 display::Screen::GetScreen()->AddObserver(this); | 312 display::Screen::GetScreen()->AddObserver(this); |
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
630 WmWindow* WindowSelector::GetTextFilterWidgetWindow() { | 630 WmWindow* WindowSelector::GetTextFilterWidgetWindow() { |
631 return WmWindow::Get(text_filter_widget_->GetNativeWindow()); | 631 return WmWindow::Get(text_filter_widget_->GetNativeWindow()); |
632 } | 632 } |
633 | 633 |
634 void WindowSelector::PositionWindows(bool animate) { | 634 void WindowSelector::PositionWindows(bool animate) { |
635 for (std::unique_ptr<WindowGrid>& grid : grid_list_) | 635 for (std::unique_ptr<WindowGrid>& grid : grid_list_) |
636 grid->PositionWindows(animate); | 636 grid->PositionWindows(animate); |
637 } | 637 } |
638 | 638 |
639 void WindowSelector::RepositionTextFilterOnDisplayMetricsChange() { | 639 void WindowSelector::RepositionTextFilterOnDisplayMetricsChange() { |
640 WmWindow* root_window = ShellPort::Get()->GetPrimaryRootWindow(); | 640 WmWindow* root_window = WmWindow::Get(Shell::GetPrimaryRootWindow()); |
641 const gfx::Rect rect = GetTextFilterPosition(root_window); | 641 const gfx::Rect rect = GetTextFilterPosition(root_window); |
642 text_filter_bottom_ = rect.bottom() + kTextFieldBottomMargin; | 642 text_filter_bottom_ = rect.bottom() + kTextFieldBottomMargin; |
643 text_filter_widget_->SetBounds(rect); | 643 text_filter_widget_->SetBounds(rect); |
644 | 644 |
645 gfx::Transform transform; | 645 gfx::Transform transform; |
646 transform.Translate( | 646 transform.Translate( |
647 0, text_filter_string_length_ == 0 ? -text_filter_bottom_ : 0); | 647 0, text_filter_string_length_ == 0 ? -text_filter_bottom_ : 0); |
648 WmWindow* text_filter_window = GetTextFilterWidgetWindow(); | 648 WmWindow* text_filter_window = GetTextFilterWidgetWindow(); |
649 text_filter_window->SetOpacity(text_filter_string_length_ == 0 ? 0 : 1); | 649 text_filter_window->SetOpacity(text_filter_string_length_ == 0 ? 0 : 1); |
650 text_filter_window->SetTransform(transform); | 650 text_filter_window->SetTransform(transform); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
682 for (size_t i = 0; i <= grid_list_.size() && | 682 for (size_t i = 0; i <= grid_list_.size() && |
683 grid_list_[selected_grid_index_]->Move(direction, animate); | 683 grid_list_[selected_grid_index_]->Move(direction, animate); |
684 i++) { | 684 i++) { |
685 selected_grid_index_ = | 685 selected_grid_index_ = |
686 (selected_grid_index_ + display_direction + grid_list_.size()) % | 686 (selected_grid_index_ + display_direction + grid_list_.size()) % |
687 grid_list_.size(); | 687 grid_list_.size(); |
688 } | 688 } |
689 } | 689 } |
690 | 690 |
691 } // namespace ash | 691 } // namespace ash |
OLD | NEW |