diff options
author | finnur@google.com <finnur@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-24 00:10:29 +0000 |
---|---|---|
committer | finnur@google.com <finnur@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-24 00:10:29 +0000 |
commit | 4f3dc3751d69f9db1f8ef533a3335201b3bc78bc (patch) | |
tree | e37efecf992ddd4e901c894273cbb1e5bf4260cc /chrome/browser/views/find_bar_view.h | |
parent | 5e7f161f73f1817b8a0c422c0e4b5eceae6954e7 (diff) | |
download | chromium_src-4f3dc3751d69f9db1f8ef533a3335201b3bc78bc.zip chromium_src-4f3dc3751d69f9db1f8ef533a3335201b3bc78bc.tar.gz chromium_src-4f3dc3751d69f9db1f8ef533a3335201b3bc78bc.tar.bz2 |
The find bar should be owned and managed from the BrowserView, not the WebContentsView, since it's part of the "chrome".
Design Doc: http://dev.chromium.org/developers/design-documents/find-bar
Things done:
- Pulled all of the find bar stuff out of WebContentsView* since it's no longer needed.
- Moved OnFindReply delegate method from RenderViewHostDelegate::View to RenderViewHostDelegate, since it's no longer implemented on the view.
- Moved find control methods to WebContents.
- Added recent find result state to WebContents.
- Updated the UI tests to accommodate the changes in the state that is broadcast when results are discovered.
- Updated the find bar layout to obtain its bounding box from the BrowserView, which knows about toolbars, bookmark bars etc.
- Updated the find bar itself to handle the fact that it can be displayed for multiple different tabs.
- Moved the find bar manipulation methods for testing from TabProxy to BrowserProxy, since the find bar is now a feature of the window, not the tab.
- view.h: Don't lay out child views again if they have a layout manager, it already updated them.
TEST=Find box should work as before.
BUG=3245
Review URL: http://codereview.chromium.org/27025
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@10231 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/views/find_bar_view.h')
-rw-r--r-- | chrome/browser/views/find_bar_view.h | 41 |
1 files changed, 15 insertions, 26 deletions
diff --git a/chrome/browser/views/find_bar_view.h b/chrome/browser/views/find_bar_view.h index 146f96b..2818d6d 100644 --- a/chrome/browser/views/find_bar_view.h +++ b/chrome/browser/views/find_bar_view.h @@ -6,6 +6,7 @@ #define CHROME_BROWSER_VIEWS_FIND_BAR_VIEW_H_ #include "base/gfx/size.h" +#include "chrome/browser/find_notification_details.h" #include "chrome/views/button.h" #include "chrome/views/text_field.h" @@ -35,31 +36,19 @@ class FindBarView : public views::View, CLOSE_TAG, // The Close button (the 'X'). }; - FindBarView(FindBarWin* container); + explicit FindBarView(FindBarWin* container); virtual ~FindBarView(); - // Updates the UI to show how many matches were found on the page/frames. - // This function does nothing if |number_of_matches| is below 0, which can - // happen during a FindNext operation when a scoping effort is already in - // progress. |final_update| specifies whether this is the last update message - // this Find operation will produce or if this is just a preliminary report. - void UpdateMatchCount(int number_of_matches, bool final_update); - - // Notifies the view of the ordinal for the currently active item on the page. - void UpdateActiveMatchOrdinal(int ordinal); + // Sets the text displayed in the text box. + void SetFindText(const std::wstring& find_text); // Updates the label inside the Find text box that shows the ordinal of the // active item and how many matches were found. - void UpdateResultLabel(); - - // Resets the UI element that shows how many matches were found. - void ResetMatchCount(); - - // Resets the background for the match count label. - void ResetMatchCountBackground(); + void UpdateForResult(const FindNotificationDetails& result, + const std::wstring& find_text); - // View needs to respond to Show to set focus to the find text box - void OnShow(); + // Claims focus for the text field and selects its contents. + void SetFocusAndSelection(); // Updates the view to let it know where the controller is clipping the // Find window (while animating the opening or closing of the window). @@ -81,9 +70,12 @@ class FindBarView : public views::View, TCHAR key, UINT repeat_count, UINT flags); // Set whether or not we're attempting to blend with the toolbar. - void SetToolbarBlend(bool toolbar_blend) {toolbar_blend_ = toolbar_blend;} + void set_toolbar_blend(bool toolbar_blend) { toolbar_blend_ = toolbar_blend; } private: + // Resets the background for the match count label. + void ResetMatchCountBackground(); + // We use a hidden view to grab mouse clicks and bring focus to the find // text box. This is because although the find text box may look like it // extends all the way to the find button, it only goes as far as to the @@ -116,6 +108,9 @@ class FindBarView : public views::View, views::Button* find_next_button_; views::Button* close_button_; + // The last matchcount number we reported to the user. + int last_reported_matchcount_; + // Whether or not we're attempting to blend with the toolbar (this is // false if the bookmarks bar is visible). bool toolbar_blend_; @@ -126,12 +121,6 @@ class FindBarView : public views::View, // in the right location. int animation_offset_; - // How many matches were found on the page. - int match_count_; - - // The ordinal of the currently active match. - int active_match_ordinal_; - DISALLOW_COPY_AND_ASSIGN(FindBarView); }; |