OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/ui/cocoa/location_bar/autocomplete_text_field_editor.h" | 5 #import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_editor.h" |
6 | 6 |
7 #include "base/string_util.h" | 7 #include "base/string_util.h" |
8 #include "base/sys_string_conversions.h" | 8 #include "base/sys_string_conversions.h" |
9 #include "chrome/app/chrome_command_ids.h" // IDC_* | 9 #include "chrome/app/chrome_command_ids.h" // IDC_* |
10 #include "chrome/browser/ui/browser_list.h" | 10 #include "chrome/browser/ui/browser_list.h" |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 } | 240 } |
241 | 241 |
242 [menu addItemWithTitle:l10n_util::GetNSStringWithFixup(IDS_PASTE) | 242 [menu addItemWithTitle:l10n_util::GetNSStringWithFixup(IDS_PASTE) |
243 action:@selector(paste:) | 243 action:@selector(paste:) |
244 keyEquivalent:@""]; | 244 keyEquivalent:@""]; |
245 | 245 |
246 // TODO(shess): If the control is not editable, should we show a | 246 // TODO(shess): If the control is not editable, should we show a |
247 // greyed-out "Paste and Go"? | 247 // greyed-out "Paste and Go"? |
248 if ([self isEditable]) { | 248 if ([self isEditable]) { |
249 // Paste and go/search. | 249 // Paste and go/search. |
250 AutocompleteTextFieldObserver* observer = [self observer]; | 250 if (!ThePasteboardIsTooDamnBig()) { |
251 DCHECK(observer); | 251 AutocompleteTextFieldObserver* observer = [self observer]; |
252 const int string_id = observer->GetPasteActionStringId(); | 252 DCHECK(observer); |
253 NSString* label = l10n_util::GetNSStringWithFixup(string_id); | 253 const int string_id = observer->GetPasteActionStringId(); |
254 DCHECK([label length]); | 254 NSString* label = l10n_util::GetNSStringWithFixup(string_id); |
255 [menu addItemWithTitle:label | 255 DCHECK([label length]); |
256 action:@selector(pasteAndGo:) | 256 [menu addItemWithTitle:label |
257 keyEquivalent:@""]; | 257 action:@selector(pasteAndGo:) |
| 258 keyEquivalent:@""]; |
| 259 } |
258 | 260 |
259 NSString* search_engine_label = | 261 NSString* search_engine_label = |
260 l10n_util::GetNSStringWithFixup(IDS_EDIT_SEARCH_ENGINES); | 262 l10n_util::GetNSStringWithFixup(IDS_EDIT_SEARCH_ENGINES); |
261 DCHECK([search_engine_label length]); | 263 DCHECK([search_engine_label length]); |
262 [menu addItem:[NSMenuItem separatorItem]]; | 264 [menu addItem:[NSMenuItem separatorItem]]; |
263 NSMenuItem* item = [menu addItemWithTitle:search_engine_label | 265 NSMenuItem* item = [menu addItemWithTitle:search_engine_label |
264 action:@selector(commandDispatch:) | 266 action:@selector(commandDispatch:) |
265 keyEquivalent:@""]; | 267 keyEquivalent:@""]; |
266 [item setTag:IDC_EDIT_SEARCH_ENGINES]; | 268 [item setTag:IDC_EDIT_SEARCH_ENGINES]; |
267 } | 269 } |
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
591 clipRect.size.width = | 593 clipRect.size.width = |
592 NSMaxX([suggestTextView_ bounds]) - NSMaxX(nonSuggestRect); | 594 NSMaxX([suggestTextView_ bounds]) - NSMaxX(nonSuggestRect); |
593 | 595 |
594 [[NSGraphicsContext currentContext] saveGraphicsState]; | 596 [[NSGraphicsContext currentContext] saveGraphicsState]; |
595 NSRectClip(clipRect); | 597 NSRectClip(clipRect); |
596 [suggestTextView_ drawRect:rect]; | 598 [suggestTextView_ drawRect:rect]; |
597 [[NSGraphicsContext currentContext] restoreGraphicsState]; | 599 [[NSGraphicsContext currentContext] restoreGraphicsState]; |
598 } | 600 } |
599 | 601 |
600 @end | 602 @end |
OLD | NEW |