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

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

Issue 12792013: Instant extended: Remove suggest commit on lost focus (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 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
OLDNEW
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/strings/sys_string_conversions.h" 8 #include "base/strings/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 372 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 } 383 }
384 384
385 // NOTE: If |aString| is empty, this intentionally replaces the 385 // NOTE: If |aString| is empty, this intentionally replaces the
386 // selection with empty. This seems consistent with the case where 386 // selection with empty. This seems consistent with the case where
387 // the input contained a mixture of characters and the string ended 387 // the input contained a mixture of characters and the string ended
388 // up not empty. 388 // up not empty.
389 [super insertText:aString]; 389 [super insertText:aString];
390 } 390 }
391 391
392 - (void)setMarkedText:(id)aString selectedRange:(NSRange)selRange { 392 - (void)setMarkedText:(id)aString selectedRange:(NSRange)selRange {
393 if (![self hasMarkedText]) {
394 // Before input methods set composition text in the omnibox, we need to
395 // examine whether the autocompletion controller accepts the keyword to
396 // avoid committing the current composition text wrongly.
397 AutocompleteTextFieldObserver* observer = [self observer];
398 if (observer)
399 observer->OnStartingIME();
400 }
401
402 [super setMarkedText:aString selectedRange:selRange]; 393 [super setMarkedText:aString selectedRange:selRange];
403 394
404 // Because the OmniboxViewMac class treats marked text as content, 395 // Because the OmniboxViewMac class treats marked text as content,
405 // we need to treat the change to marked text as content change as well. 396 // we need to treat the change to marked text as content change as well.
406 [self didChangeText]; 397 [self didChangeText];
407 } 398 }
408 399
409 - (NSRange)selectionRangeForProposedRange:(NSRange)proposedSelRange 400 - (NSRange)selectionRangeForProposedRange:(NSRange)proposedSelRange
410 granularity:(NSSelectionGranularity)granularity { 401 granularity:(NSSelectionGranularity)granularity {
411 AutocompleteTextFieldObserver* observer = [self observer]; 402 AutocompleteTextFieldObserver* observer = [self observer];
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
550 [super drawRect:rect]; 541 [super drawRect:rect];
551 autocomplete_text_field::DrawInstantSuggestion( 542 autocomplete_text_field::DrawInstantSuggestion(
552 [self textStorage], 543 [self textStorage],
553 [[self delegate] suggestText], 544 [[self delegate] suggestText],
554 [[self delegate] suggestColor], 545 [[self delegate] suggestColor],
555 self, 546 self,
556 [self bounds]); 547 [self bounds]);
557 } 548 }
558 549
559 @end 550 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698