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 #include "chrome/browser/autocomplete/autocomplete_edit_view_mac.h" | 5 #include "chrome/browser/autocomplete/autocomplete_edit_view_mac.h" |
6 | 6 |
7 #include <Carbon/Carbon.h> // kVK_Return | 7 #include <Carbon/Carbon.h> // kVK_Return |
8 | 8 |
9 #include "app/clipboard/clipboard.h" | 9 #include "app/clipboard/clipboard.h" |
10 #include "app/gfx/font.h" | 10 #include "app/gfx/font.h" |
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
423 color = InsecureSchemeColor(); | 423 color = InsecureSchemeColor(); |
424 // Add a strikethrough through the scheme. | 424 // Add a strikethrough through the scheme. |
425 [as addAttribute:NSStrikethroughStyleAttributeName | 425 [as addAttribute:NSStrikethroughStyleAttributeName |
426 value:[NSNumber numberWithInt:NSUnderlineStyleSingle] | 426 value:[NSNumber numberWithInt:NSUnderlineStyleSingle] |
427 range:ComponentToNSRange(parts.scheme)]; | 427 range:ComponentToNSRange(parts.scheme)]; |
428 } | 428 } |
429 [as addAttribute:NSForegroundColorAttributeName value:color | 429 [as addAttribute:NSForegroundColorAttributeName value:color |
430 range:ComponentToNSRange(parts.scheme)]; | 430 range:ComponentToNSRange(parts.scheme)]; |
431 } | 431 } |
432 | 432 |
433 [field_ setObjectValue:as]; | 433 [field_ setAttributedStringValue:as]; |
434 | 434 |
435 // TODO(shess): This may be an appropriate place to call: | 435 // TODO(shess): This may be an appropriate place to call: |
436 // controller_->OnChanged(); | 436 // controller_->OnChanged(); |
437 // In the current implementation, this tells LocationBarViewMac to | 437 // In the current implementation, this tells LocationBarViewMac to |
438 // mess around with |model_| and update |field_|. Unfortunately, | 438 // mess around with |model_| and update |field_|. Unfortunately, |
439 // when I look at our peer implementations, it's not entirely clear | 439 // when I look at our peer implementations, it's not entirely clear |
440 // to me if this is safe. SetText() is sort of an utility method, | 440 // to me if this is safe. SetText() is sort of an utility method, |
441 // and different callers sometimes have different needs. Research | 441 // and different callers sometimes have different needs. Research |
442 // this issue so that it can be added safely. | 442 // this issue so that it can be added safely. |
443 | 443 |
(...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
894 // TODO(shess): Figure out where the selection belongs. On GTK, | 894 // TODO(shess): Figure out where the selection belongs. On GTK, |
895 // it's set to the start of the text. | 895 // it's set to the start of the text. |
896 } | 896 } |
897 | 897 |
898 // Signal that we've lost focus when the window resigns key. | 898 // Signal that we've lost focus when the window resigns key. |
899 - (void)windowDidResignKey:(NSNotification*)notification { | 899 - (void)windowDidResignKey:(NSNotification*)notification { |
900 edit_view_->OnDidResignKey(); | 900 edit_view_->OnDidResignKey(); |
901 } | 901 } |
902 | 902 |
903 @end | 903 @end |
OLD | NEW |