summaryrefslogtreecommitdiffstats
path: root/chrome/browser/autocomplete
diff options
context:
space:
mode:
authorshess@chromium.org <shess@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-15 23:05:07 +0000
committershess@chromium.org <shess@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-15 23:05:07 +0000
commite9ccfe39326c10720e3b284c16e8c0bf96c965b5 (patch)
tree7438f7e470a0400417554b83681217bb04b17467 /chrome/browser/autocomplete
parent9c1981c591996af8fdbce5dcb0d2d473e7383e5e (diff)
downloadchromium_src-e9ccfe39326c10720e3b284c16e8c0bf96c965b5.zip
chromium_src-e9ccfe39326c10720e3b284c16e8c0bf96c965b5.tar.gz
chromium_src-e9ccfe39326c10720e3b284c16e8c0bf96c965b5.tar.bz2
[Mac] Trim Omnibox hints as field shrinks.
When user text doesn't fit with the full hint: "Type to search" hint goes away "Tab to search" condenses to "Tab" "Search Engine:" is truncated http://crbug.com/20285 TEST=Type a sentence. Resize window to see if type-hint goes away. TEST=Type "google". Resize window to see if tab-hint goes away. TEST=Type "google" then TAB, then sentence. Resize window to see if "Search Google:" is truncated. TEST=In all cases, text should not scroll before truncation (though it might move as part of truncation). Review URL: http://codereview.chromium.org/262034 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@29202 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/autocomplete')
-rw-r--r--chrome/browser/autocomplete/autocomplete_edit_view_mac.h1
-rw-r--r--chrome/browser/autocomplete/autocomplete_edit_view_mac.mm11
-rw-r--r--chrome/browser/autocomplete/autocomplete_popup_view_mac.mm25
3 files changed, 12 insertions, 25 deletions
diff --git a/chrome/browser/autocomplete/autocomplete_edit_view_mac.h b/chrome/browser/autocomplete/autocomplete_edit_view_mac.h
index c1ff0c0..51bb40e 100644
--- a/chrome/browser/autocomplete/autocomplete_edit_view_mac.h
+++ b/chrome/browser/autocomplete/autocomplete_edit_view_mac.h
@@ -97,6 +97,7 @@ class AutocompleteEditViewMac : public AutocompleteEditView,
virtual int GetPasteActionStringId();
virtual void OnPasteAndGo();
virtual void OnSecurityIconClicked();
+ virtual void OnFrameChanged();
// Helper functions for use from AutocompleteEditHelper Objective-C
// class.
diff --git a/chrome/browser/autocomplete/autocomplete_edit_view_mac.mm b/chrome/browser/autocomplete/autocomplete_edit_view_mac.mm
index c736c8f..79e9369 100644
--- a/chrome/browser/autocomplete/autocomplete_edit_view_mac.mm
+++ b/chrome/browser/autocomplete/autocomplete_edit_view_mac.mm
@@ -658,6 +658,17 @@ void AutocompleteEditViewMac::OnPasteAndGo() {
model_->PasteAndGo();
}
+void AutocompleteEditViewMac::OnFrameChanged() {
+ // TODO(shess): UpdatePopupAppearance() is called frequently, so it
+ // should be really cheap, but in this case we could probably make
+ // things even cheaper by refactoring between the popup-placement
+ // code and the matrix-population code.
+ popup_view_->UpdatePopupAppearance();
+
+ // Give controller a chance to rearrange decorations.
+ controller_->OnChanged();
+}
+
bool AutocompleteEditViewMac::OnTabPressed() {
if (model_->is_keyword_hint() && !model_->keyword().empty()) {
model_->AcceptKeyword();
diff --git a/chrome/browser/autocomplete/autocomplete_popup_view_mac.mm b/chrome/browser/autocomplete/autocomplete_popup_view_mac.mm
index 0a553a5..97670b8 100644
--- a/chrome/browser/autocomplete/autocomplete_popup_view_mac.mm
+++ b/chrome/browser/autocomplete/autocomplete_popup_view_mac.mm
@@ -302,9 +302,6 @@ NSAttributedString* AutocompletePopupViewMac::MatchText(
// Call |popup_view_| OnMiddleClick().
- (void)middleSelect:(id)sender;
-// Resize the popup when the field's window resizes.
-- (void)windowDidResize:(NSNotification*)notification;
-
@end
AutocompletePopupViewMac::AutocompletePopupViewMac(
@@ -363,13 +360,6 @@ void AutocompletePopupViewMac::CreatePopupIfNeeded() {
[matrix setAction:@selector(select:)];
[matrix setMiddleClickAction:@selector(middleSelect:)];
[popup_ setContentView:matrix];
-
- // We need the popup to follow window resize.
- NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
- [nc addObserver:matrix_target_
- selector:@selector(windowDidResize:)
- name:NSWindowDidResizeNotification
- object:[field_ window]];
}
}
@@ -383,11 +373,6 @@ void AutocompletePopupViewMac::UpdatePopupAppearance() {
NSMatrix* matrix = [popup_ contentView];
[matrix setTarget:nil];
- NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
- [nc removeObserver:matrix_target_
- name:NSWindowDidResizeNotification
- object:[field_ window]];
-
popup_.reset(nil);
return;
@@ -736,14 +721,4 @@ void AutocompletePopupViewMac::OnMiddleClick() {
popup_view_->OnMiddleClick();
}
-- (void)windowDidResize:(NSNotification*)notification {
- DCHECK(popup_view_);
-
- // TODO(shess): UpdatePopupAppearance() is called frequently, so it
- // should be really cheap, but in this case we could probably make
- // things even cheaper by refactoring between the popup-placement
- // code and the matrix-population code.
- popup_view_->UpdatePopupAppearance();
-}
-
@end