| 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 <utility> | 9 #include <utility> |
| 10 | 10 |
| 11 #include "base/android/application_status_listener.h" | 11 #include "base/android/application_status_listener.h" |
| 12 #include "base/android/build_info.h" | 12 #include "base/android/build_info.h" |
| 13 #include "base/android/context_utils.h" | |
| 14 #include "base/bind.h" | 13 #include "base/bind.h" |
| 15 #include "base/callback_helpers.h" | 14 #include "base/callback_helpers.h" |
| 16 #include "base/command_line.h" | 15 #include "base/command_line.h" |
| 17 #include "base/location.h" | 16 #include "base/location.h" |
| 18 #include "base/logging.h" | 17 #include "base/logging.h" |
| 19 #include "base/macros.h" | 18 #include "base/macros.h" |
| 20 #include "base/memory/ptr_util.h" | 19 #include "base/memory/ptr_util.h" |
| 21 #include "base/memory/ref_counted.h" | 20 #include "base/memory/ref_counted.h" |
| 22 #include "base/metrics/histogram_macros.h" | 21 #include "base/metrics/histogram_macros.h" |
| 23 #include "base/single_thread_task_runner.h" | 22 #include "base/single_thread_task_runner.h" |
| (...skipping 1289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1313 RenderWidgetHostViewAndroid::CreateDrawable() { | 1312 RenderWidgetHostViewAndroid::CreateDrawable() { |
| 1314 DCHECK(content_view_core_); | 1313 DCHECK(content_view_core_); |
| 1315 if (!using_browser_compositor_) { | 1314 if (!using_browser_compositor_) { |
| 1316 if (!sync_compositor_) | 1315 if (!sync_compositor_) |
| 1317 return nullptr; | 1316 return nullptr; |
| 1318 return std::unique_ptr<ui::TouchHandleDrawable>( | 1317 return std::unique_ptr<ui::TouchHandleDrawable>( |
| 1319 sync_compositor_->client()->CreateDrawable()); | 1318 sync_compositor_->client()->CreateDrawable()); |
| 1320 } | 1319 } |
| 1321 base::android::ScopedJavaLocalRef<jobject> activityContext = | 1320 base::android::ScopedJavaLocalRef<jobject> activityContext = |
| 1322 content_view_core_->GetContext(); | 1321 content_view_core_->GetContext(); |
| 1322 // If activityContext is null then Application context is used instead on |
| 1323 // the java side in CompositedTouchHandleDrawable. |
| 1323 return std::unique_ptr<ui::TouchHandleDrawable>( | 1324 return std::unique_ptr<ui::TouchHandleDrawable>( |
| 1324 new CompositedTouchHandleDrawable( | 1325 new CompositedTouchHandleDrawable( |
| 1325 content_view_core_->GetViewAndroid()->GetLayer(), view_.GetDipScale(), | 1326 content_view_core_->GetViewAndroid()->GetLayer(), view_.GetDipScale(), |
| 1326 // Use the activity context where possible (instead of the application | 1327 activityContext)); |
| 1327 // context) to ensure proper handle theming. | |
| 1328 activityContext.is_null() ? base::android::GetApplicationContext() | |
| 1329 : activityContext)); | |
| 1330 } | 1328 } |
| 1331 | 1329 |
| 1332 void RenderWidgetHostViewAndroid::SynchronousCopyContents( | 1330 void RenderWidgetHostViewAndroid::SynchronousCopyContents( |
| 1333 const gfx::Rect& src_subrect_in_pixel, | 1331 const gfx::Rect& src_subrect_in_pixel, |
| 1334 const gfx::Size& dst_size_in_pixel, | 1332 const gfx::Size& dst_size_in_pixel, |
| 1335 const ReadbackRequestCallback& callback, | 1333 const ReadbackRequestCallback& callback, |
| 1336 const SkColorType color_type) { | 1334 const SkColorType color_type) { |
| 1337 // TODO(crbug/698974): [BUG] Current implementation does not support read-back | 1335 // TODO(crbug/698974): [BUG] Current implementation does not support read-back |
| 1338 // of regions that do not originate at (0,0). | 1336 // of regions that do not originate at (0,0). |
| 1339 const gfx::Size& input_size_in_pixel = src_subrect_in_pixel.size(); | 1337 const gfx::Size& input_size_in_pixel = src_subrect_in_pixel.size(); |
| (...skipping 851 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2191 | 2189 |
| 2192 ui::WindowAndroidCompositor* compositor = window_android->GetCompositor(); | 2190 ui::WindowAndroidCompositor* compositor = window_android->GetCompositor(); |
| 2193 if (!compositor) | 2191 if (!compositor) |
| 2194 return; | 2192 return; |
| 2195 | 2193 |
| 2196 overscroll_controller_ = base::MakeUnique<OverscrollControllerAndroid>( | 2194 overscroll_controller_ = base::MakeUnique<OverscrollControllerAndroid>( |
| 2197 overscroll_refresh_handler, compositor, view_.GetDipScale()); | 2195 overscroll_refresh_handler, compositor, view_.GetDipScale()); |
| 2198 } | 2196 } |
| 2199 | 2197 |
| 2200 } // namespace content | 2198 } // namespace content |
| OLD | NEW |