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

Side by Side Diff: content/browser/renderer_host/render_widget_host_impl.cc

Issue 2219823002: Move content offset to ViewAndroid (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: updated comments Created 3 years, 11 months 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
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 "content/browser/renderer_host/render_widget_host_impl.h" 5 #include "content/browser/renderer_host/render_widget_host_impl.h"
6 6
7 #include <math.h> 7 #include <math.h>
8 8
9 #include <set> 9 #include <set>
10 #include <tuple> 10 #include <tuple>
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 #include "ui/events/blink/web_input_event_traits.h" 84 #include "ui/events/blink/web_input_event_traits.h"
85 #include "ui/events/event.h" 85 #include "ui/events/event.h"
86 #include "ui/events/keycodes/keyboard_codes.h" 86 #include "ui/events/keycodes/keyboard_codes.h"
87 #include "ui/gfx/color_space.h" 87 #include "ui/gfx/color_space.h"
88 #include "ui/gfx/geometry/size_conversions.h" 88 #include "ui/gfx/geometry/size_conversions.h"
89 #include "ui/gfx/geometry/vector2d_conversions.h" 89 #include "ui/gfx/geometry/vector2d_conversions.h"
90 #include "ui/gfx/image/image_skia.h" 90 #include "ui/gfx/image/image_skia.h"
91 #include "ui/gfx/skbitmap_operations.h" 91 #include "ui/gfx/skbitmap_operations.h"
92 #include "ui/snapshot/snapshot.h" 92 #include "ui/snapshot/snapshot.h"
93 93
94 #if defined(OS_ANDROID)
95 #include "ui/android/view_android.h"
96 #endif
97
94 #if defined(OS_MACOSX) 98 #if defined(OS_MACOSX)
95 #include "device/power_save_blocker/power_save_blocker.h" 99 #include "device/power_save_blocker/power_save_blocker.h"
96 #include "ui/accelerated_widget_mac/window_resize_helper_mac.h" 100 #include "ui/accelerated_widget_mac/window_resize_helper_mac.h"
97 #endif 101 #endif
98 102
99 using base::Time; 103 using base::Time;
100 using base::TimeDelta; 104 using base::TimeDelta;
101 using base::TimeTicks; 105 using base::TimeTicks;
102 using blink::WebDragOperation; 106 using blink::WebDragOperation;
103 using blink::WebDragOperationsMask; 107 using blink::WebDragOperationsMask;
(...skipping 2242 matching lines...) Expand 10 before | Expand all | Expand 10 after
2346 is_running_navigation_hint_task); 2350 is_running_navigation_hint_task);
2347 } 2351 }
2348 2352
2349 void RenderWidgetHostImpl::DidReceiveRendererFrame() { 2353 void RenderWidgetHostImpl::DidReceiveRendererFrame() {
2350 view_->DidReceiveRendererFrame(); 2354 view_->DidReceiveRendererFrame();
2351 } 2355 }
2352 2356
2353 void RenderWidgetHostImpl::WindowSnapshotReachedScreen(int snapshot_id) { 2357 void RenderWidgetHostImpl::WindowSnapshotReachedScreen(int snapshot_id) {
2354 DCHECK(base::MessageLoopForUI::IsCurrent()); 2358 DCHECK(base::MessageLoopForUI::IsCurrent());
2355 2359
2356 gfx::Rect view_bounds = GetView()->GetViewBounds(); 2360 #if defined(OS_ANDROID)
2357 gfx::Rect snapshot_bounds(view_bounds.size()); 2361 // On Android, call sites should pass in the bounds with correct offset
2362 // to capture the intended content area.
2363 gfx::Rect snapshot_bounds(GetView()->GetViewBounds());
2364 snapshot_bounds.Offset(0, GetView()->GetNativeView()->content_offset().y());
2365 #else
2366 gfx::Rect snapshot_bounds(GetView()->GetViewBounds().size());
2367 #endif
2358 2368
2359 std::vector<unsigned char> png; 2369 std::vector<unsigned char> png;
2360 if (ui::GrabViewSnapshot( 2370 if (ui::GrabViewSnapshot(
2361 GetView()->GetNativeView(), &png, snapshot_bounds)) { 2371 GetView()->GetNativeView(), &png, snapshot_bounds)) {
2362 OnSnapshotDataReceived(snapshot_id, &png.front(), png.size()); 2372 OnSnapshotDataReceived(snapshot_id, &png.front(), png.size());
2363 return; 2373 return;
2364 } 2374 }
2365 2375
2366 ui::GrabViewSnapshotAsync( 2376 ui::GrabViewSnapshotAsync(
2367 GetView()->GetNativeView(), 2377 GetView()->GetNativeView(),
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
2514 // different from the receiver's. 2524 // different from the receiver's.
2515 file_system_file.url = 2525 file_system_file.url =
2516 GURL(storage::GetIsolatedFileSystemRootURIString( 2526 GURL(storage::GetIsolatedFileSystemRootURIString(
2517 file_system_url.origin(), filesystem_id, std::string()) 2527 file_system_url.origin(), filesystem_id, std::string())
2518 .append(register_name)); 2528 .append(register_name));
2519 file_system_file.filesystem_id = filesystem_id; 2529 file_system_file.filesystem_id = filesystem_id;
2520 } 2530 }
2521 } 2531 }
2522 2532
2523 } // namespace content 2533 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/android/content_view_core_impl.cc ('k') | content/browser/renderer_host/render_widget_host_view_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698