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 <objc/runtime.h> | 7 #import <objc/runtime.h> |
8 #include <OpenGL/gl.h> | 8 #include <OpenGL/gl.h> |
9 #include <QuartzCore/QuartzCore.h> | 9 #include <QuartzCore/QuartzCore.h> |
10 #include <stdint.h> | 10 #include <stdint.h> |
11 | 11 |
12 #include <limits> | 12 #include <limits> |
13 #include <utility> | 13 #include <utility> |
14 | 14 |
15 #include "base/bind.h" | 15 #include "base/bind.h" |
16 #include "base/callback_helpers.h" | 16 #include "base/callback_helpers.h" |
17 #include "base/command_line.h" | 17 #include "base/command_line.h" |
18 #include "base/debug/crash_logging.h" | 18 #include "base/debug/crash_logging.h" |
19 #include "base/logging.h" | 19 #include "base/logging.h" |
20 #include "base/mac/scoped_cftyperef.h" | 20 #include "base/mac/scoped_cftyperef.h" |
21 #import "base/mac/scoped_nsobject.h" | 21 #import "base/mac/scoped_nsobject.h" |
22 #include "base/mac/sdk_forward_declarations.h" | 22 #include "base/mac/sdk_forward_declarations.h" |
23 #include "base/memory/ref_counted.h" | 23 #include "base/memory/ref_counted.h" |
24 #include "base/message_loop/message_loop.h" | |
25 #include "base/metrics/histogram.h" | 24 #include "base/metrics/histogram.h" |
26 #include "base/numerics/safe_conversions.h" | 25 #include "base/numerics/safe_conversions.h" |
27 #include "base/strings/string_util.h" | 26 #include "base/strings/string_util.h" |
28 #include "base/strings/stringprintf.h" | 27 #include "base/strings/stringprintf.h" |
29 #include "base/strings/sys_string_conversions.h" | 28 #include "base/strings/sys_string_conversions.h" |
30 #include "base/strings/utf_string_conversions.h" | 29 #include "base/strings/utf_string_conversions.h" |
31 #include "base/sys_info.h" | 30 #include "base/sys_info.h" |
| 31 #include "base/threading/thread_task_runner_handle.h" |
32 #include "base/trace_event/trace_event.h" | 32 #include "base/trace_event/trace_event.h" |
33 #import "content/browser/accessibility/browser_accessibility_cocoa.h" | 33 #import "content/browser/accessibility/browser_accessibility_cocoa.h" |
34 #import "content/browser/accessibility/browser_accessibility_mac.h" | 34 #import "content/browser/accessibility/browser_accessibility_mac.h" |
35 #include "content/browser/accessibility/browser_accessibility_manager_mac.h" | 35 #include "content/browser/accessibility/browser_accessibility_manager_mac.h" |
36 #include "content/browser/bad_message.h" | 36 #include "content/browser/bad_message.h" |
37 #import "content/browser/cocoa/system_hotkey_helper_mac.h" | 37 #import "content/browser/cocoa/system_hotkey_helper_mac.h" |
38 #import "content/browser/cocoa/system_hotkey_map.h" | 38 #import "content/browser/cocoa/system_hotkey_map.h" |
39 #include "content/browser/frame_host/frame_tree.h" | 39 #include "content/browser/frame_host/frame_tree.h" |
40 #include "content/browser/frame_host/frame_tree_node.h" | 40 #include "content/browser/frame_host/frame_tree_node.h" |
41 #include "content/browser/frame_host/render_frame_host_impl.h" | 41 #include "content/browser/frame_host/render_frame_host_impl.h" |
(...skipping 1082 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1124 } | 1124 } |
1125 } | 1125 } |
1126 | 1126 |
1127 void RenderWidgetHostViewMac::OnSetNeedsBeginFrames(bool needs_begin_frames) { | 1127 void RenderWidgetHostViewMac::OnSetNeedsBeginFrames(bool needs_begin_frames) { |
1128 browser_compositor_->SetNeedsBeginFrames(needs_begin_frames); | 1128 browser_compositor_->SetNeedsBeginFrames(needs_begin_frames); |
1129 } | 1129 } |
1130 | 1130 |
1131 void RenderWidgetHostViewMac::KillSelf() { | 1131 void RenderWidgetHostViewMac::KillSelf() { |
1132 if (!weak_factory_.HasWeakPtrs()) { | 1132 if (!weak_factory_.HasWeakPtrs()) { |
1133 [cocoa_view_ setHidden:YES]; | 1133 [cocoa_view_ setHidden:YES]; |
1134 base::MessageLoop::current()->PostTask(FROM_HERE, | 1134 base::ThreadTaskRunnerHandle::Get()->PostTask( |
1135 base::Bind(&RenderWidgetHostViewMac::ShutdownHost, | 1135 FROM_HERE, base::Bind(&RenderWidgetHostViewMac::ShutdownHost, |
1136 weak_factory_.GetWeakPtr())); | 1136 weak_factory_.GetWeakPtr())); |
1137 } | 1137 } |
1138 } | 1138 } |
1139 | 1139 |
1140 bool RenderWidgetHostViewMac::GetLineBreakIndex( | 1140 bool RenderWidgetHostViewMac::GetLineBreakIndex( |
1141 const std::vector<gfx::Rect>& bounds, | 1141 const std::vector<gfx::Rect>& bounds, |
1142 const gfx::Range& range, | 1142 const gfx::Range& range, |
1143 size_t* line_break_point) { | 1143 size_t* line_break_point) { |
1144 DCHECK(line_break_point); | 1144 DCHECK(line_break_point); |
1145 if (range.start() >= bounds.size() || range.is_reversed() || range.is_empty()) | 1145 if (range.start() >= bounds.size() || range.is_reversed() || range.is_empty()) |
1146 return false; | 1146 return false; |
(...skipping 2080 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3227 | 3227 |
3228 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding | 3228 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding |
3229 // regions that are not draggable. (See ControlRegionView in | 3229 // regions that are not draggable. (See ControlRegionView in |
3230 // native_app_window_cocoa.mm). This requires the render host view to be | 3230 // native_app_window_cocoa.mm). This requires the render host view to be |
3231 // draggable by default. | 3231 // draggable by default. |
3232 - (BOOL)mouseDownCanMoveWindow { | 3232 - (BOOL)mouseDownCanMoveWindow { |
3233 return YES; | 3233 return YES; |
3234 } | 3234 } |
3235 | 3235 |
3236 @end | 3236 @end |
OLD | NEW |