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

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: sync'd 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 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 [self textfieldEditedOrActivated:sender edited:YES]; 276 [self textfieldEditedOrActivated:sender edited:YES];
277 } 277 }
278 278
279 - (void)didEndEditing:(id)sender { 279 - (void)didEndEditing:(id)sender {
280 [self validateFor:autofill::VALIDATE_EDIT]; 280 [self validateFor:autofill::VALIDATE_EDIT];
281 } 281 }
282 282
283 - (void)updateSuggestionState { 283 - (void)updateSuggestionState {
284 const autofill::SuggestionState& suggestionState = 284 const autofill::SuggestionState& suggestionState =
285 delegate_->SuggestionStateForSection(section_); 285 delegate_->SuggestionStateForSection(section_);
286 bool showSuggestions = !suggestionState.text.empty(); 286 // TODO(estade): use |vertically_compact_text| when it fits.
287 const base::string16& text = suggestionState.horizontally_compact_text;
288 bool showSuggestions = suggestionState.visible;
287 289
288 [[suggestContainer_ view] setHidden:!showSuggestions]; 290 [[suggestContainer_ view] setHidden:!showSuggestions];
289 [inputs_ setHidden:showSuggestions]; 291 [inputs_ setHidden:showSuggestions];
290 292
291 string16 line1; 293 base::string16 line1;
292 string16 line2; 294 base::string16 line2;
293 BreakSuggestionText(suggestionState.text, &line1, &line2); 295 BreakSuggestionText(text, &line1, &line2);
294 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
295 gfx::Font font = rb.GetFont(ui::ResourceBundle::BaseFont).DeriveFont(
296 0, suggestionState.text_style);
297 [suggestContainer_ setSuggestionText:base::SysUTF16ToNSString(line1) 296 [suggestContainer_ setSuggestionText:base::SysUTF16ToNSString(line1)
298 line2:base::SysUTF16ToNSString(line2) 297 line2:base::SysUTF16ToNSString(line2)];
299 withFont:font.GetNativeFont()];
300 [suggestContainer_ setIcon:suggestionState.icon.AsNSImage()]; 298 [suggestContainer_ setIcon:suggestionState.icon.AsNSImage()];
301 if (!suggestionState.extra_text.empty()) { 299 if (!suggestionState.extra_text.empty()) {
302 NSString* extraText = 300 NSString* extraText =
303 base::SysUTF16ToNSString(suggestionState.extra_text); 301 base::SysUTF16ToNSString(suggestionState.extra_text);
304 NSImage* extraIcon = suggestionState.extra_icon.AsNSImage(); 302 NSImage* extraIcon = suggestionState.extra_icon.AsNSImage();
305 [suggestContainer_ showInputField:extraText withIcon:extraIcon]; 303 [suggestContainer_ showInputField:extraText withIcon:extraIcon];
306 } 304 }
307 [view_ setShouldHighlightOnHover:showSuggestions]; 305 [view_ setShouldHighlightOnHover:showSuggestions];
308 [view_ setHidden:!delegate_->SectionIsActive(section_)]; 306 [view_ setHidden:!delegate_->SectionIsActive(section_)];
309 } 307 }
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
623 621
624 - (void)activateFieldForInput:(const autofill::DetailInput&)input { 622 - (void)activateFieldForInput:(const autofill::DetailInput&)input {
625 if ([self detailInputForType:input.type] != &input) 623 if ([self detailInputForType:input.type] != &input)
626 return; 624 return;
627 625
628 NSControl<AutofillInputField>* field = [inputs_ viewWithTag:input.type]; 626 NSControl<AutofillInputField>* field = [inputs_ viewWithTag:input.type];
629 [[field window] makeFirstResponder:field]; 627 [[field window] makeFirstResponder:field];
630 } 628 }
631 629
632 @end 630 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698