Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(203)

Side by Side Diff: chrome/browser/cocoa/autocomplete_text_field_editor.mm

Issue 220040: [Mac] Enable "Edit Search Engines" in Omnibox context menu. (Closed)
Patch Set: nop to make sure I'm logging in. Created 11 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/cocoa/autocomplete_text_field_editor_unittest.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/autocomplete_text_field_editor.h" 5 #import "chrome/browser/cocoa/autocomplete_text_field_editor.h"
6 6
7 #include "app/l10n_util_mac.h" 7 #include "app/l10n_util_mac.h"
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 #include "grit/generated_resources.h" 9 #include "grit/generated_resources.h"
10 #include "base/sys_string_conversions.h" 10 #include "base/sys_string_conversions.h"
11 #include "chrome/app/chrome_dll_resource.h" // IDC_*
11 #import "chrome/browser/cocoa/autocomplete_text_field.h" 12 #import "chrome/browser/cocoa/autocomplete_text_field.h"
12 13
13 @implementation AutocompleteTextFieldEditor 14 @implementation AutocompleteTextFieldEditor
14 15
15 - (void)copy:(id)sender { 16 - (void)copy:(id)sender {
16 NSPasteboard* pb = [NSPasteboard generalPasteboard]; 17 NSPasteboard* pb = [NSPasteboard generalPasteboard];
17 [self performCopy:pb]; 18 [self performCopy:pb];
18 } 19 }
19 20
20 - (void)cut:(id)sender { 21 - (void)cut:(id)sender {
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 if ([self isEditable]) { 94 if ([self isEditable]) {
94 // Paste and go/search. 95 // Paste and go/search.
95 AutocompleteTextFieldObserver* observer = [self observer]; 96 AutocompleteTextFieldObserver* observer = [self observer];
96 DCHECK(observer); 97 DCHECK(observer);
97 if (observer && observer->CanPasteAndGo()) { 98 if (observer && observer->CanPasteAndGo()) {
98 const int string_id = observer->GetPasteActionStringId(); 99 const int string_id = observer->GetPasteActionStringId();
99 NSString* label = l10n_util::GetNSStringWithFixup(string_id); 100 NSString* label = l10n_util::GetNSStringWithFixup(string_id);
100 101
101 // TODO(rohitrao): If the clipboard is empty, should we show a 102 // TODO(rohitrao): If the clipboard is empty, should we show a
102 // greyed-out "Paste and Go" or nothing at all? 103 // greyed-out "Paste and Go" or nothing at all?
103 if (label) { 104 if ([label length]) {
104 [menu addItemWithTitle:label 105 [menu addItemWithTitle:label
105 action:@selector(pasteAndGo:) 106 action:@selector(pasteAndGo:)
106 keyEquivalent:@""]; 107 keyEquivalent:@""];
107 } 108 }
109
110 label = l10n_util::GetNSStringWithFixup(IDS_EDIT_SEARCH_ENGINES);
111 DCHECK([label length]);
112 if ([label length]) {
113 [menu addItem:[NSMenuItem separatorItem]];
114 NSMenuItem* item = [menu addItemWithTitle:label
115 action:@selector(commandDispatch:)
116 keyEquivalent:@""];
117 [item setTag:IDC_EDIT_SEARCH_ENGINES];
118 }
108 } 119 }
109 } 120 }
110 121
111 return menu; 122 return menu;
112 } 123 }
113 124
114 @end 125 @end
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/cocoa/autocomplete_text_field_editor_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698