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 <QuartzCore/QuartzCore.h> | 8 #include <QuartzCore/QuartzCore.h> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/bind.h" | 11 #include "base/bind.h" |
12 #include "base/callback_helpers.h" | 12 #include "base/callback_helpers.h" |
13 #include "base/command_line.h" | 13 #include "base/command_line.h" |
14 #include "base/debug/crash_logging.h" | 14 #include "base/debug/crash_logging.h" |
15 #include "base/debug/trace_event.h" | 15 #include "base/debug/trace_event.h" |
16 #include "base/logging.h" | 16 #include "base/logging.h" |
17 #include "base/mac/mac_util.h" | 17 #include "base/mac/mac_util.h" |
18 #include "base/mac/scoped_cftyperef.h" | 18 #include "base/mac/scoped_cftyperef.h" |
19 #import "base/mac/scoped_nsobject.h" | 19 #import "base/mac/scoped_nsobject.h" |
20 #include "base/mac/sdk_forward_declarations.h" | 20 #include "base/mac/sdk_forward_declarations.h" |
21 #include "base/message_loop/message_loop.h" | 21 #include "base/message_loop/message_loop.h" |
22 #include "base/metrics/histogram.h" | 22 #include "base/metrics/histogram.h" |
23 #include "base/strings/string_util.h" | 23 #include "base/strings/string_util.h" |
24 #include "base/strings/stringprintf.h" | 24 #include "base/strings/stringprintf.h" |
25 #include "base/strings/sys_string_conversions.h" | 25 #include "base/strings/sys_string_conversions.h" |
26 #include "base/strings/utf_string_conversions.h" | 26 #include "base/strings/utf_string_conversions.h" |
27 #include "base/sys_info.h" | 27 #include "base/sys_info.h" |
28 #import "content/browser/accessibility/browser_accessibility_cocoa.h" | 28 #import "content/browser/accessibility/browser_accessibility_cocoa.h" |
29 #include "content/browser/accessibility/browser_accessibility_manager_mac.h" | 29 #include "content/browser/accessibility/browser_accessibility_manager_mac.h" |
30 #include "content/browser/frame_host/render_frame_host_impl.h" | |
nasko
2014/03/05 21:50:47
nit: Why include the impl when using only the publ
jam
2014/03/06 00:59:37
that's the recommended style for includes inside c
| |
30 #include "content/browser/renderer_host/backing_store_mac.h" | 31 #include "content/browser/renderer_host/backing_store_mac.h" |
31 #include "content/browser/renderer_host/backing_store_manager.h" | 32 #include "content/browser/renderer_host/backing_store_manager.h" |
32 #include "content/browser/renderer_host/compositing_iosurface_context_mac.h" | 33 #include "content/browser/renderer_host/compositing_iosurface_context_mac.h" |
33 #include "content/browser/renderer_host/compositing_iosurface_layer_mac.h" | 34 #include "content/browser/renderer_host/compositing_iosurface_layer_mac.h" |
34 #include "content/browser/renderer_host/compositing_iosurface_mac.h" | 35 #include "content/browser/renderer_host/compositing_iosurface_mac.h" |
35 #include "content/browser/renderer_host/render_view_host_impl.h" | 36 #include "content/browser/renderer_host/render_view_host_impl.h" |
36 #import "content/browser/renderer_host/render_widget_host_view_mac_dictionary_he lper.h" | 37 #import "content/browser/renderer_host/render_widget_host_view_mac_dictionary_he lper.h" |
37 #import "content/browser/renderer_host/render_widget_host_view_mac_editcommand_h elper.h" | 38 #import "content/browser/renderer_host/render_widget_host_view_mac_editcommand_h elper.h" |
38 #import "content/browser/renderer_host/text_input_client_mac.h" | 39 #import "content/browser/renderer_host/text_input_client_mac.h" |
39 #include "content/common/accessibility_messages.h" | 40 #include "content/common/accessibility_messages.h" |
(...skipping 26 matching lines...) Expand all Loading... | |
66 #include "ui/gfx/screen.h" | 67 #include "ui/gfx/screen.h" |
67 #include "ui/gfx/size_conversions.h" | 68 #include "ui/gfx/size_conversions.h" |
68 #include "ui/gl/gl_switches.h" | 69 #include "ui/gl/gl_switches.h" |
69 #include "ui/gl/io_surface_support_mac.h" | 70 #include "ui/gl/io_surface_support_mac.h" |
70 | 71 |
71 using content::BackingStoreMac; | 72 using content::BackingStoreMac; |
72 using content::BrowserAccessibility; | 73 using content::BrowserAccessibility; |
73 using content::BrowserAccessibilityManager; | 74 using content::BrowserAccessibilityManager; |
74 using content::EditCommand; | 75 using content::EditCommand; |
75 using content::NativeWebKeyboardEvent; | 76 using content::NativeWebKeyboardEvent; |
77 using content::RenderFrameHost; | |
76 using content::RenderViewHostImpl; | 78 using content::RenderViewHostImpl; |
77 using content::RenderWidgetHostImpl; | 79 using content::RenderWidgetHostImpl; |
78 using content::RenderWidgetHostViewMac; | 80 using content::RenderWidgetHostViewMac; |
79 using content::RenderWidgetHostViewMacEditCommandHelper; | 81 using content::RenderWidgetHostViewMacEditCommandHelper; |
80 using content::TextInputClientMac; | 82 using content::TextInputClientMac; |
81 using blink::WebInputEvent; | 83 using blink::WebInputEvent; |
82 using blink::WebInputEventFactory; | 84 using blink::WebInputEventFactory; |
83 using blink::WebMouseEvent; | 85 using blink::WebMouseEvent; |
84 using blink::WebMouseWheelEvent; | 86 using blink::WebMouseWheelEvent; |
85 | 87 |
(...skipping 3875 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3961 | 3963 |
3962 - (void)redo:(id)sender { | 3964 - (void)redo:(id)sender { |
3963 if (renderWidgetHostView_->render_widget_host_->IsRenderView()) { | 3965 if (renderWidgetHostView_->render_widget_host_->IsRenderView()) { |
3964 static_cast<RenderViewHostImpl*>( | 3966 static_cast<RenderViewHostImpl*>( |
3965 renderWidgetHostView_->render_widget_host_)->Redo(); | 3967 renderWidgetHostView_->render_widget_host_)->Redo(); |
3966 } | 3968 } |
3967 } | 3969 } |
3968 | 3970 |
3969 - (void)cut:(id)sender { | 3971 - (void)cut:(id)sender { |
3970 if (renderWidgetHostView_->render_widget_host_->IsRenderView()) { | 3972 if (renderWidgetHostView_->render_widget_host_->IsRenderView()) { |
3971 static_cast<RenderViewHostImpl*>( | 3973 RenderFrameHost* frame = static_cast<RenderViewHostImpl*>( |
3972 renderWidgetHostView_->render_widget_host_)->Cut(); | 3974 renderWidgetHostView_->render_widget_host_)->GetFocusedFrame(); |
3975 if (frame) | |
3976 frame->Cut(); | |
3973 } | 3977 } |
3974 } | 3978 } |
3975 | 3979 |
3976 - (void)copy:(id)sender { | 3980 - (void)copy:(id)sender { |
3977 if (renderWidgetHostView_->render_widget_host_->IsRenderView()) { | 3981 if (renderWidgetHostView_->render_widget_host_->IsRenderView()) { |
3978 static_cast<RenderViewHostImpl*>( | 3982 RenderFrameHost* frame = static_cast<RenderViewHostImpl*>( |
3979 renderWidgetHostView_->render_widget_host_)->Copy(); | 3983 renderWidgetHostView_->render_widget_host_)->GetFocusedFrame(); |
3984 if (frame) | |
3985 frame->Copy(); | |
3980 } | 3986 } |
3981 } | 3987 } |
3982 | 3988 |
3983 - (void)copyToFindPboard:(id)sender { | 3989 - (void)copyToFindPboard:(id)sender { |
3984 if (renderWidgetHostView_->render_widget_host_->IsRenderView()) { | 3990 if (renderWidgetHostView_->render_widget_host_->IsRenderView()) { |
3985 static_cast<RenderViewHostImpl*>( | 3991 static_cast<RenderViewHostImpl*>( |
3986 renderWidgetHostView_->render_widget_host_)->CopyToFindPboard(); | 3992 renderWidgetHostView_->render_widget_host_)->CopyToFindPboard(); |
3987 } | 3993 } |
3988 } | 3994 } |
3989 | 3995 |
3990 - (void)paste:(id)sender { | 3996 - (void)paste:(id)sender { |
3991 if (renderWidgetHostView_->render_widget_host_->IsRenderView()) { | 3997 if (renderWidgetHostView_->render_widget_host_->IsRenderView()) { |
3992 static_cast<RenderViewHostImpl*>( | 3998 RenderFrameHost* frame = static_cast<RenderViewHostImpl*>( |
3993 renderWidgetHostView_->render_widget_host_)->Paste(); | 3999 renderWidgetHostView_->render_widget_host_)->GetFocusedFrame(); |
4000 if (frame) | |
4001 frame->Paste(); | |
3994 } | 4002 } |
3995 } | 4003 } |
3996 | 4004 |
3997 - (void)pasteAndMatchStyle:(id)sender { | 4005 - (void)pasteAndMatchStyle:(id)sender { |
3998 if (renderWidgetHostView_->render_widget_host_->IsRenderView()) { | 4006 if (renderWidgetHostView_->render_widget_host_->IsRenderView()) { |
3999 static_cast<RenderViewHostImpl*>( | 4007 static_cast<RenderViewHostImpl*>( |
4000 renderWidgetHostView_->render_widget_host_)->PasteAndMatchStyle(); | 4008 renderWidgetHostView_->render_widget_host_)->PasteAndMatchStyle(); |
4001 } | 4009 } |
4002 } | 4010 } |
4003 | 4011 |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4246 CGColorGetConstantColor(kCGColorWhite)); | 4254 CGColorGetConstantColor(kCGColorWhite)); |
4247 CGContextFillRect(context, clipRect); | 4255 CGContextFillRect(context, clipRect); |
4248 } | 4256 } |
4249 } | 4257 } |
4250 | 4258 |
4251 - (void)disableRendering { | 4259 - (void)disableRendering { |
4252 renderWidgetHostView_ = NULL; | 4260 renderWidgetHostView_ = NULL; |
4253 } | 4261 } |
4254 | 4262 |
4255 @end // implementation SoftwareLayer | 4263 @end // implementation SoftwareLayer |
OLD | NEW |