| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #ifndef CHROME_BROWSER_UI_VIEWS_FIND_BAR_VIEW_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_FIND_BAR_VIEW_H_ |
| 6 #define CHROME_BROWSER_UI_VIEWS_FIND_BAR_VIEW_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_FIND_BAR_VIEW_H_ |
| 7 | 7 |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 | 58 |
| 59 // Updates the label inside the Find text box that shows the ordinal of the | 59 // Updates the label inside the Find text box that shows the ordinal of the |
| 60 // active item and how many matches were found. | 60 // active item and how many matches were found. |
| 61 void UpdateForResult(const FindNotificationDetails& result, | 61 void UpdateForResult(const FindNotificationDetails& result, |
| 62 const base::string16& find_text); | 62 const base::string16& find_text); |
| 63 | 63 |
| 64 // Clears the current Match Count value in the Find text box. | 64 // Clears the current Match Count value in the Find text box. |
| 65 void ClearMatchCount(); | 65 void ClearMatchCount(); |
| 66 | 66 |
| 67 // Claims focus for the text field and selects its contents. | 67 // Claims focus for the text field and selects its contents. |
| 68 virtual void SetFocusAndSelection(bool select_all) OVERRIDE; | 68 virtual void SetFocusAndSelection(bool select_all) override; |
| 69 | 69 |
| 70 // views::View: | 70 // views::View: |
| 71 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; | 71 virtual void OnPaint(gfx::Canvas* canvas) override; |
| 72 virtual void Layout() OVERRIDE; | 72 virtual void Layout() override; |
| 73 virtual gfx::Size GetPreferredSize() const OVERRIDE; | 73 virtual gfx::Size GetPreferredSize() const override; |
| 74 | 74 |
| 75 // views::ButtonListener: | 75 // views::ButtonListener: |
| 76 virtual void ButtonPressed(views::Button* sender, | 76 virtual void ButtonPressed(views::Button* sender, |
| 77 const ui::Event& event) OVERRIDE; | 77 const ui::Event& event) override; |
| 78 | 78 |
| 79 // views::TextfieldController: | 79 // views::TextfieldController: |
| 80 virtual bool HandleKeyEvent(views::Textfield* sender, | 80 virtual bool HandleKeyEvent(views::Textfield* sender, |
| 81 const ui::KeyEvent& key_event) OVERRIDE; | 81 const ui::KeyEvent& key_event) override; |
| 82 virtual void OnAfterUserAction(views::Textfield* sender) OVERRIDE; | 82 virtual void OnAfterUserAction(views::Textfield* sender) override; |
| 83 virtual void OnAfterPaste() OVERRIDE; | 83 virtual void OnAfterPaste() override; |
| 84 | 84 |
| 85 private: | 85 private: |
| 86 // Starts finding |search_text|. If the text is empty, stops finding. | 86 // Starts finding |search_text|. If the text is empty, stops finding. |
| 87 void Find(const base::string16& search_text); | 87 void Find(const base::string16& search_text); |
| 88 | 88 |
| 89 // Updates the appearance for the match count label. | 89 // Updates the appearance for the match count label. |
| 90 void UpdateMatchCountAppearance(bool no_match); | 90 void UpdateMatchCountAppearance(bool no_match); |
| 91 | 91 |
| 92 // views::View: | 92 // views::View: |
| 93 virtual void OnThemeChanged() OVERRIDE; | 93 virtual void OnThemeChanged() override; |
| 94 | 94 |
| 95 // We use a hidden view to grab mouse clicks and bring focus to the find | 95 // We use a hidden view to grab mouse clicks and bring focus to the find |
| 96 // text box. This is because although the find text box may look like it | 96 // text box. This is because although the find text box may look like it |
| 97 // extends all the way to the find button, it only goes as far as to the | 97 // extends all the way to the find button, it only goes as far as to the |
| 98 // match_count label. The user, however, expects being able to click anywhere | 98 // match_count label. The user, however, expects being able to click anywhere |
| 99 // inside what looks like the find text box (including on or around the | 99 // inside what looks like the find text box (including on or around the |
| 100 // match_count label) and have focus brought to the find box. | 100 // match_count label) and have focus brought to the find box. |
| 101 class FocusForwarderView : public views::View { | 101 class FocusForwarderView : public views::View { |
| 102 public: | 102 public: |
| 103 explicit FocusForwarderView( | 103 explicit FocusForwarderView( |
| 104 views::Textfield* view_to_focus_on_mousedown) | 104 views::Textfield* view_to_focus_on_mousedown) |
| 105 : view_to_focus_on_mousedown_(view_to_focus_on_mousedown) {} | 105 : view_to_focus_on_mousedown_(view_to_focus_on_mousedown) {} |
| 106 | 106 |
| 107 private: | 107 private: |
| 108 virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE; | 108 virtual bool OnMousePressed(const ui::MouseEvent& event) override; |
| 109 | 109 |
| 110 views::Textfield* view_to_focus_on_mousedown_; | 110 views::Textfield* view_to_focus_on_mousedown_; |
| 111 | 111 |
| 112 DISALLOW_COPY_AND_ASSIGN(FocusForwarderView); | 112 DISALLOW_COPY_AND_ASSIGN(FocusForwarderView); |
| 113 }; | 113 }; |
| 114 | 114 |
| 115 // Returns the OS-specific view for the find bar that acts as an intermediary | 115 // Returns the OS-specific view for the find bar that acts as an intermediary |
| 116 // between us and the WebContentsView. | 116 // between us and the WebContentsView. |
| 117 FindBarHost* find_bar_host() const; | 117 FindBarHost* find_bar_host() const; |
| 118 | 118 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 129 views::ImageButton* find_next_button_; | 129 views::ImageButton* find_next_button_; |
| 130 views::ImageButton* close_button_; | 130 views::ImageButton* close_button_; |
| 131 | 131 |
| 132 // The preferred height of the find bar. | 132 // The preferred height of the find bar. |
| 133 int preferred_height_; | 133 int preferred_height_; |
| 134 | 134 |
| 135 DISALLOW_COPY_AND_ASSIGN(FindBarView); | 135 DISALLOW_COPY_AND_ASSIGN(FindBarView); |
| 136 }; | 136 }; |
| 137 | 137 |
| 138 #endif // CHROME_BROWSER_UI_VIEWS_FIND_BAR_VIEW_H_ | 138 #endif // CHROME_BROWSER_UI_VIEWS_FIND_BAR_VIEW_H_ |
| OLD | NEW |