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 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "content/browser/renderer_host/render_widget_host_impl.h" | 11 #include "content/browser/renderer_host/render_widget_host_impl.h" |
12 #import "content/browser/renderer_host/render_widget_host_view_mac.h" | 12 #import "content/browser/renderer_host/render_widget_host_view_mac.h" |
13 | 13 |
14 namespace content { | 14 namespace content { |
15 namespace { | 15 namespace { |
16 | 16 |
17 // The names of all the objc selectors w/o ':'s added to an object by | 17 // The names of all the objc selectors w/o ':'s added to an object by |
18 // AddEditingSelectorsToClass(). | 18 // AddEditingSelectorsToClass(). |
19 // | 19 // |
20 // This needs to be kept in Sync with WEB_COMMAND list in the WebKit tree at: | 20 // This needs to be kept in Sync with WEB_COMMAND list in the WebKit tree at: |
21 // WebKit/mac/WebView/WebHTMLView.mm . | 21 // WebKit/mac/WebView/WebHTMLView.mm . |
22 const char* kEditCommands[] = { | 22 const char* const kEditCommands[] = { |
23 "alignCenter", | 23 "alignCenter", |
24 "alignJustified", | 24 "alignJustified", |
25 "alignLeft", | 25 "alignLeft", |
26 "alignRight", | 26 "alignRight", |
27 "copy", | 27 "copy", |
28 "cut", | 28 "cut", |
29 "delete", | 29 "delete", |
30 "deleteBackward", | 30 "deleteBackward", |
31 "deleteBackwardByDecomposingPreviousCharacter", | 31 "deleteBackwardByDecomposingPreviousCharacter", |
32 "deleteForward", | 32 "deleteForward", |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 "selectWord", | 100 "selectWord", |
101 "setMark", | 101 "setMark", |
102 "showGuessPanel", | 102 "showGuessPanel", |
103 "subscript", | 103 "subscript", |
104 "superscript", | 104 "superscript", |
105 "swapWithMark", | 105 "swapWithMark", |
106 "transpose", | 106 "transpose", |
107 "underline", | 107 "underline", |
108 "unscript", | 108 "unscript", |
109 "yank", | 109 "yank", |
110 "yankAndSelect"}; | 110 "yankAndSelect" |
| 111 }; |
111 | 112 |
112 | 113 |
113 // This function is installed via the objc runtime as the implementation of all | 114 // This function is installed via the objc runtime as the implementation of all |
114 // the various editing selectors. | 115 // the various editing selectors. |
115 // The objc runtime hookup occurs in | 116 // The objc runtime hookup occurs in |
116 // RenderWidgetHostViewMacEditCommandHelper::AddEditingSelectorsToClass(). | 117 // RenderWidgetHostViewMacEditCommandHelper::AddEditingSelectorsToClass(). |
117 // | 118 // |
118 // self - the object we're attached to; it must implement the | 119 // self - the object we're attached to; it must implement the |
119 // RenderWidgetHostViewMacOwner protocol. | 120 // RenderWidgetHostViewMacOwner protocol. |
120 // _cmd - the selector that fired. | 121 // _cmd - the selector that fired. |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 NSMutableArray* ret = [NSMutableArray arrayWithCapacity:num_edit_commands]; | 234 NSMutableArray* ret = [NSMutableArray arrayWithCapacity:num_edit_commands]; |
234 | 235 |
235 for (size_t i = 0; i < num_edit_commands; ++i) { | 236 for (size_t i = 0; i < num_edit_commands; ++i) { |
236 [ret addObject:[NSString stringWithUTF8String:kEditCommands[i]]]; | 237 [ret addObject:[NSString stringWithUTF8String:kEditCommands[i]]]; |
237 } | 238 } |
238 | 239 |
239 return ret; | 240 return ret; |
240 } | 241 } |
241 | 242 |
242 } // namespace content | 243 } // namespace content |
OLD | NEW |