Chromium Code Reviews| 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_android.h" | 5 #include "content/browser/renderer_host/render_widget_host_view_android.h" |
| 6 | 6 |
| 7 #include <android/bitmap.h> | 7 #include <android/bitmap.h> |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 251 RenderWidgetHostViewAndroid::GetRenderWidgetHost() const { | 251 RenderWidgetHostViewAndroid::GetRenderWidgetHost() const { |
| 252 return host_; | 252 return host_; |
| 253 } | 253 } |
| 254 | 254 |
| 255 void RenderWidgetHostViewAndroid::WasShown() { | 255 void RenderWidgetHostViewAndroid::WasShown() { |
| 256 if (!host_ || !host_->is_hidden()) | 256 if (!host_ || !host_->is_hidden()) |
| 257 return; | 257 return; |
| 258 | 258 |
| 259 host_->WasShown(); | 259 host_->WasShown(); |
| 260 | 260 |
| 261 if (content_view_core_ && !using_synchronous_compositor_) { | 261 if (content_view_core_) { |
|
hush (inactive)
2014/08/09 03:28:12
btw, WasShown() is not called when you use Aw Test
boliu
2014/08/11 15:57:47
Should be called in aw shell from here:
https://co
| |
| 262 content_view_core_->GetWindowAndroid()->AddObserver(this); | 262 content_view_core_->GetWindowAndroid()->AddObserver(this); |
| 263 content_view_core_->GetWindowAndroid()->RequestVSyncUpdate(); | 263 content_view_core_->GetWindowAndroid()->RequestVSyncUpdate(); |
| 264 observing_root_window_ = true; | 264 observing_root_window_ = true; |
| 265 } | 265 } |
| 266 } | 266 } |
| 267 | 267 |
| 268 void RenderWidgetHostViewAndroid::WasHidden() { | 268 void RenderWidgetHostViewAndroid::WasHidden() { |
| 269 RunAckCallbacks(); | 269 RunAckCallbacks(); |
| 270 | 270 |
| 271 if (!host_ || host_->is_hidden()) | 271 if (!host_ || host_->is_hidden()) |
| 272 return; | 272 return; |
| 273 | 273 |
| 274 // Inform the renderer that we are being hidden so it can reduce its resource | 274 // Inform the renderer that we are being hidden so it can reduce its resource |
| 275 // utilization. | 275 // utilization. |
| 276 host_->WasHidden(); | 276 host_->WasHidden(); |
| 277 | 277 |
| 278 if (content_view_core_ && !using_synchronous_compositor_) { | 278 if (content_view_core_) { |
| 279 content_view_core_->GetWindowAndroid()->RemoveObserver(this); | 279 content_view_core_->GetWindowAndroid()->RemoveObserver(this); |
| 280 observing_root_window_ = false; | 280 observing_root_window_ = false; |
| 281 } | 281 } |
| 282 } | 282 } |
| 283 | 283 |
| 284 void RenderWidgetHostViewAndroid::WasResized() { | 284 void RenderWidgetHostViewAndroid::WasResized() { |
| 285 host_->WasResized(); | 285 host_->WasResized(); |
| 286 } | 286 } |
| 287 | 287 |
| 288 void RenderWidgetHostViewAndroid::SetSize(const gfx::Size& size) { | 288 void RenderWidgetHostViewAndroid::SetSize(const gfx::Size& size) { |
| (...skipping 1144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1433 if (content_view_core_) | 1433 if (content_view_core_) |
| 1434 obj = content_view_core_->GetJavaObject(); | 1434 obj = content_view_core_->GetJavaObject(); |
| 1435 manager->ToBrowserAccessibilityManagerAndroid()->SetContentViewCore(obj); | 1435 manager->ToBrowserAccessibilityManagerAndroid()->SetContentViewCore(obj); |
| 1436 } | 1436 } |
| 1437 | 1437 |
| 1438 AttachLayers(); | 1438 AttachLayers(); |
| 1439 | 1439 |
| 1440 if (!content_view_core_) | 1440 if (!content_view_core_) |
| 1441 return; | 1441 return; |
| 1442 | 1442 |
| 1443 if (!using_synchronous_compositor_) { | 1443 content_view_core_->GetWindowAndroid()->AddObserver(this); |
| 1444 content_view_core_->GetWindowAndroid()->AddObserver(this); | 1444 observing_root_window_ = true; |
| 1445 observing_root_window_ = true; | 1445 if (needs_begin_frame_) |
| 1446 if (needs_begin_frame_) | 1446 content_view_core_->GetWindowAndroid()->RequestVSyncUpdate(); |
| 1447 content_view_core_->GetWindowAndroid()->RequestVSyncUpdate(); | |
| 1448 } | |
| 1449 | 1447 |
| 1450 if (resize) | 1448 if (resize) |
| 1451 WasResized(); | 1449 WasResized(); |
| 1452 | 1450 |
| 1453 if (!selection_controller_) | 1451 if (!selection_controller_) |
| 1454 selection_controller_.reset(new TouchSelectionController(this)); | 1452 selection_controller_.reset(new TouchSelectionController(this)); |
| 1455 } | 1453 } |
| 1456 | 1454 |
| 1457 void RenderWidgetHostViewAndroid::RunAckCallbacks() { | 1455 void RenderWidgetHostViewAndroid::RunAckCallbacks() { |
| 1458 while (!ack_callbacks_.empty()) { | 1456 while (!ack_callbacks_.empty()) { |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1650 results->orientationAngle = display.RotationAsDegree(); | 1648 results->orientationAngle = display.RotationAsDegree(); |
| 1651 results->orientationType = | 1649 results->orientationType = |
| 1652 RenderWidgetHostViewBase::GetOrientationTypeForMobile(display); | 1650 RenderWidgetHostViewBase::GetOrientationTypeForMobile(display); |
| 1653 gfx::DeviceDisplayInfo info; | 1651 gfx::DeviceDisplayInfo info; |
| 1654 results->depth = info.GetBitsPerPixel(); | 1652 results->depth = info.GetBitsPerPixel(); |
| 1655 results->depthPerComponent = info.GetBitsPerComponent(); | 1653 results->depthPerComponent = info.GetBitsPerComponent(); |
| 1656 results->isMonochrome = (results->depthPerComponent == 0); | 1654 results->isMonochrome = (results->depthPerComponent == 0); |
| 1657 } | 1655 } |
| 1658 | 1656 |
| 1659 } // namespace content | 1657 } // namespace content |
| OLD | NEW |