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

Side by Side Diff: ui/aura/desktop.cc

Issue 8253001: aura: Some changes in Window and Desktop. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 9 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "ui/aura/desktop.h" 5 #include "ui/aura/desktop.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "ui/aura/desktop_delegate.h" 10 #include "ui/aura/desktop_delegate.h"
11 #include "ui/aura/desktop_host.h" 11 #include "ui/aura/desktop_host.h"
12 #include "ui/aura/desktop_observer.h"
12 #include "ui/aura/focus_manager.h" 13 #include "ui/aura/focus_manager.h"
13 #include "ui/aura/root_window.h" 14 #include "ui/aura/root_window.h"
14 #include "ui/aura/screen_aura.h" 15 #include "ui/aura/screen_aura.h"
15 #include "ui/aura/toplevel_window_container.h" 16 #include "ui/aura/toplevel_window_container.h"
16 #include "ui/aura/window.h" 17 #include "ui/aura/window.h"
17 #include "ui/aura/window_delegate.h" 18 #include "ui/aura/window_delegate.h"
18 #include "ui/gfx/compositor/compositor.h" 19 #include "ui/gfx/compositor/compositor.h"
19 #include "ui/gfx/compositor/layer.h" 20 #include "ui/gfx/compositor/layer.h"
20 21
21 namespace aura { 22 namespace aura {
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 } 92 }
92 93
93 bool Desktop::OnKeyEvent(const KeyEvent& event) { 94 bool Desktop::OnKeyEvent(const KeyEvent& event) {
94 return window_->HandleKeyEvent(event); 95 return window_->HandleKeyEvent(event);
95 } 96 }
96 97
97 void Desktop::OnHostResized(const gfx::Size& size) { 98 void Desktop::OnHostResized(const gfx::Size& size) {
98 gfx::Rect bounds(0, 0, size.width(), size.height()); 99 gfx::Rect bounds(0, 0, size.width(), size.height());
99 compositor_->WidgetSizeChanged(size); 100 compositor_->WidgetSizeChanged(size);
100 window_->SetBounds(bounds); 101 window_->SetBounds(bounds);
102 FOR_EACH_OBSERVER(DesktopObserver, observers_, OnDesktopResized(size));
101 } 103 }
102 104
103 void Desktop::ScheduleDraw() { 105 void Desktop::ScheduleDraw() {
104 if (!schedule_paint_factory_.HasWeakPtrs()) { 106 if (!schedule_paint_factory_.HasWeakPtrs()) {
105 MessageLoop::current()->PostTask( 107 MessageLoop::current()->PostTask(
106 FROM_HERE, 108 FROM_HERE,
107 base::Bind(&Desktop::Draw, schedule_paint_factory_.GetWeakPtr())); 109 base::Bind(&Desktop::Draw, schedule_paint_factory_.GetWeakPtr()));
108 } 110 }
109 } 111 }
110 112
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 // Reset active_window_ before invoking SetActiveWindow so that we don't 159 // Reset active_window_ before invoking SetActiveWindow so that we don't
158 // attempt to notify it while running its destructor. 160 // attempt to notify it while running its destructor.
159 active_window_ = NULL; 161 active_window_ = NULL;
160 SetActiveWindow(delegate_->GetTopmostWindowToActivate(window), NULL); 162 SetActiveWindow(delegate_->GetTopmostWindowToActivate(window), NULL);
161 } 163 }
162 164
163 MessageLoop::Dispatcher* Desktop::GetDispatcher() { 165 MessageLoop::Dispatcher* Desktop::GetDispatcher() {
164 return host_.get(); 166 return host_.get();
165 } 167 }
166 168
169 void Desktop::AddObserver(DesktopObserver* observer) {
170 observers_.AddObserver(observer);
171 }
172
173 void Desktop::RemoveObserver(DesktopObserver* observer) {
174 observers_.RemoveObserver(observer);
175 }
176
167 // static 177 // static
168 Desktop* Desktop::GetInstance() { 178 Desktop* Desktop::GetInstance() {
169 if (!instance_) { 179 if (!instance_) {
170 instance_ = new Desktop; 180 instance_ = new Desktop;
171 instance_->Init(); 181 instance_->Init();
172 } 182 }
173 return instance_; 183 return instance_;
174 } 184 }
175 185
176 } // namespace aura 186 } // namespace aura
OLDNEW
« no previous file with comments | « ui/aura/desktop.h ('k') | ui/aura/desktop_host_linux.cc » ('j') | ui/aura/desktop_observer.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698