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

Side by Side Diff: ash/display/window_tree_host_manager.cc

Issue 2421853003: Remove usage of FOR_EACH_OBSERVER macro in ash/ (Closed)
Patch Set: shell_observers Created 4 years, 2 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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/display/window_tree_host_manager.h" 5 #include "ash/display/window_tree_host_manager.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 #include <map> 9 #include <map>
10 #include <memory> 10 #include <memory>
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 } 246 }
247 247
248 WindowTreeHostManager::~WindowTreeHostManager() {} 248 WindowTreeHostManager::~WindowTreeHostManager() {}
249 249
250 void WindowTreeHostManager::Start() { 250 void WindowTreeHostManager::Start() {
251 display::Screen::GetScreen()->AddObserver(this); 251 display::Screen::GetScreen()->AddObserver(this);
252 Shell::GetInstance()->display_manager()->set_delegate(this); 252 Shell::GetInstance()->display_manager()->set_delegate(this);
253 } 253 }
254 254
255 void WindowTreeHostManager::Shutdown() { 255 void WindowTreeHostManager::Shutdown() {
256 FOR_EACH_OBSERVER(Observer, observers_, OnWindowTreeHostManagerShutdown()); 256 for (auto& observer : observers_)
257 observer.OnWindowTreeHostManagerShutdown();
257 258
258 // Unset the display manager's delegate here because 259 // Unset the display manager's delegate here because
259 // DisplayManager outlives WindowTreeHostManager. 260 // DisplayManager outlives WindowTreeHostManager.
260 Shell::GetInstance()->display_manager()->set_delegate(nullptr); 261 Shell::GetInstance()->display_manager()->set_delegate(nullptr);
261 262
262 cursor_window_controller_.reset(); 263 cursor_window_controller_.reset();
263 mirror_window_controller_.reset(); 264 mirror_window_controller_.reset();
264 265
265 display::Screen::GetScreen()->RemoveObserver(this); 266 display::Screen::GetScreen()->RemoveObserver(this);
266 267
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 DisplayManager* display_manager = GetDisplayManager(); 303 DisplayManager* display_manager = GetDisplayManager();
303 for (size_t i = 0; i < display_manager->GetNumDisplays(); ++i) { 304 for (size_t i = 0; i < display_manager->GetNumDisplays(); ++i) {
304 const display::Display& display = display_manager->GetDisplayAt(i); 305 const display::Display& display = display_manager->GetDisplayAt(i);
305 if (primary_display_id != display.id()) { 306 if (primary_display_id != display.id()) {
306 AshWindowTreeHost* ash_host = 307 AshWindowTreeHost* ash_host =
307 AddWindowTreeHostForDisplay(display, AshWindowTreeHostInitParams()); 308 AddWindowTreeHostForDisplay(display, AshWindowTreeHostInitParams());
308 RootWindowController::CreateForSecondaryDisplay(ash_host); 309 RootWindowController::CreateForSecondaryDisplay(ash_host);
309 } 310 }
310 } 311 }
311 312
312 FOR_EACH_OBSERVER(Observer, observers_, OnDisplaysInitialized()); 313 for (auto& observer : observers_)
314 observer.OnDisplaysInitialized();
313 } 315 }
314 316
315 void WindowTreeHostManager::AddObserver(Observer* observer) { 317 void WindowTreeHostManager::AddObserver(Observer* observer) {
316 observers_.AddObserver(observer); 318 observers_.AddObserver(observer);
317 } 319 }
318 320
319 void WindowTreeHostManager::RemoveObserver(Observer* observer) { 321 void WindowTreeHostManager::RemoveObserver(Observer* observer) {
320 observers_.RemoveObserver(observer); 322 observers_.RemoveObserver(observer);
321 } 323 }
322 324
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after
740 mirror_window_controller_->CloseIfNotNecessary(); 742 mirror_window_controller_->CloseIfNotNecessary();
741 // If cursor_compositing is enabled for large cursor, the cursor window is 743 // If cursor_compositing is enabled for large cursor, the cursor window is
742 // always on the desktop display (the visible cursor on the non-desktop 744 // always on the desktop display (the visible cursor on the non-desktop
743 // display is drawn through compositor mirroring). Therefore, it's unnecessary 745 // display is drawn through compositor mirroring). Therefore, it's unnecessary
744 // to handle the cursor_window at all. See: http://crbug.com/412910 746 // to handle the cursor_window at all. See: http://crbug.com/412910
745 if (!cursor_window_controller_->is_cursor_compositing_enabled()) 747 if (!cursor_window_controller_->is_cursor_compositing_enabled())
746 cursor_window_controller_->UpdateContainer(); 748 cursor_window_controller_->UpdateContainer();
747 } 749 }
748 750
749 void WindowTreeHostManager::PreDisplayConfigurationChange(bool clear_focus) { 751 void WindowTreeHostManager::PreDisplayConfigurationChange(bool clear_focus) {
750 FOR_EACH_OBSERVER(Observer, observers_, OnDisplayConfigurationChanging()); 752 for (auto& observer : observers_)
753 observer.OnDisplayConfigurationChanging();
751 focus_activation_store_->Store(clear_focus); 754 focus_activation_store_->Store(clear_focus);
752 display::Screen* screen = display::Screen::GetScreen(); 755 display::Screen* screen = display::Screen::GetScreen();
753 gfx::Point point_in_screen = screen->GetCursorScreenPoint(); 756 gfx::Point point_in_screen = screen->GetCursorScreenPoint();
754 cursor_location_in_screen_coords_for_restore_ = point_in_screen; 757 cursor_location_in_screen_coords_for_restore_ = point_in_screen;
755 758
756 display::Display display = screen->GetDisplayNearestPoint(point_in_screen); 759 display::Display display = screen->GetDisplayNearestPoint(point_in_screen);
757 cursor_display_id_for_restore_ = display.id(); 760 cursor_display_id_for_restore_ = display.id();
758 761
759 gfx::Point point_in_native = point_in_screen; 762 gfx::Point point_in_native = point_in_screen;
760 aura::Window* root_window = GetRootWindowForDisplayId(display.id()); 763 aura::Window* root_window = GetRootWindowForDisplayId(display.id());
(...skipping 24 matching lines...) Expand all
785 for (const display::Display& display : 788 for (const display::Display& display :
786 display_manager->active_display_list()) { 789 display_manager->active_display_list()) {
787 bool output_is_secure = 790 bool output_is_secure =
788 !display_manager->IsInMirrorMode() && display.IsInternal(); 791 !display_manager->IsInMirrorMode() && display.IsInternal();
789 GetAshWindowTreeHostForDisplayId(display.id()) 792 GetAshWindowTreeHostForDisplayId(display.id())
790 ->AsWindowTreeHost() 793 ->AsWindowTreeHost()
791 ->compositor() 794 ->compositor()
792 ->SetOutputIsSecure(output_is_secure); 795 ->SetOutputIsSecure(output_is_secure);
793 } 796 }
794 797
795 FOR_EACH_OBSERVER(Observer, observers_, OnDisplayConfigurationChanged()); 798 for (auto& observer : observers_)
799 observer.OnDisplayConfigurationChanged();
796 UpdateMouseLocationAfterDisplayChange(); 800 UpdateMouseLocationAfterDisplayChange();
797 } 801 }
798 802
799 #if defined(OS_CHROMEOS) 803 #if defined(OS_CHROMEOS)
800 ui::DisplayConfigurator* WindowTreeHostManager::display_configurator() { 804 ui::DisplayConfigurator* WindowTreeHostManager::display_configurator() {
801 return Shell::GetInstance()->display_configurator(); 805 return Shell::GetInstance()->display_configurator();
802 } 806 }
803 #endif 807 #endif
804 808
805 std::string WindowTreeHostManager::GetInternalDisplayNameString() { 809 std::string WindowTreeHostManager::GetInternalDisplayNameString() {
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
860 SetDisplayPropertiesOnHost(ash_host, display); 864 SetDisplayPropertiesOnHost(ash_host, display);
861 865
862 #if defined(OS_CHROMEOS) 866 #if defined(OS_CHROMEOS)
863 if (switches::ConstrainPointerToRoot()) 867 if (switches::ConstrainPointerToRoot())
864 ash_host->ConfineCursorToRootWindow(); 868 ash_host->ConfineCursorToRootWindow();
865 #endif 869 #endif
866 return ash_host; 870 return ash_host;
867 } 871 }
868 872
869 } // namespace ash 873 } // namespace ash
OLDNEW
« no previous file with comments | « ash/display/screen_orientation_controller_chromeos.cc ('k') | ash/first_run/first_run_helper_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698