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 #import "content/browser/renderer_host/render_widget_host_view_mac_editcommand_h
elper.h" | 5 #import "content/browser/renderer_host/render_widget_host_view_mac_editcommand_h
elper.h" |
6 | 6 |
7 #import <objc/runtime.h> | 7 #import <objc/runtime.h> |
8 | 8 |
9 #include "content/browser/renderer_host/render_widget_host.h" | 9 #include "content/browser/renderer_host/render_widget_host.h" |
10 #import "content/browser/renderer_host/render_widget_host_view_mac.h" | 10 #import "content/browser/renderer_host/render_widget_host_view_mac.h" |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 // SEL -> command name string. | 130 // SEL -> command name string. |
131 NSString* command_name_ns = | 131 NSString* command_name_ns = |
132 RenderWidgetHostViewMacEditCommandHelper::CommandNameForSelector(_cmd); | 132 RenderWidgetHostViewMacEditCommandHelper::CommandNameForSelector(_cmd); |
133 std::string command([command_name_ns UTF8String]); | 133 std::string command([command_name_ns UTF8String]); |
134 | 134 |
135 // Forward the edit command string down the pipeline. | 135 // Forward the edit command string down the pipeline. |
136 RenderWidgetHostViewMac* rwhv = [(id<RenderWidgetHostViewMacOwner>)self | 136 RenderWidgetHostViewMac* rwhv = [(id<RenderWidgetHostViewMacOwner>)self |
137 renderWidgetHostViewMac]; | 137 renderWidgetHostViewMac]; |
138 DCHECK(rwhv); | 138 DCHECK(rwhv); |
139 | 139 |
| 140 RenderWidgetHostImpl* rwh = |
| 141 RenderWidgetHostImpl::From(rwhv->GetRenderWidgetHost()); |
140 // The second parameter is the core command value which isn't used here. | 142 // The second parameter is the core command value which isn't used here. |
141 RenderWidgetHostImpl* rwh = RenderWidgetHostImpl::FromRWHV(rwhv); | |
142 rwh->ExecuteEditCommand(command, ""); | 143 rwh->ExecuteEditCommand(command, ""); |
143 } | 144 } |
144 | 145 |
145 } // namespace | 146 } // namespace |
146 | 147 |
147 // Maps an objc-selector to a core command name. | 148 // Maps an objc-selector to a core command name. |
148 // | 149 // |
149 // Returns the core command name (which is the selector name with the trailing | 150 // Returns the core command name (which is the selector name with the trailing |
150 // ':' stripped in most cases). | 151 // ':' stripped in most cases). |
151 // | 152 // |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 NSArray* RenderWidgetHostViewMacEditCommandHelper::GetEditSelectorNames() { | 227 NSArray* RenderWidgetHostViewMacEditCommandHelper::GetEditSelectorNames() { |
227 size_t num_edit_commands = arraysize(kEditCommands); | 228 size_t num_edit_commands = arraysize(kEditCommands); |
228 NSMutableArray* ret = [NSMutableArray arrayWithCapacity:num_edit_commands]; | 229 NSMutableArray* ret = [NSMutableArray arrayWithCapacity:num_edit_commands]; |
229 | 230 |
230 for (size_t i = 0; i < num_edit_commands; ++i) { | 231 for (size_t i = 0; i < num_edit_commands; ++i) { |
231 [ret addObject:[NSString stringWithUTF8String:kEditCommands[i]]]; | 232 [ret addObject:[NSString stringWithUTF8String:kEditCommands[i]]]; |
232 } | 233 } |
233 | 234 |
234 return ret; | 235 return ret; |
235 } | 236 } |
OLD | NEW |