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

Side by Side Diff: chrome/browser/autocomplete/autocomplete_edit_view_mac.mm

Issue 5556007: [Mac] Re-color omnibox text and move the cursor to the end when committing su... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/clipboard/scoped_clipboard_writer.h" 10 #include "app/clipboard/scoped_clipboard_writer.h"
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after
471 else 471 else
472 SetSelectedRange(NSMakeRange([text length] - suggest_text_length_, 0)); 472 SetSelectedRange(NSMakeRange([text length] - suggest_text_length_, 0));
473 } 473 }
474 } 474 }
475 475
476 bool AutocompleteEditViewMac::CommitSuggestText() { 476 bool AutocompleteEditViewMac::CommitSuggestText() {
477 if (suggest_text_length_ == 0) 477 if (suggest_text_length_ == 0)
478 return false; 478 return false;
479 479
480 suggest_text_length_ = 0; 480 suggest_text_length_ = 0;
481 // Call SetText() to force a redraw and move the cursor to the end.
482 SetText(GetText());
481 model()->FinalizeInstantQuery(GetText()); 483 model()->FinalizeInstantQuery(GetText());
482 return true; 484 return true;
483 } 485 }
484 486
485 void AutocompleteEditViewMac::SetText(const std::wstring& display_text) { 487 void AutocompleteEditViewMac::SetText(const std::wstring& display_text) {
486 // If we are setting the text directly, there cannot be any suggest text. 488 // If we are setting the text directly, there cannot be any suggest text.
487 suggest_text_length_ = 0; 489 suggest_text_length_ = 0;
488 SetTextInternal(display_text); 490 SetTextInternal(display_text);
489 } 491 }
490 492
(...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after
1068 } 1070 }
1069 1071
1070 return std::wstring(); 1072 return std::wstring();
1071 } 1073 }
1072 1074
1073 // static 1075 // static
1074 NSFont* AutocompleteEditViewMac::GetFieldFont() { 1076 NSFont* AutocompleteEditViewMac::GetFieldFont() {
1075 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); 1077 ResourceBundle& rb = ResourceBundle::GetSharedInstance();
1076 return rb.GetFont(ResourceBundle::BaseFont).GetNativeFont(); 1078 return rb.GetFont(ResourceBundle::BaseFont).GetNativeFont();
1077 } 1079 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698