| 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" |
| 11 #include "chrome/browser/ui/views/dropdown_bar_view.h" | 11 #include "chrome/browser/ui/views/dropdown_bar_view.h" |
| 12 #include "ui/views/controls/button/button.h" | 12 #include "ui/views/controls/button/button.h" |
| 13 #include "ui/views/controls/textfield/textfield.h" | 13 #include "ui/views/controls/textfield/textfield.h" |
| 14 #include "ui/views/controls/textfield/textfield_controller.h" | 14 #include "ui/views/controls/textfield/textfield_controller.h" |
| 15 #include "ui/views/view_targeter_delegate.h" | 15 #include "ui/views/view_targeter_delegate.h" |
| 16 | 16 |
| 17 class FindBarHost; | 17 class FindBarHost; |
| 18 class FindNotificationDetails; | 18 class FindNotificationDetails; |
| 19 | 19 |
| 20 namespace views { | 20 namespace views { |
| 21 class ImageButton; | 21 class ImageButton; |
| 22 class Label; | 22 class Label; |
| 23 class MouseEvent; | 23 class MouseEvent; |
| 24 class Painter; | 24 class Painter; |
| 25 class Separator; |
| 25 } | 26 } |
| 26 | 27 |
| 27 //////////////////////////////////////////////////////////////////////////////// | 28 //////////////////////////////////////////////////////////////////////////////// |
| 28 // | 29 // |
| 29 // The FindBarView is responsible for drawing the UI controls of the | 30 // The FindBarView is responsible for drawing the UI controls of the |
| 30 // FindBar, the find text box, the 'Find' button and the 'Close' | 31 // FindBar, the find text box, the 'Find' button and the 'Close' |
| 31 // button. It communicates the user search words to the FindBarHost. | 32 // button. It communicates the user search words to the FindBarHost. |
| 32 // | 33 // |
| 33 //////////////////////////////////////////////////////////////////////////////// | 34 //////////////////////////////////////////////////////////////////////////////// |
| 34 class FindBarView : public DropdownBarView, | 35 class FindBarView : public DropdownBarView, |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 void Find(const base::string16& search_text); | 98 void Find(const base::string16& search_text); |
| 98 | 99 |
| 99 // Updates the appearance for the match count label. | 100 // Updates the appearance for the match count label. |
| 100 void UpdateMatchCountAppearance(bool no_match); | 101 void UpdateMatchCountAppearance(bool no_match); |
| 101 | 102 |
| 102 // DropdownBarView: | 103 // DropdownBarView: |
| 103 const char* GetClassName() const override; | 104 const char* GetClassName() const override; |
| 104 void OnThemeChanged() override; | 105 void OnThemeChanged() override; |
| 105 void OnNativeThemeChanged(const ui::NativeTheme* theme) override; | 106 void OnNativeThemeChanged(const ui::NativeTheme* theme) override; |
| 106 | 107 |
| 108 // Returns the color for the icons on the buttons per the current NativeTheme. |
| 109 SkColor GetTextColorForIcon(); |
| 110 |
| 107 // We use a hidden view to grab mouse clicks and bring focus to the find | 111 // We use a hidden view to grab mouse clicks and bring focus to the find |
| 108 // text box. This is because although the find text box may look like it | 112 // text box. This is because although the find text box may look like it |
| 109 // extends all the way to the find button, it only goes as far as to the | 113 // extends all the way to the find button, it only goes as far as to the |
| 110 // match_count label. The user, however, expects being able to click anywhere | 114 // match_count label. The user, however, expects being able to click anywhere |
| 111 // inside what looks like the find text box (including on or around the | 115 // inside what looks like the find text box (including on or around the |
| 112 // match_count label) and have focus brought to the find box. | 116 // match_count label) and have focus brought to the find box. |
| 113 class FocusForwarderView : public views::View { | 117 class FocusForwarderView : public views::View { |
| 114 public: | 118 public: |
| 115 explicit FocusForwarderView( | 119 explicit FocusForwarderView( |
| 116 views::Textfield* view_to_focus_on_mousedown) | 120 views::Textfield* view_to_focus_on_mousedown) |
| (...skipping 13 matching lines...) Expand all Loading... |
| 130 | 134 |
| 131 // Used to detect if the input text, not including the IME composition text, | 135 // Used to detect if the input text, not including the IME composition text, |
| 132 // has changed or not. | 136 // has changed or not. |
| 133 base::string16 last_searched_text_; | 137 base::string16 last_searched_text_; |
| 134 | 138 |
| 135 // The controls in the window. | 139 // The controls in the window. |
| 136 views::Textfield* find_text_; | 140 views::Textfield* find_text_; |
| 137 scoped_ptr<views::Painter> find_text_border_; | 141 scoped_ptr<views::Painter> find_text_border_; |
| 138 views::Label* match_count_text_; | 142 views::Label* match_count_text_; |
| 139 views::View* focus_forwarder_view_; | 143 views::View* focus_forwarder_view_; |
| 144 views::Separator* separator_; |
| 140 views::ImageButton* find_previous_button_; | 145 views::ImageButton* find_previous_button_; |
| 141 views::ImageButton* find_next_button_; | 146 views::ImageButton* find_next_button_; |
| 142 views::ImageButton* close_button_; | 147 views::ImageButton* close_button_; |
| 143 | 148 |
| 144 // The preferred height of the find bar. | 149 // The preferred height of the find bar. |
| 145 int preferred_height_; | 150 int preferred_height_; |
| 146 | 151 |
| 147 DISALLOW_COPY_AND_ASSIGN(FindBarView); | 152 DISALLOW_COPY_AND_ASSIGN(FindBarView); |
| 148 }; | 153 }; |
| 149 | 154 |
| 150 #endif // CHROME_BROWSER_UI_VIEWS_FIND_BAR_VIEW_H_ | 155 #endif // CHROME_BROWSER_UI_VIEWS_FIND_BAR_VIEW_H_ |
| OLD | NEW |