| 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/auto_reset.h" | 7 #include "base/auto_reset.h" |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
| (...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 483 aura::client::SetTooltipText(window_, &tooltip_); | 483 aura::client::SetTooltipText(window_, &tooltip_); |
| 484 aura::client::SetActivationDelegate(window_, this); | 484 aura::client::SetActivationDelegate(window_, this); |
| 485 aura::client::SetActivationChangeObserver(window_, this); | 485 aura::client::SetActivationChangeObserver(window_, this); |
| 486 aura::client::SetFocusChangeObserver(window_, this); | 486 aura::client::SetFocusChangeObserver(window_, this); |
| 487 gfx::Screen::GetScreenFor(window_)->AddObserver(this); | 487 gfx::Screen::GetScreenFor(window_)->AddObserver(this); |
| 488 software_frame_manager_.reset(new SoftwareFrameManager( | 488 software_frame_manager_.reset(new SoftwareFrameManager( |
| 489 weak_ptr_factory_.GetWeakPtr())); | 489 weak_ptr_factory_.GetWeakPtr())); |
| 490 #if defined(OS_WIN) | 490 #if defined(OS_WIN) |
| 491 plugin_parent_window_ = NULL; | 491 plugin_parent_window_ = NULL; |
| 492 #endif | 492 #endif |
| 493 ImageTransportFactory::GetInstance()->AddObserver(this); |
| 493 } | 494 } |
| 494 | 495 |
| 495 //////////////////////////////////////////////////////////////////////////////// | 496 //////////////////////////////////////////////////////////////////////////////// |
| 496 // RenderWidgetHostViewAura, RenderWidgetHostView implementation: | 497 // RenderWidgetHostViewAura, RenderWidgetHostView implementation: |
| 497 | 498 |
| 498 void RenderWidgetHostViewAura::InitAsChild( | 499 void RenderWidgetHostViewAura::InitAsChild( |
| 499 gfx::NativeView parent_view) { | 500 gfx::NativeView parent_view) { |
| 500 window_->SetType(ui::wm::WINDOW_TYPE_CONTROL); | 501 window_->SetType(ui::wm::WINDOW_TYPE_CONTROL); |
| 501 window_->Init(aura::WINDOW_LAYER_TEXTURED); | 502 window_->Init(aura::WINDOW_LAYER_TEXTURED); |
| 502 window_->SetName("RenderWidgetHostViewAura"); | 503 window_->SetName("RenderWidgetHostViewAura"); |
| (...skipping 1675 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2178 BrowserAccessibilityManagerWin::GetEmptyDocument(), this); | 2179 BrowserAccessibilityManagerWin::GetEmptyDocument(), this); |
| 2179 #else | 2180 #else |
| 2180 BrowserAccessibilityManager* manager = BrowserAccessibilityManager::Create( | 2181 BrowserAccessibilityManager* manager = BrowserAccessibilityManager::Create( |
| 2181 BrowserAccessibilityManager::GetEmptyDocument(), this); | 2182 BrowserAccessibilityManager::GetEmptyDocument(), this); |
| 2182 #endif | 2183 #endif |
| 2183 | 2184 |
| 2184 SetBrowserAccessibilityManager(manager); | 2185 SetBrowserAccessibilityManager(manager); |
| 2185 } | 2186 } |
| 2186 | 2187 |
| 2187 gfx::GLSurfaceHandle RenderWidgetHostViewAura::GetCompositingSurface() { | 2188 gfx::GLSurfaceHandle RenderWidgetHostViewAura::GetCompositingSurface() { |
| 2188 if (shared_surface_handle_.is_null()) { | 2189 return ImageTransportFactory::GetInstance()->GetSharedSurfaceHandle(); |
| 2189 ImageTransportFactory* factory = ImageTransportFactory::GetInstance(); | |
| 2190 shared_surface_handle_ = factory->CreateSharedSurfaceHandle(); | |
| 2191 if (!shared_surface_handle_.is_null()) | |
| 2192 factory->AddObserver(this); | |
| 2193 } | |
| 2194 return shared_surface_handle_; | |
| 2195 } | 2190 } |
| 2196 | 2191 |
| 2197 bool RenderWidgetHostViewAura::LockMouse() { | 2192 bool RenderWidgetHostViewAura::LockMouse() { |
| 2198 aura::Window* root_window = window_->GetRootWindow(); | 2193 aura::Window* root_window = window_->GetRootWindow(); |
| 2199 if (!root_window) | 2194 if (!root_window) |
| 2200 return false; | 2195 return false; |
| 2201 | 2196 |
| 2202 if (mouse_locked_) | 2197 if (mouse_locked_) |
| 2203 return true; | 2198 return true; |
| 2204 | 2199 |
| (...skipping 1049 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3254 current_surface_ = NULL; | 3249 current_surface_ = NULL; |
| 3255 UpdateExternalTexture(); | 3250 UpdateExternalTexture(); |
| 3256 | 3251 |
| 3257 idle_frame_subscriber_textures_.clear(); | 3252 idle_frame_subscriber_textures_.clear(); |
| 3258 yuv_readback_pipeline_.reset(); | 3253 yuv_readback_pipeline_.reset(); |
| 3259 | 3254 |
| 3260 // Make sure all ImageTransportClients are deleted now that the context those | 3255 // Make sure all ImageTransportClients are deleted now that the context those |
| 3261 // are using is becoming invalid. This sends pending ACKs and needs to happen | 3256 // are using is becoming invalid. This sends pending ACKs and needs to happen |
| 3262 // after calling UpdateExternalTexture() which syncs with the impl thread. | 3257 // after calling UpdateExternalTexture() which syncs with the impl thread. |
| 3263 RunOnCommitCallbacks(); | 3258 RunOnCommitCallbacks(); |
| 3264 | |
| 3265 DCHECK(!shared_surface_handle_.is_null()); | |
| 3266 ImageTransportFactory* factory = ImageTransportFactory::GetInstance(); | |
| 3267 factory->DestroySharedSurfaceHandle(shared_surface_handle_); | |
| 3268 shared_surface_handle_ = factory->CreateSharedSurfaceHandle(); | |
| 3269 host_->CompositingSurfaceUpdated(); | |
| 3270 host_->ScheduleComposite(); | 3259 host_->ScheduleComposite(); |
| 3271 } | 3260 } |
| 3272 | 3261 |
| 3273 //////////////////////////////////////////////////////////////////////////////// | 3262 //////////////////////////////////////////////////////////////////////////////// |
| 3274 // RenderWidgetHostViewAura, private: | 3263 // RenderWidgetHostViewAura, private: |
| 3275 | 3264 |
| 3276 RenderWidgetHostViewAura::~RenderWidgetHostViewAura() { | 3265 RenderWidgetHostViewAura::~RenderWidgetHostViewAura() { |
| 3277 if (paint_observer_) | 3266 if (paint_observer_) |
| 3278 paint_observer_->OnViewDestroyed(); | 3267 paint_observer_->OnViewDestroyed(); |
| 3279 if (touch_editing_client_) | 3268 if (touch_editing_client_) |
| 3280 touch_editing_client_->OnViewDestroyed(); | 3269 touch_editing_client_->OnViewDestroyed(); |
| 3281 if (!shared_surface_handle_.is_null()) { | 3270 |
| 3282 ImageTransportFactory* factory = ImageTransportFactory::GetInstance(); | 3271 ImageTransportFactory::GetInstance()->RemoveObserver(this); |
| 3283 factory->DestroySharedSurfaceHandle(shared_surface_handle_); | 3272 |
| 3284 factory->RemoveObserver(this); | |
| 3285 } | |
| 3286 window_observer_.reset(); | 3273 window_observer_.reset(); |
| 3287 if (window_->GetDispatcher()) | 3274 if (window_->GetDispatcher()) |
| 3288 window_->GetDispatcher()->RemoveRootWindowObserver(this); | 3275 window_->GetDispatcher()->RemoveRootWindowObserver(this); |
| 3289 UnlockMouse(); | 3276 UnlockMouse(); |
| 3290 if (popup_parent_host_view_) { | 3277 if (popup_parent_host_view_) { |
| 3291 DCHECK(popup_parent_host_view_->popup_child_host_view_ == NULL || | 3278 DCHECK(popup_parent_host_view_->popup_child_host_view_ == NULL || |
| 3292 popup_parent_host_view_->popup_child_host_view_ == this); | 3279 popup_parent_host_view_->popup_child_host_view_ == this); |
| 3293 popup_parent_host_view_->popup_child_host_view_ = NULL; | 3280 popup_parent_host_view_->popup_child_host_view_ = NULL; |
| 3294 } | 3281 } |
| 3295 if (popup_child_host_view_) { | 3282 if (popup_child_host_view_) { |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3543 RenderWidgetHost* widget) { | 3530 RenderWidgetHost* widget) { |
| 3544 return new RenderWidgetHostViewAura(widget); | 3531 return new RenderWidgetHostViewAura(widget); |
| 3545 } | 3532 } |
| 3546 | 3533 |
| 3547 // static | 3534 // static |
| 3548 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { | 3535 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { |
| 3549 GetScreenInfoForWindow(results, NULL); | 3536 GetScreenInfoForWindow(results, NULL); |
| 3550 } | 3537 } |
| 3551 | 3538 |
| 3552 } // namespace content | 3539 } // namespace content |
| OLD | NEW |