| OLD | NEW |
| 1 // Copyright (c), 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c), 2009 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 "chrome/browser/cocoa/rwhvm_editcommand_helper.h" | 5 #import "chrome/browser/cocoa/rwhvm_editcommand_helper.h" |
| 6 | 6 |
| 7 #import <objc/runtime.h> | 7 #import <objc/runtime.h> |
| 8 | 8 |
| 9 #include "chrome/browser/renderer_host/render_widget_host.h" | 9 #include "chrome/browser/renderer_host/render_widget_host.h" |
| 10 #import "chrome/browser/renderer_host/render_widget_host_view_mac.h" | 10 #import "chrome/browser/renderer_host/render_widget_host_view_mac.h" |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 // | 150 // |
| 151 // Adapted from a function by the same name in | 151 // Adapted from a function by the same name in |
| 152 // WebKit/mac/WebView/WebHTMLView.mm . | 152 // WebKit/mac/WebView/WebHTMLView.mm . |
| 153 // Capitalized names are returned from this function, but that's simply | 153 // Capitalized names are returned from this function, but that's simply |
| 154 // matching WebHTMLView.mm. | 154 // matching WebHTMLView.mm. |
| 155 NSString* RWHVMEditCommandHelper::CommandNameForSelector(SEL selector) { | 155 NSString* RWHVMEditCommandHelper::CommandNameForSelector(SEL selector) { |
| 156 if (selector == @selector(insertParagraphSeparator:) || | 156 if (selector == @selector(insertParagraphSeparator:) || |
| 157 selector == @selector(insertNewlineIgnoringFieldEditor:)) | 157 selector == @selector(insertNewlineIgnoringFieldEditor:)) |
| 158 return @"InsertNewline"; | 158 return @"InsertNewline"; |
| 159 if (selector == @selector(insertTabIgnoringFieldEditor:)) | 159 if (selector == @selector(insertTabIgnoringFieldEditor:)) |
| 160 return @"InsertTab"; | 160 return @"InsertTab"; |
| 161 if (selector == @selector(pageDown:)) | 161 if (selector == @selector(pageDown:)) |
| 162 return @"MovePageDown"; | 162 return @"MovePageDown"; |
| 163 if (selector == @selector(pageDownAndModifySelection:)) | 163 if (selector == @selector(pageDownAndModifySelection:)) |
| 164 return @"MovePageDownAndModifySelection"; | 164 return @"MovePageDownAndModifySelection"; |
| 165 if (selector == @selector(pageUp:)) | 165 if (selector == @selector(pageUp:)) |
| 166 return @"MovePageUp"; | 166 return @"MovePageUp"; |
| 167 if (selector == @selector(pageUpAndModifySelection:)) | 167 if (selector == @selector(pageUpAndModifySelection:)) |
| 168 return @"MovePageUpAndModifySelection"; | 168 return @"MovePageUpAndModifySelection"; |
| 169 | 169 |
| 170 // Remove the trailing colon. | 170 // Remove the trailing colon. |
| 171 NSString* selector_str = NSStringFromSelector(selector); | 171 NSString* selector_str = NSStringFromSelector(selector); |
| 172 int selector_len = [selector_str length]; | 172 int selector_len = [selector_str length]; |
| 173 return [selector_str substringToIndex:selector_len - 1]; | 173 return [selector_str substringToIndex:selector_len - 1]; |
| 174 } | 174 } |
| 175 | 175 |
| 176 RWHVMEditCommandHelper::RWHVMEditCommandHelper() { | 176 RWHVMEditCommandHelper::RWHVMEditCommandHelper() { |
| 177 for (size_t i = 0; i < arraysize(kEditCommands); ++i) { | 177 for (size_t i = 0; i < arraysize(kEditCommands); ++i) { |
| 178 edit_command_set_.insert(kEditCommands[i]); | 178 edit_command_set_.insert(kEditCommands[i]); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 NSArray* RWHVMEditCommandHelper::GetEditSelectorNames() { | 218 NSArray* RWHVMEditCommandHelper::GetEditSelectorNames() { |
| 219 size_t num_edit_commands = arraysize(kEditCommands); | 219 size_t num_edit_commands = arraysize(kEditCommands); |
| 220 NSMutableArray* ret = [NSMutableArray arrayWithCapacity:num_edit_commands]; | 220 NSMutableArray* ret = [NSMutableArray arrayWithCapacity:num_edit_commands]; |
| 221 | 221 |
| 222 for (size_t i = 0; i < num_edit_commands; ++i) { | 222 for (size_t i = 0; i < num_edit_commands; ++i) { |
| 223 [ret addObject:[NSString stringWithUTF8String:kEditCommands[i]]]; | 223 [ret addObject:[NSString stringWithUTF8String:kEditCommands[i]]]; |
| 224 } | 224 } |
| 225 | 225 |
| 226 return ret; | 226 return ret; |
| 227 } | 227 } |
| OLD | NEW |