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

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

Issue 3624001: Implement Instant on Mac (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/cocoa/browser_window_cocoa.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) 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 411 matching lines...) Expand 10 before | Expand all | Expand 10 after
422 422
423 if (NSMaxRange([editor selectedRange]) < [[editor textStorage] length]) 423 if (NSMaxRange([editor selectedRange]) < [[editor textStorage] length])
424 prevent_inline_autocomplete = true; 424 prevent_inline_autocomplete = true;
425 } 425 }
426 426
427 model_->StartAutocomplete([editor selectedRange].length != 0, 427 model_->StartAutocomplete([editor selectedRange].length != 0,
428 prevent_inline_autocomplete); 428 prevent_inline_autocomplete);
429 } 429 }
430 430
431 void AutocompleteEditViewMac::ClosePopup() { 431 void AutocompleteEditViewMac::ClosePopup() {
432 if (popup_view_->GetModel()->IsOpen())
433 controller_->OnAutocompleteWillClosePopup();
434
432 popup_view_->GetModel()->StopAutocomplete(); 435 popup_view_->GetModel()->StopAutocomplete();
433 } 436 }
434 437
435 void AutocompleteEditViewMac::SetFocus() { 438 void AutocompleteEditViewMac::SetFocus() {
436 } 439 }
437 440
438 void AutocompleteEditViewMac::SetText(const std::wstring& display_text) { 441 void AutocompleteEditViewMac::SetText(const std::wstring& display_text) {
439 NSString* ss = base::SysWideToNSString(display_text); 442 NSString* ss = base::SysWideToNSString(display_text);
440 NSMutableAttributedString* as = 443 NSMutableAttributedString* as =
441 [[[NSMutableAttributedString alloc] initWithString:ss] autorelease]; 444 [[[NSMutableAttributedString alloc] initWithString:ss] autorelease];
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
755 return false; 758 return false;
756 } 759 }
757 760
758 void AutocompleteEditViewMac::OnSetFocus(bool control_down) { 761 void AutocompleteEditViewMac::OnSetFocus(bool control_down) {
759 model_->OnSetFocus(control_down); 762 model_->OnSetFocus(control_down);
760 controller_->OnSetFocus(); 763 controller_->OnSetFocus();
761 } 764 }
762 765
763 void AutocompleteEditViewMac::OnKillFocus() { 766 void AutocompleteEditViewMac::OnKillFocus() {
764 // Tell the model to reset itself. 767 // Tell the model to reset itself.
768 controller_->OnAutocompleteLosingFocus(NULL);
765 model_->OnKillFocus(); 769 model_->OnKillFocus();
766 controller_->OnKillFocus(); 770 controller_->OnKillFocus();
767 } 771 }
768 772
769 bool AutocompleteEditViewMac::CanCopy() { 773 bool AutocompleteEditViewMac::CanCopy() {
770 const NSRange selection = GetSelectedRange(); 774 const NSRange selection = GetSelectedRange();
771 return selection.length > 0; 775 return selection.length > 0;
772 } 776 }
773 777
774 void AutocompleteEditViewMac::CopyToPasteboard(NSPasteboard* pb) { 778 void AutocompleteEditViewMac::CopyToPasteboard(NSPasteboard* pb) {
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
933 } 937 }
934 938
935 return std::wstring(); 939 return std::wstring();
936 } 940 }
937 941
938 // static 942 // static
939 NSFont* AutocompleteEditViewMac::GetFieldFont() { 943 NSFont* AutocompleteEditViewMac::GetFieldFont() {
940 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); 944 ResourceBundle& rb = ResourceBundle::GetSharedInstance();
941 return rb.GetFont(ResourceBundle::BaseFont).GetNativeFont(); 945 return rb.GetFont(ResourceBundle::BaseFont).GetNativeFont();
942 } 946 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/cocoa/browser_window_cocoa.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698