| 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" | |
| 39 #import "content/browser/cocoa/system_hotkey_helper_mac.h" | 38 #import "content/browser/cocoa/system_hotkey_helper_mac.h" |
| 40 #import "content/browser/cocoa/system_hotkey_map.h" | 39 #import "content/browser/cocoa/system_hotkey_map.h" |
| 41 #include "content/browser/frame_host/frame_tree.h" | 40 #include "content/browser/frame_host/frame_tree.h" |
| 42 #include "content/browser/frame_host/frame_tree_node.h" | 41 #include "content/browser/frame_host/frame_tree_node.h" |
| 43 #include "content/browser/frame_host/render_frame_host_impl.h" | 42 #include "content/browser/frame_host/render_frame_host_impl.h" |
| 44 #include "content/browser/gpu/compositor_util.h" | 43 #include "content/browser/gpu/compositor_util.h" |
| 45 #import "content/browser/renderer_host/input/synthetic_gesture_target_mac.h" | 44 #import "content/browser/renderer_host/input/synthetic_gesture_target_mac.h" |
| 46 #include "content/browser/renderer_host/input/web_input_event_builders_mac.h" | 45 #include "content/browser/renderer_host/input/web_input_event_builders_mac.h" |
| 47 #include "content/browser/renderer_host/render_view_host_impl.h" | 46 #include "content/browser/renderer_host/render_view_host_impl.h" |
| 48 #include "content/browser/renderer_host/render_widget_helper.h" | 47 #include "content/browser/renderer_host/render_widget_helper.h" |
| (...skipping 1351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1400 | 1399 |
| 1401 void RenderWidgetHostViewMac::OnSwapCompositorFrame( | 1400 void RenderWidgetHostViewMac::OnSwapCompositorFrame( |
| 1402 uint32_t compositor_frame_sink_id, | 1401 uint32_t compositor_frame_sink_id, |
| 1403 cc::CompositorFrame frame) { | 1402 cc::CompositorFrame frame) { |
| 1404 TRACE_EVENT0("browser", "RenderWidgetHostViewMac::OnSwapCompositorFrame"); | 1403 TRACE_EVENT0("browser", "RenderWidgetHostViewMac::OnSwapCompositorFrame"); |
| 1405 | 1404 |
| 1406 last_scroll_offset_ = frame.metadata.root_scroll_offset; | 1405 last_scroll_offset_ = frame.metadata.root_scroll_offset; |
| 1407 | 1406 |
| 1408 page_at_minimum_scale_ = | 1407 page_at_minimum_scale_ = |
| 1409 frame.metadata.page_scale_factor == frame.metadata.min_page_scale_factor; | 1408 frame.metadata.page_scale_factor == frame.metadata.min_page_scale_factor; |
| 1410 if (frame.delegated_frame_data) { | 1409 browser_compositor_->SwapCompositorFrame(compositor_frame_sink_id, |
| 1411 browser_compositor_->SwapCompositorFrame(compositor_frame_sink_id, | 1410 std::move(frame)); |
| 1412 std::move(frame)); | 1411 UpdateDisplayVSyncParameters(); |
| 1413 UpdateDisplayVSyncParameters(); | |
| 1414 } else { | |
| 1415 DLOG(ERROR) << "Received unexpected frame type."; | |
| 1416 bad_message::ReceivedBadMessage(render_widget_host_->GetProcess(), | |
| 1417 bad_message::RWHVM_UNEXPECTED_FRAME_TYPE); | |
| 1418 } | |
| 1419 } | 1412 } |
| 1420 | 1413 |
| 1421 void RenderWidgetHostViewMac::ClearCompositorFrame() { | 1414 void RenderWidgetHostViewMac::ClearCompositorFrame() { |
| 1422 browser_compositor_->GetDelegatedFrameHost()->ClearDelegatedFrame(); | 1415 browser_compositor_->GetDelegatedFrameHost()->ClearDelegatedFrame(); |
| 1423 } | 1416 } |
| 1424 | 1417 |
| 1425 gfx::Rect RenderWidgetHostViewMac::GetBoundsInRootWindow() { | 1418 gfx::Rect RenderWidgetHostViewMac::GetBoundsInRootWindow() { |
| 1426 // TODO(shess): In case of !window, the view has been removed from | 1419 // TODO(shess): In case of !window, the view has been removed from |
| 1427 // the view hierarchy because the tab isn't main. Could retrieve | 1420 // the view hierarchy because the tab isn't main. Could retrieve |
| 1428 // the information from the main tab for our window. | 1421 // the information from the main tab for our window. |
| (...skipping 1983 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3412 | 3405 |
| 3413 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding | 3406 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding |
| 3414 // regions that are not draggable. (See ControlRegionView in | 3407 // regions that are not draggable. (See ControlRegionView in |
| 3415 // native_app_window_cocoa.mm). This requires the render host view to be | 3408 // native_app_window_cocoa.mm). This requires the render host view to be |
| 3416 // draggable by default. | 3409 // draggable by default. |
| 3417 - (BOOL)mouseDownCanMoveWindow { | 3410 - (BOOL)mouseDownCanMoveWindow { |
| 3418 return YES; | 3411 return YES; |
| 3419 } | 3412 } |
| 3420 | 3413 |
| 3421 @end | 3414 @end |
| OLD | NEW |