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

Side by Side Diff: ash/wm/workspace/workspace_layout_manager.cc

Issue 1888153002: WorkspaceLayoutManagerDelegate -> WorkspaceLayoutManagerBackdropDelegate (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: =default and merge Created 4 years, 8 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/wm/workspace/workspace_layout_manager.h" 5 #include "ash/wm/workspace/workspace_layout_manager.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "ash/root_window_controller.h" 9 #include "ash/root_window_controller.h"
10 #include "ash/screen_util.h" 10 #include "ash/screen_util.h"
11 #include "ash/session/session_state_delegate.h" 11 #include "ash/session/session_state_delegate.h"
12 #include "ash/shelf/shelf_layout_manager.h"
13 #include "ash/shell.h" 12 #include "ash/shell.h"
14 #include "ash/wm/always_on_top_controller.h" 13 #include "ash/wm/always_on_top_controller.h"
14 #include "ash/wm/common/workspace/workspace_layout_manager_delegate.h"
15 #include "ash/wm/window_animations.h" 15 #include "ash/wm/window_animations.h"
16 #include "ash/wm/window_positioner.h" 16 #include "ash/wm/window_positioner.h"
17 #include "ash/wm/window_properties.h" 17 #include "ash/wm/window_properties.h"
18 #include "ash/wm/window_state.h" 18 #include "ash/wm/window_state.h"
19 #include "ash/wm/window_util.h" 19 #include "ash/wm/window_util.h"
20 #include "ash/wm/wm_event.h" 20 #include "ash/wm/wm_event.h"
21 #include "ash/wm/workspace/workspace_layout_manager_delegate.h" 21 #include "ash/wm/workspace/workspace_layout_manager_backdrop_delegate.h"
22 #include "ui/aura/client/aura_constants.h" 22 #include "ui/aura/client/aura_constants.h"
23 #include "ui/aura/window.h" 23 #include "ui/aura/window.h"
24 #include "ui/aura/window_observer.h" 24 #include "ui/aura/window_observer.h"
25 #include "ui/base/ui_base_types.h" 25 #include "ui/base/ui_base_types.h"
26 #include "ui/compositor/layer.h" 26 #include "ui/compositor/layer.h"
27 #include "ui/events/event.h" 27 #include "ui/events/event.h"
28 #include "ui/gfx/screen.h" 28 #include "ui/gfx/screen.h"
29 #include "ui/keyboard/keyboard_controller_observer.h" 29 #include "ui/keyboard/keyboard_controller_observer.h"
30 #include "ui/wm/core/window_util.h" 30 #include "ui/wm/core/window_util.h"
31 #include "ui/wm/public/activation_client.h" 31 #include "ui/wm/public/activation_client.h"
32 32
33 using aura::Window; 33 using aura::Window;
34 34
35 namespace ash { 35 namespace ash {
36 36
37 WorkspaceLayoutManager::WorkspaceLayoutManager(aura::Window* window) 37 WorkspaceLayoutManager::WorkspaceLayoutManager(
38 : shelf_(NULL), 38 aura::Window* window,
39 window_(window), 39 std::unique_ptr<wm::WorkspaceLayoutManagerDelegate> delegate)
40 : window_(window),
40 root_window_(window->GetRootWindow()), 41 root_window_(window->GetRootWindow()),
42 delegate_(std::move(delegate)),
41 work_area_in_parent_(ScreenUtil::ConvertRectFromScreen( 43 work_area_in_parent_(ScreenUtil::ConvertRectFromScreen(
42 window_, 44 window_,
43 gfx::Screen::GetScreen() 45 gfx::Screen::GetScreen()
44 ->GetDisplayNearestWindow(window_) 46 ->GetDisplayNearestWindow(window_)
45 .work_area())), 47 .work_area())),
46 is_fullscreen_(GetRootWindowController(window->GetRootWindow()) 48 is_fullscreen_(GetRootWindowController(window->GetRootWindow())
47 ->GetWindowForFullscreenMode() != NULL) { 49 ->GetWindowForFullscreenMode() != NULL) {
48 Shell::GetInstance()->activation_client()->AddObserver(this); 50 Shell::GetInstance()->activation_client()->AddObserver(this);
49 Shell::GetInstance()->AddShellObserver(this); 51 Shell::GetInstance()->AddShellObserver(this);
50 root_window_->AddObserver(this); 52 root_window_->AddObserver(this);
51 DCHECK(window->GetProperty(kSnapChildrenToPixelBoundary)); 53 DCHECK(window->GetProperty(kSnapChildrenToPixelBoundary));
52 } 54 }
53 55
54 WorkspaceLayoutManager::~WorkspaceLayoutManager() { 56 WorkspaceLayoutManager::~WorkspaceLayoutManager() {
55 if (root_window_) 57 if (root_window_)
56 root_window_->RemoveObserver(this); 58 root_window_->RemoveObserver(this);
57 for (WindowSet::const_iterator i = windows_.begin(); i != windows_.end(); ++i) 59 for (WindowSet::const_iterator i = windows_.begin(); i != windows_.end(); ++i)
58 (*i)->RemoveObserver(this); 60 (*i)->RemoveObserver(this);
59 Shell::GetInstance()->RemoveShellObserver(this); 61 Shell::GetInstance()->RemoveShellObserver(this);
60 Shell::GetInstance()->activation_client()->RemoveObserver(this); 62 Shell::GetInstance()->activation_client()->RemoveObserver(this);
61 } 63 }
62 64
63 void WorkspaceLayoutManager::SetShelf(ShelfLayoutManager* shelf) { 65 void WorkspaceLayoutManager::DeleteDelegate() {
64 shelf_ = shelf; 66 delegate_.reset();
65 } 67 }
66 68
67 void WorkspaceLayoutManager::SetMaximizeBackdropDelegate( 69 void WorkspaceLayoutManager::SetMaximizeBackdropDelegate(
68 std::unique_ptr<WorkspaceLayoutManagerDelegate> delegate) { 70 std::unique_ptr<WorkspaceLayoutManagerBackdropDelegate> delegate) {
69 backdrop_delegate_.reset(delegate.release()); 71 backdrop_delegate_.reset(delegate.release());
70 } 72 }
71 73
72 ////////////////////////////////////////////////////////////////////////////// 74 //////////////////////////////////////////////////////////////////////////////
73 // WorkspaceLayoutManager, aura::LayoutManager implementation: 75 // WorkspaceLayoutManager, aura::LayoutManager implementation:
74 76
75 void WorkspaceLayoutManager::OnWindowAddedToLayout(Window* child) { 77 void WorkspaceLayoutManager::OnWindowAddedToLayout(Window* child) {
76 wm::WindowState* window_state = wm::GetWindowState(child); 78 wm::WindowState* window_state = wm::GetWindowState(child);
77 wm::WMEvent event(wm::WM_EVENT_ADDED_TO_WORKSPACE); 79 wm::WMEvent event(wm::WM_EVENT_ADDED_TO_WORKSPACE);
78 window_state->OnWMEvent(&event); 80 window_state->OnWMEvent(&event);
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 // the host window. 324 // the host window.
323 // We also need to do this when the work area insets changes. 325 // We also need to do this when the work area insets changes.
324 for (WindowSet::const_iterator it = windows_.begin(); 326 for (WindowSet::const_iterator it = windows_.begin();
325 it != windows_.end(); 327 it != windows_.end();
326 ++it) { 328 ++it) {
327 wm::GetWindowState(*it)->OnWMEvent(event); 329 wm::GetWindowState(*it)->OnWMEvent(event);
328 } 330 }
329 } 331 }
330 332
331 void WorkspaceLayoutManager::UpdateShelfVisibility() { 333 void WorkspaceLayoutManager::UpdateShelfVisibility() {
332 if (shelf_) 334 if (delegate_)
333 shelf_->UpdateVisibilityState(); 335 delegate_->UpdateShelfVisibility();
334 } 336 }
335 337
336 void WorkspaceLayoutManager::UpdateFullscreenState() { 338 void WorkspaceLayoutManager::UpdateFullscreenState() {
337 // TODO(flackr): The fullscreen state is currently tracked per workspace 339 // TODO(flackr): The fullscreen state is currently tracked per workspace
338 // but the shell notification implies a per root window state. Currently 340 // but the shell notification implies a per root window state. Currently
339 // only windows in the default workspace container will go fullscreen but 341 // only windows in the default workspace container will go fullscreen but
340 // this should really be tracked by the RootWindowController since 342 // this should really be tracked by the RootWindowController since
341 // technically any container could get a fullscreen window. 343 // technically any container could get a fullscreen window.
342 if (!shelf_) 344 if (!delegate_)
343 return; 345 return;
344 bool is_fullscreen = GetRootWindowController( 346 bool is_fullscreen = GetRootWindowController(
345 window_->GetRootWindow())->GetWindowForFullscreenMode() != NULL; 347 window_->GetRootWindow())->GetWindowForFullscreenMode() != NULL;
346 if (is_fullscreen != is_fullscreen_) { 348 if (is_fullscreen != is_fullscreen_) {
347 ash::Shell::GetInstance()->NotifyFullscreenStateChange( 349 delegate_->OnFullscreenStateChanged(is_fullscreen);
348 is_fullscreen, window_->GetRootWindow());
349 is_fullscreen_ = is_fullscreen; 350 is_fullscreen_ = is_fullscreen;
350 } 351 }
351 } 352 }
352 353
353 } // namespace ash 354 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/workspace/workspace_layout_manager.h ('k') | ash/wm/workspace/workspace_layout_manager_backdrop_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698