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

Side by Side Diff: chrome/browser/ui/cocoa/autofill/autofill_section_container.mm

Issue 21724002: rAc: try really hard not to ellipsize addresses (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix android Created 7 years, 4 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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/autofill/autofill_section_container.h" 5 #import "chrome/browser/ui/cocoa/autofill/autofill_section_container.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/mac/foundation_util.h" 9 #include "base/mac/foundation_util.h"
10 #include "base/strings/sys_string_conversions.h" 10 #include "base/strings/sys_string_conversions.h"
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 [self textfieldEditedOrActivated:sender edited:YES]; 277 [self textfieldEditedOrActivated:sender edited:YES];
278 } 278 }
279 279
280 - (void)didEndEditing:(id)sender { 280 - (void)didEndEditing:(id)sender {
281 [self validateFor:autofill::VALIDATE_EDIT]; 281 [self validateFor:autofill::VALIDATE_EDIT];
282 } 282 }
283 283
284 - (void)updateSuggestionState { 284 - (void)updateSuggestionState {
285 const autofill::SuggestionState& suggestionState = 285 const autofill::SuggestionState& suggestionState =
286 controller_->SuggestionStateForSection(section_); 286 controller_->SuggestionStateForSection(section_);
287 bool showSuggestions = !suggestionState.text.empty(); 287 // TODO(estade): use |horizontally_compact_text| when
288 // |vertically_compact_text| doesn't fit.
289 const base::string16& text = suggestionState.vertically_compact_text;
290 bool showSuggestions = suggestionState.show;
288 291
289 [[suggestContainer_ view] setHidden:!showSuggestions]; 292 [[suggestContainer_ view] setHidden:!showSuggestions];
290 [inputs_ setHidden:showSuggestions]; 293 [inputs_ setHidden:showSuggestions];
291 294
292 string16 line1; 295 base::string16 line1;
293 string16 line2; 296 base::string16 line2;
294 BreakSuggestionText(suggestionState.text, &line1, &line2); 297 BreakSuggestionText(text, &line1, &line2);
295 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); 298 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
296 gfx::Font font = rb.GetFont(ui::ResourceBundle::BaseFont).DeriveFont(
297 0, suggestionState.text_style);
298 [suggestContainer_ setSuggestionText:base::SysUTF16ToNSString(line1) 299 [suggestContainer_ setSuggestionText:base::SysUTF16ToNSString(line1)
299 line2:base::SysUTF16ToNSString(line2) 300 line2:base::SysUTF16ToNSString(line2)];
300 withFont:font.GetNativeFont()];
301 [suggestContainer_ setIcon:suggestionState.icon.AsNSImage()]; 301 [suggestContainer_ setIcon:suggestionState.icon.AsNSImage()];
302 if (!suggestionState.extra_text.empty()) { 302 if (!suggestionState.extra_text.empty()) {
303 NSString* extraText = 303 NSString* extraText =
304 base::SysUTF16ToNSString(suggestionState.extra_text); 304 base::SysUTF16ToNSString(suggestionState.extra_text);
305 NSImage* extraIcon = suggestionState.extra_icon.AsNSImage(); 305 NSImage* extraIcon = suggestionState.extra_icon.AsNSImage();
306 [suggestContainer_ showInputField:extraText withIcon:extraIcon]; 306 [suggestContainer_ showInputField:extraText withIcon:extraIcon];
307 } 307 }
308 [view_ setShouldHighlightOnHover:showSuggestions]; 308 [view_ setShouldHighlightOnHover:showSuggestions];
309 [view_ setHidden:!controller_->SectionIsActive(section_)]; 309 [view_ setHidden:!controller_->SectionIsActive(section_)];
310 } 310 }
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
624 624
625 - (void)activateFieldForInput:(const autofill::DetailInput&)input { 625 - (void)activateFieldForInput:(const autofill::DetailInput&)input {
626 if ([self detailInputForType:input.type] != &input) 626 if ([self detailInputForType:input.type] != &input)
627 return; 627 return;
628 628
629 NSControl<AutofillInputField>* field = [inputs_ viewWithTag:input.type]; 629 NSControl<AutofillInputField>* field = [inputs_ viewWithTag:input.type];
630 [[field window] makeFirstResponder:field]; 630 [[field window] makeFirstResponder:field];
631 } 631 }
632 632
633 @end 633 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698