OLD | NEW |
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 "content/browser/renderer_host/render_widget_host_view_aura.h" | 5 #include "content/browser/renderer_host/render_widget_host_view_aura.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 | 160 |
161 DISALLOW_COPY_AND_ASSIGN(WindowObserver); | 161 DISALLOW_COPY_AND_ASSIGN(WindowObserver); |
162 }; | 162 }; |
163 | 163 |
164 class RenderWidgetHostViewAura::ResizeLock | 164 class RenderWidgetHostViewAura::ResizeLock |
165 : public base::SupportsWeakPtr<RenderWidgetHostViewAura::ResizeLock> { | 165 : public base::SupportsWeakPtr<RenderWidgetHostViewAura::ResizeLock> { |
166 public: | 166 public: |
167 ResizeLock(aura::RootWindow* root_window, const gfx::Size new_size) | 167 ResizeLock(aura::RootWindow* root_window, const gfx::Size new_size) |
168 : root_window_(root_window), | 168 : root_window_(root_window), |
169 new_size_(new_size), | 169 new_size_(new_size), |
170 compositor_lock_(root_window_->GetCompositorLock()) { | 170 compositor_lock_(root_window_->compositor()->GetCompositorLock()) { |
171 root_window_->HoldMouseMoves(); | 171 root_window_->HoldMouseMoves(); |
172 | 172 |
173 BrowserThread::PostDelayedTask( | 173 BrowserThread::PostDelayedTask( |
174 BrowserThread::UI, FROM_HERE, | 174 BrowserThread::UI, FROM_HERE, |
175 base::Bind(&RenderWidgetHostViewAura::ResizeLock::CancelLock, | 175 base::Bind(&RenderWidgetHostViewAura::ResizeLock::CancelLock, |
176 AsWeakPtr()), | 176 AsWeakPtr()), |
177 base::TimeDelta::FromMilliseconds(kResizeLockTimeoutMs)); | 177 base::TimeDelta::FromMilliseconds(kResizeLockTimeoutMs)); |
178 } | 178 } |
179 | 179 |
180 ~ResizeLock() { | 180 ~ResizeLock() { |
(...skipping 12 matching lines...) Expand all Loading... |
193 root_window_ = NULL; | 193 root_window_ = NULL; |
194 } | 194 } |
195 | 195 |
196 const gfx::Size& expected_size() const { | 196 const gfx::Size& expected_size() const { |
197 return new_size_; | 197 return new_size_; |
198 } | 198 } |
199 | 199 |
200 private: | 200 private: |
201 aura::RootWindow* root_window_; | 201 aura::RootWindow* root_window_; |
202 gfx::Size new_size_; | 202 gfx::Size new_size_; |
203 scoped_refptr<aura::CompositorLock> compositor_lock_; | 203 scoped_refptr<ui::CompositorLock> compositor_lock_; |
204 | 204 |
205 DISALLOW_COPY_AND_ASSIGN(ResizeLock); | 205 DISALLOW_COPY_AND_ASSIGN(ResizeLock); |
206 }; | 206 }; |
207 | 207 |
208 //////////////////////////////////////////////////////////////////////////////// | 208 //////////////////////////////////////////////////////////////////////////////// |
209 // RenderWidgetHostViewAura, public: | 209 // RenderWidgetHostViewAura, public: |
210 | 210 |
211 RenderWidgetHostViewAura::RenderWidgetHostViewAura(RenderWidgetHost* host) | 211 RenderWidgetHostViewAura::RenderWidgetHostViewAura(RenderWidgetHost* host) |
212 : host_(RenderWidgetHostImpl::From(host)), | 212 : host_(RenderWidgetHostImpl::From(host)), |
213 ALLOW_THIS_IN_INITIALIZER_LIST(window_(new aura::Window(this))), | 213 ALLOW_THIS_IN_INITIALIZER_LIST(window_(new aura::Window(this))), |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 return host_; | 274 return host_; |
275 } | 275 } |
276 | 276 |
277 void RenderWidgetHostViewAura::WasShown() { | 277 void RenderWidgetHostViewAura::WasShown() { |
278 if (!host_->is_hidden()) | 278 if (!host_->is_hidden()) |
279 return; | 279 return; |
280 host_->WasShown(); | 280 host_->WasShown(); |
281 | 281 |
282 if (!current_surface_ && host_->is_accelerated_compositing_active() && | 282 if (!current_surface_ && host_->is_accelerated_compositing_active() && |
283 !released_front_lock_.get()) { | 283 !released_front_lock_.get()) { |
284 released_front_lock_ = window_->GetRootWindow()->GetCompositorLock(); | 284 released_front_lock_ = GetCompositor()->GetCompositorLock(); |
285 } | 285 } |
286 | 286 |
287 AdjustSurfaceProtection(); | 287 AdjustSurfaceProtection(); |
288 } | 288 } |
289 | 289 |
290 void RenderWidgetHostViewAura::WasHidden() { | 290 void RenderWidgetHostViewAura::WasHidden() { |
291 if (host_->is_hidden()) | 291 if (host_->is_hidden()) |
292 return; | 292 return; |
293 host_->WasHidden(); | 293 host_->WasHidden(); |
294 | 294 |
(...skipping 1359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1654 RenderWidgetHost* widget) { | 1654 RenderWidgetHost* widget) { |
1655 return new RenderWidgetHostViewAura(widget); | 1655 return new RenderWidgetHostViewAura(widget); |
1656 } | 1656 } |
1657 | 1657 |
1658 // static | 1658 // static |
1659 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { | 1659 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { |
1660 GetScreenInfoForWindow(results, NULL); | 1660 GetScreenInfoForWindow(results, NULL); |
1661 } | 1661 } |
1662 | 1662 |
1663 } // namespace content | 1663 } // namespace content |
OLD | NEW |