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

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

Issue 11201002: Removes worskpace 1 code. Will rename next. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove constants and add back kDisableLoginAnimations Created 8 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 | Annotate | Revision Log
« no previous file with comments | « ash/wm/workspace/workspace.h ('k') | ash/wm/workspace/workspace_event_handler_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "ash/wm/workspace/workspace.h"
6
7 #include <algorithm>
8
9 #include "ash/wm/property_util.h"
10 #include "ash/wm/window_util.h"
11 #include "ash/wm/workspace/workspace_manager.h"
12 #include "base/logging.h"
13 #include "ui/aura/client/aura_constants.h"
14 #include "ui/aura/root_window.h"
15 #include "ui/aura/window.h"
16 #include "ui/base/ui_base_types.h"
17
18 namespace ash {
19 namespace internal {
20
21 Workspace::Workspace(WorkspaceManager* manager, Type type)
22 : type_(type),
23 workspace_manager_(manager) {
24 }
25
26 Workspace::~Workspace() {
27 workspace_manager_->RemoveWorkspace(this);
28 }
29
30 // static
31 Workspace::Type Workspace::TypeForWindow(aura::Window* window) {
32 if (wm::IsWindowMaximized(window) || wm::IsWindowFullscreen(window))
33 return TYPE_MAXIMIZED;
34 return TYPE_MANAGED;
35 }
36
37 bool Workspace::AddWindowAfter(aura::Window* window, aura::Window* after) {
38 if (!CanAdd(window))
39 return false;
40 DCHECK(!Contains(window));
41
42 aura::Window::Windows::iterator i =
43 std::find(windows_.begin(), windows_.end(), after);
44 if (!after || i == windows_.end())
45 windows_.push_back(window);
46 else
47 windows_.insert(++i, window);
48 OnWindowAddedAfter(window, after);
49 return true;
50 }
51
52 void Workspace::RemoveWindow(aura::Window* window) {
53 DCHECK(Contains(window));
54 windows_.erase(std::find(windows_.begin(), windows_.end(), window));
55 OnWindowRemoved(window);
56 }
57
58 bool Workspace::Contains(aura::Window* window) const {
59 return std::find(windows_.begin(), windows_.end(), window) != windows_.end();
60 }
61
62 void Workspace::Activate() {
63 workspace_manager_->SetActiveWorkspace(this);
64 }
65
66 void Workspace::SetWindowBounds(aura::Window* window, const gfx::Rect& bounds) {
67 workspace_manager_->SetWindowBounds(window, bounds);
68 }
69
70 } // namespace internal
71 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/workspace/workspace.h ('k') | ash/wm/workspace/workspace_event_handler_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698