| 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_mac.h" | 5 #include "content/browser/renderer_host/render_widget_host_view_mac.h" |
| 6 | 6 |
| 7 #import <Carbon/Carbon.h> | 7 #import <Carbon/Carbon.h> |
| 8 #import <objc/runtime.h> | 8 #import <objc/runtime.h> |
| 9 #include <OpenGL/gl.h> | 9 #include <OpenGL/gl.h> |
| 10 #include <QuartzCore/QuartzCore.h> | 10 #include <QuartzCore/QuartzCore.h> |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 #include "base/strings/string_util.h" | 28 #include "base/strings/string_util.h" |
| 29 #include "base/strings/stringprintf.h" | 29 #include "base/strings/stringprintf.h" |
| 30 #include "base/strings/sys_string_conversions.h" | 30 #include "base/strings/sys_string_conversions.h" |
| 31 #include "base/strings/utf_string_conversions.h" | 31 #include "base/strings/utf_string_conversions.h" |
| 32 #include "base/sys_info.h" | 32 #include "base/sys_info.h" |
| 33 #include "base/threading/thread_task_runner_handle.h" | 33 #include "base/threading/thread_task_runner_handle.h" |
| 34 #include "base/trace_event/trace_event.h" | 34 #include "base/trace_event/trace_event.h" |
| 35 #import "content/browser/accessibility/browser_accessibility_cocoa.h" | 35 #import "content/browser/accessibility/browser_accessibility_cocoa.h" |
| 36 #import "content/browser/accessibility/browser_accessibility_mac.h" | 36 #import "content/browser/accessibility/browser_accessibility_mac.h" |
| 37 #include "content/browser/accessibility/browser_accessibility_manager_mac.h" | 37 #include "content/browser/accessibility/browser_accessibility_manager_mac.h" |
| 38 #include "content/browser/bad_message.h" |
| 38 #import "content/browser/cocoa/system_hotkey_helper_mac.h" | 39 #import "content/browser/cocoa/system_hotkey_helper_mac.h" |
| 39 #import "content/browser/cocoa/system_hotkey_map.h" | 40 #import "content/browser/cocoa/system_hotkey_map.h" |
| 40 #include "content/browser/frame_host/frame_tree.h" | 41 #include "content/browser/frame_host/frame_tree.h" |
| 41 #include "content/browser/frame_host/frame_tree_node.h" | 42 #include "content/browser/frame_host/frame_tree_node.h" |
| 42 #include "content/browser/frame_host/render_frame_host_impl.h" | 43 #include "content/browser/frame_host/render_frame_host_impl.h" |
| 43 #include "content/browser/gpu/compositor_util.h" | 44 #include "content/browser/gpu/compositor_util.h" |
| 44 #import "content/browser/renderer_host/input/synthetic_gesture_target_mac.h" | 45 #import "content/browser/renderer_host/input/synthetic_gesture_target_mac.h" |
| 45 #include "content/browser/renderer_host/input/web_input_event_builders_mac.h" | 46 #include "content/browser/renderer_host/input/web_input_event_builders_mac.h" |
| 46 #include "content/browser/renderer_host/render_view_host_impl.h" | 47 #include "content/browser/renderer_host/render_view_host_impl.h" |
| 47 #include "content/browser/renderer_host/render_widget_helper.h" | 48 #include "content/browser/renderer_host/render_widget_helper.h" |
| (...skipping 1360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1408 | 1409 |
| 1409 void RenderWidgetHostViewMac::OnSwapCompositorFrame( | 1410 void RenderWidgetHostViewMac::OnSwapCompositorFrame( |
| 1410 uint32_t compositor_frame_sink_id, | 1411 uint32_t compositor_frame_sink_id, |
| 1411 cc::CompositorFrame frame) { | 1412 cc::CompositorFrame frame) { |
| 1412 TRACE_EVENT0("browser", "RenderWidgetHostViewMac::OnSwapCompositorFrame"); | 1413 TRACE_EVENT0("browser", "RenderWidgetHostViewMac::OnSwapCompositorFrame"); |
| 1413 | 1414 |
| 1414 last_scroll_offset_ = frame.metadata.root_scroll_offset; | 1415 last_scroll_offset_ = frame.metadata.root_scroll_offset; |
| 1415 | 1416 |
| 1416 page_at_minimum_scale_ = | 1417 page_at_minimum_scale_ = |
| 1417 frame.metadata.page_scale_factor == frame.metadata.min_page_scale_factor; | 1418 frame.metadata.page_scale_factor == frame.metadata.min_page_scale_factor; |
| 1418 browser_compositor_->SwapCompositorFrame(compositor_frame_sink_id, | 1419 if (frame.delegated_frame_data) { |
| 1419 std::move(frame)); | 1420 browser_compositor_->SwapCompositorFrame(compositor_frame_sink_id, |
| 1420 UpdateDisplayVSyncParameters(); | 1421 std::move(frame)); |
| 1422 UpdateDisplayVSyncParameters(); |
| 1423 } else { |
| 1424 DLOG(ERROR) << "Received unexpected frame type."; |
| 1425 bad_message::ReceivedBadMessage(render_widget_host_->GetProcess(), |
| 1426 bad_message::RWHVM_UNEXPECTED_FRAME_TYPE); |
| 1427 } |
| 1421 } | 1428 } |
| 1422 | 1429 |
| 1423 void RenderWidgetHostViewMac::ClearCompositorFrame() { | 1430 void RenderWidgetHostViewMac::ClearCompositorFrame() { |
| 1424 browser_compositor_->GetDelegatedFrameHost()->ClearDelegatedFrame(); | 1431 browser_compositor_->GetDelegatedFrameHost()->ClearDelegatedFrame(); |
| 1425 } | 1432 } |
| 1426 | 1433 |
| 1427 gfx::Rect RenderWidgetHostViewMac::GetBoundsInRootWindow() { | 1434 gfx::Rect RenderWidgetHostViewMac::GetBoundsInRootWindow() { |
| 1428 // TODO(shess): In case of !window, the view has been removed from | 1435 // TODO(shess): In case of !window, the view has been removed from |
| 1429 // the view hierarchy because the tab isn't main. Could retrieve | 1436 // the view hierarchy because the tab isn't main. Could retrieve |
| 1430 // the information from the main tab for our window. | 1437 // the information from the main tab for our window. |
| (...skipping 2007 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3438 | 3445 |
| 3439 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding | 3446 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding |
| 3440 // regions that are not draggable. (See ControlRegionView in | 3447 // regions that are not draggable. (See ControlRegionView in |
| 3441 // native_app_window_cocoa.mm). This requires the render host view to be | 3448 // native_app_window_cocoa.mm). This requires the render host view to be |
| 3442 // draggable by default. | 3449 // draggable by default. |
| 3443 - (BOOL)mouseDownCanMoveWindow { | 3450 - (BOOL)mouseDownCanMoveWindow { |
| 3444 return YES; | 3451 return YES; |
| 3445 } | 3452 } |
| 3446 | 3453 |
| 3447 @end | 3454 @end |
| OLD | NEW |