diff options
Diffstat (limited to 'chrome/browser/ui/views')
-rw-r--r-- | chrome/browser/ui/views/find_bar_host.cc | 10 | ||||
-rw-r--r-- | chrome/browser/ui/views/find_bar_host.h | 1 | ||||
-rw-r--r-- | chrome/browser/ui/views/find_bar_view.cc | 11 | ||||
-rw-r--r-- | chrome/browser/ui/views/find_bar_view.h | 6 |
4 files changed, 27 insertions, 1 deletions
diff --git a/chrome/browser/ui/views/find_bar_host.cc b/chrome/browser/ui/views/find_bar_host.cc index e86e435..6dbea33 100644 --- a/chrome/browser/ui/views/find_bar_host.cc +++ b/chrome/browser/ui/views/find_bar_host.cc @@ -126,7 +126,11 @@ void FindBarHost::SetFindText(const string16& find_text) { } void FindBarHost::UpdateUIForFindResult(const FindNotificationDetails& result, - const string16& find_text) { + const string16& find_text) { + // Make sure match count is clear. It may get set again in UpdateForResult + // if enough data is available. + find_bar_view()->ClearMatchCount(); + if (!find_text.empty()) find_bar_view()->UpdateForResult(result, find_text); @@ -211,6 +215,10 @@ string16 FindBarHost::GetFindText() { return find_bar_view()->GetFindText(); } +string16 FindBarHost::GetMatchCountText() { + return find_bar_view()->GetMatchCountText(); +} + //////////////////////////////////////////////////////////////////////////////// // Overridden from DropdownBarHost: diff --git a/chrome/browser/ui/views/find_bar_host.h b/chrome/browser/ui/views/find_bar_host.h index cc52c87..130b876 100644 --- a/chrome/browser/ui/views/find_bar_host.h +++ b/chrome/browser/ui/views/find_bar_host.h @@ -72,6 +72,7 @@ class FindBarHost : public DropdownBarHost, virtual bool GetFindBarWindowInfo(gfx::Point* position, bool* fully_visible); virtual string16 GetFindText(); + virtual string16 GetMatchCountText(); // Overridden from DropdownBarHost: // Returns the rectangle representing where to position the find bar. It uses diff --git a/chrome/browser/ui/views/find_bar_view.cc b/chrome/browser/ui/views/find_bar_view.cc index eea85a6..94d46ad 100644 --- a/chrome/browser/ui/views/find_bar_view.cc +++ b/chrome/browser/ui/views/find_bar_view.cc @@ -187,6 +187,10 @@ string16 FindBarView::GetFindText() const { return find_text_->text(); } +string16 FindBarView::GetMatchCountText() const { + return WideToUTF16Hack(match_count_text_->GetText()); +} + void FindBarView::UpdateForResult(const FindNotificationDetails& result, const string16& find_text) { bool have_valid_range = @@ -223,6 +227,13 @@ void FindBarView::UpdateForResult(const FindNotificationDetails& result, SchedulePaint(); } +void FindBarView::ClearMatchCount() { + match_count_text_->SetText(L""); + UpdateMatchCountAppearance(false); + Layout(); + SchedulePaint(); +} + void FindBarView::SetFocusAndSelection(bool select_all) { #if defined(OS_CHROMEOS) // TODO(altimofeev): this workaround is needed only when the FindBar was diff --git a/chrome/browser/ui/views/find_bar_view.h b/chrome/browser/ui/views/find_bar_view.h index a7a5e7f..f8197fe 100644 --- a/chrome/browser/ui/views/find_bar_view.h +++ b/chrome/browser/ui/views/find_bar_view.h @@ -47,11 +47,17 @@ class FindBarView : public DropdownBarView, string16 GetFindText() const; void SetFindText(const string16& find_text); + // Gets the match count text displayed in the text box. + string16 GetMatchCountText() const; + // Updates the label inside the Find text box that shows the ordinal of the // active item and how many matches were found. void UpdateForResult(const FindNotificationDetails& result, const string16& find_text); + // Clears the current Match Count value in the Find text box. + void ClearMatchCount(); + // Claims focus for the text field and selects its contents. virtual void SetFocusAndSelection(bool select_all); |