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

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

Issue 11360045: ash: Add RootWindowHostFactory class. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 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
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 "ui/aura/root_window.h" 5 #include "ui/aura/root_window.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/auto_reset.h" 9 #include "base/auto_reset.h"
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/debug/trace_event.h" 12 #include "base/debug/trace_event.h"
13 #include "base/logging.h" 13 #include "base/logging.h"
14 #include "base/message_loop.h" 14 #include "base/message_loop.h"
15 #include "ui/aura/aura_switches.h" 15 #include "ui/aura/aura_switches.h"
16 #include "ui/aura/client/activation_client.h" 16 #include "ui/aura/client/activation_client.h"
17 #include "ui/aura/client/capture_client.h" 17 #include "ui/aura/client/capture_client.h"
18 #include "ui/aura/client/cursor_client.h" 18 #include "ui/aura/client/cursor_client.h"
19 #include "ui/aura/client/event_client.h" 19 #include "ui/aura/client/event_client.h"
20 #include "ui/aura/client/focus_client.h" 20 #include "ui/aura/client/focus_client.h"
21 #include "ui/aura/client/screen_position_client.h" 21 #include "ui/aura/client/screen_position_client.h"
22 #include "ui/aura/env.h" 22 #include "ui/aura/env.h"
23 #include "ui/aura/root_window_delegate.h"
23 #include "ui/aura/root_window_host.h" 24 #include "ui/aura/root_window_host.h"
24 #include "ui/aura/root_window_observer.h" 25 #include "ui/aura/root_window_observer.h"
25 #include "ui/aura/window.h" 26 #include "ui/aura/window.h"
26 #include "ui/aura/window_delegate.h" 27 #include "ui/aura/window_delegate.h"
27 #include "ui/aura/window_tracker.h" 28 #include "ui/aura/window_tracker.h"
28 #include "ui/base/events/event.h" 29 #include "ui/base/events/event.h"
29 #include "ui/base/gestures/gesture_recognizer.h" 30 #include "ui/base/gestures/gesture_recognizer.h"
30 #include "ui/base/gestures/gesture_types.h" 31 #include "ui/base/gestures/gesture_types.h"
31 #include "ui/base/hit_test.h" 32 #include "ui/base/hit_test.h"
32 #include "ui/base/view_prop.h" 33 #include "ui/base/view_prop.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 static_cast<Window*>(consumer) : NULL; 69 static_cast<Window*>(consumer) : NULL;
69 } 70 }
70 71
71 void SetLastMouseLocation(const Window* root_window, 72 void SetLastMouseLocation(const Window* root_window,
72 const gfx::Point& location) { 73 const gfx::Point& location) {
73 Env::GetInstance()->SetLastMouseLocation(*root_window, location); 74 Env::GetInstance()->SetLastMouseLocation(*root_window, location);
74 } 75 }
75 76
76 RootWindowHost* CreateHost(RootWindow* root_window, 77 RootWindowHost* CreateHost(RootWindow* root_window,
77 const RootWindow::CreateParams& params) { 78 const RootWindow::CreateParams& params) {
78 RootWindowHost* host = params.host ? 79 RootWindowHost* host = params.delegate ?
79 params.host : RootWindowHost::Create(params.initial_bounds); 80 params.delegate->CreateRootWindowHost(params.initial_bounds) :
81 RootWindowHost::Create(params.initial_bounds);
80 host->SetDelegate(root_window); 82 host->SetDelegate(root_window);
81 return host; 83 return host;
82 } 84 }
83 85
84 } // namespace 86 } // namespace
85 87
86 RootWindow::CreateParams::CreateParams(const gfx::Rect& a_initial_bounds) 88 RootWindow::CreateParams::CreateParams(const gfx::Rect& a_initial_bounds)
87 : initial_bounds(a_initial_bounds), 89 : initial_bounds(a_initial_bounds),
88 host(NULL) { 90 delegate(NULL) {
89 } 91 }
90 92
91 //////////////////////////////////////////////////////////////////////////////// 93 ////////////////////////////////////////////////////////////////////////////////
92 // RootWindow, public: 94 // RootWindow, public:
93 95
94 RootWindow::RootWindow(const CreateParams& params) 96 RootWindow::RootWindow(const CreateParams& params)
95 : Window(NULL), 97 : Window(NULL),
96 ALLOW_THIS_IN_INITIALIZER_LIST(host_(CreateHost(this, params))), 98 ALLOW_THIS_IN_INITIALIZER_LIST(host_(CreateHost(this, params))),
97 ALLOW_THIS_IN_INITIALIZER_LIST(schedule_paint_factory_(this)), 99 ALLOW_THIS_IN_INITIALIZER_LIST(schedule_paint_factory_(this)),
98 ALLOW_THIS_IN_INITIALIZER_LIST(event_factory_(this)), 100 ALLOW_THIS_IN_INITIALIZER_LIST(event_factory_(this)),
99 mouse_button_flags_(0), 101 mouse_button_flags_(0),
100 touch_ids_down_(0), 102 touch_ids_down_(0),
101 last_cursor_(ui::kCursorNull), 103 last_cursor_(ui::kCursorNull),
102 mouse_pressed_handler_(NULL), 104 mouse_pressed_handler_(NULL),
103 mouse_moved_handler_(NULL), 105 mouse_moved_handler_(NULL),
104 mouse_event_dispatch_target_(NULL), 106 mouse_event_dispatch_target_(NULL),
105 event_dispatch_target_(NULL), 107 event_dispatch_target_(NULL),
106 ALLOW_THIS_IN_INITIALIZER_LIST( 108 ALLOW_THIS_IN_INITIALIZER_LIST(
107 gesture_recognizer_(ui::GestureRecognizer::Create(this))), 109 gesture_recognizer_(ui::GestureRecognizer::Create(this))),
108 synthesize_mouse_move_(false), 110 synthesize_mouse_move_(false),
109 waiting_on_compositing_end_(false), 111 waiting_on_compositing_end_(false),
110 draw_on_compositing_end_(false), 112 draw_on_compositing_end_(false),
111 defer_draw_scheduling_(false), 113 defer_draw_scheduling_(false),
112 mouse_move_hold_count_(0), 114 mouse_move_hold_count_(0),
113 ALLOW_THIS_IN_INITIALIZER_LIST(held_mouse_event_factory_(this)) { 115 ALLOW_THIS_IN_INITIALIZER_LIST(held_mouse_event_factory_(this)) {
114 SetName("RootWindow"); 116 SetName("RootWindow");
115 117
118 delegate_.reset(params.delegate);
116 compositor_.reset(new ui::Compositor(this, host_->GetAcceleratedWidget())); 119 compositor_.reset(new ui::Compositor(this, host_->GetAcceleratedWidget()));
117 DCHECK(compositor_.get()); 120 DCHECK(compositor_.get());
118 compositor_->AddObserver(this); 121 compositor_->AddObserver(this);
119 122
120 prop_.reset(new ui::ViewProp(host_->GetAcceleratedWidget(), 123 prop_.reset(new ui::ViewProp(host_->GetAcceleratedWidget(),
121 kRootWindowForAcceleratedWidget, 124 kRootWindowForAcceleratedWidget,
122 this)); 125 this));
123 } 126 }
124 127
125 RootWindow::~RootWindow() { 128 RootWindow::~RootWindow() {
(...skipping 862 matching lines...) Expand 10 before | Expand all | Expand 10 after
988 ui::MouseEvent event(ui::ET_MOUSE_MOVED, 991 ui::MouseEvent event(ui::ET_MOUSE_MOVED,
989 orig_mouse_location, 992 orig_mouse_location,
990 orig_mouse_location, 993 orig_mouse_location,
991 ui::EF_IS_SYNTHESIZED); 994 ui::EF_IS_SYNTHESIZED);
992 event.set_system_location(Env::GetInstance()->last_mouse_location()); 995 event.set_system_location(Env::GetInstance()->last_mouse_location());
993 OnHostMouseEvent(&event); 996 OnHostMouseEvent(&event);
994 #endif 997 #endif
995 } 998 }
996 999
997 } // namespace aura 1000 } // namespace aura
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698