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

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

Issue 8916020: Second attempt at moving the StackingClient to a property on the RootWindow. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years 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 | « ui/aura/root_window.h ('k') | ui/aura/test/aura_test_base.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/root_window.h" 5 #include "ui/aura/root_window.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "base/command_line.h" 11 #include "base/command_line.h"
12 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "base/message_loop.h" 13 #include "base/message_loop.h"
14 #include "base/string_number_conversions.h" 14 #include "base/string_number_conversions.h"
15 #include "base/string_split.h" 15 #include "base/string_split.h"
16 #include "ui/aura/aura_switches.h" 16 #include "ui/aura/aura_switches.h"
17 #include "ui/aura/client/activation_client.h" 17 #include "ui/aura/client/activation_client.h"
18 #include "ui/aura/client/drag_drop_client.h"
19 #include "ui/aura/client/stacking_client.h"
20 #include "ui/aura/client/tooltip_client.h"
21 #include "ui/aura/client/window_drag_drop_delegate.h"
22 #include "ui/aura/root_window_host.h" 18 #include "ui/aura/root_window_host.h"
23 #include "ui/aura/root_window_observer.h" 19 #include "ui/aura/root_window_observer.h"
24 #include "ui/aura/event.h" 20 #include "ui/aura/event.h"
25 #include "ui/aura/event_filter.h" 21 #include "ui/aura/event_filter.h"
26 #include "ui/aura/focus_manager.h" 22 #include "ui/aura/focus_manager.h"
27 #include "ui/aura/screen_aura.h" 23 #include "ui/aura/screen_aura.h"
28 #include "ui/aura/window.h" 24 #include "ui/aura/window.h"
29 #include "ui/aura/window_delegate.h" 25 #include "ui/aura/window_delegate.h"
30 #include "ui/base/hit_test.h" 26 #include "ui/base/hit_test.h"
31 #include "ui/gfx/compositor/compositor.h" 27 #include "ui/gfx/compositor/compositor.h"
(...skipping 19 matching lines...) Expand all
51 47
52 // Returns true if |target| has a non-client (frame) component at |location|, 48 // Returns true if |target| has a non-client (frame) component at |location|,
53 // in window coordinates. 49 // in window coordinates.
54 bool IsNonClientLocation(Window* target, const gfx::Point& location) { 50 bool IsNonClientLocation(Window* target, const gfx::Point& location) {
55 if (!target->delegate()) 51 if (!target->delegate())
56 return false; 52 return false;
57 int hit_test_code = target->delegate()->GetNonClientComponent(location); 53 int hit_test_code = target->delegate()->GetNonClientComponent(location);
58 return hit_test_code != HTCLIENT && hit_test_code != HTNOWHERE; 54 return hit_test_code != HTCLIENT && hit_test_code != HTNOWHERE;
59 } 55 }
60 56
61 class DefaultStackingClient : public StackingClient {
62 public:
63 explicit DefaultStackingClient(RootWindow* root_window)
64 : root_window_(root_window) {}
65 virtual ~DefaultStackingClient() {}
66
67 private:
68
69 // Overridden from StackingClient:
70 virtual void AddChildToDefaultParent(Window* window) OVERRIDE {
71 root_window_->AddChild(window);
72 }
73
74 RootWindow* root_window_;
75
76 DISALLOW_COPY_AND_ASSIGN(DefaultStackingClient);
77 };
78
79 typedef std::vector<EventFilter*> EventFilters; 57 typedef std::vector<EventFilter*> EventFilters;
80 58
81 void GetEventFiltersToNotify(Window* target, EventFilters* filters) { 59 void GetEventFiltersToNotify(Window* target, EventFilters* filters) {
82 Window* window = target->parent(); 60 Window* window = target->parent();
83 while (window) { 61 while (window) {
84 if (window->event_filter()) 62 if (window->event_filter())
85 filters->push_back(window->event_filter()); 63 filters->push_back(window->event_filter());
86 window = window->parent(); 64 window = window->parent();
87 } 65 }
88 } 66 }
(...skipping 14 matching lines...) Expand all
103 } 81 }
104 return instance_; 82 return instance_;
105 } 83 }
106 84
107 // static 85 // static
108 void RootWindow::DeleteInstance() { 86 void RootWindow::DeleteInstance() {
109 delete instance_; 87 delete instance_;
110 instance_ = NULL; 88 instance_ = NULL;
111 } 89 }
112 90
113 void RootWindow::SetStackingClient(StackingClient* stacking_client) {
114 stacking_client_.reset(stacking_client);
115 }
116
117 void RootWindow::ShowRootWindow() { 91 void RootWindow::ShowRootWindow() {
118 host_->Show(); 92 host_->Show();
119 } 93 }
120 94
121 void RootWindow::SetHostSize(const gfx::Size& size) { 95 void RootWindow::SetHostSize(const gfx::Size& size) {
122 host_->SetSize(size); 96 host_->SetSize(size);
123 // Requery the location to constrain it within the new root window size. 97 // Requery the location to constrain it within the new root window size.
124 last_mouse_location_ = host_->QueryMouseLocation(); 98 last_mouse_location_ = host_->QueryMouseLocation();
125 } 99 }
126 100
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 host_->ToggleFullScreen(); 300 host_->ToggleFullScreen();
327 } 301 }
328 #endif 302 #endif
329 303
330 //////////////////////////////////////////////////////////////////////////////// 304 ////////////////////////////////////////////////////////////////////////////////
331 // RootWindow, private: 305 // RootWindow, private:
332 306
333 RootWindow::RootWindow() 307 RootWindow::RootWindow()
334 : Window(NULL), 308 : Window(NULL),
335 host_(aura::RootWindowHost::Create(GetInitialHostWindowBounds())), 309 host_(aura::RootWindowHost::Create(GetInitialHostWindowBounds())),
336 ALLOW_THIS_IN_INITIALIZER_LIST(
337 stacking_client_(new DefaultStackingClient(this))),
338 ALLOW_THIS_IN_INITIALIZER_LIST(schedule_paint_factory_(this)), 310 ALLOW_THIS_IN_INITIALIZER_LIST(schedule_paint_factory_(this)),
339 mouse_button_flags_(0), 311 mouse_button_flags_(0),
340 last_cursor_(kCursorNull), 312 last_cursor_(kCursorNull),
341 screen_(new ScreenAura), 313 screen_(new ScreenAura),
342 capture_window_(NULL), 314 capture_window_(NULL),
343 mouse_pressed_handler_(NULL), 315 mouse_pressed_handler_(NULL),
344 mouse_moved_handler_(NULL), 316 mouse_moved_handler_(NULL),
345 focused_window_(NULL), 317 focused_window_(NULL),
346 touch_event_handler_(NULL) { 318 touch_event_handler_(NULL) {
347 SetName("RootWindow"); 319 SetName("RootWindow");
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
551 base::StringToInt(parts[1], &parsed_height) && parsed_height > 0) { 523 base::StringToInt(parts[1], &parsed_height) && parsed_height > 0) {
552 bounds.set_size(gfx::Size(parsed_width, parsed_height)); 524 bounds.set_size(gfx::Size(parsed_width, parsed_height));
553 } else if (use_fullscreen_host_window_) { 525 } else if (use_fullscreen_host_window_) {
554 bounds = gfx::Rect(RootWindowHost::GetNativeScreenSize()); 526 bounds = gfx::Rect(RootWindowHost::GetNativeScreenSize());
555 } 527 }
556 528
557 return bounds; 529 return bounds;
558 } 530 }
559 531
560 } // namespace aura 532 } // namespace aura
OLDNEW
« no previous file with comments | « ui/aura/root_window.h ('k') | ui/aura/test/aura_test_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698