| 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 <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/strings/string16.h" | 12 #include "base/strings/string16.h" |
| 13 #include "chrome/browser/ui/views/dropdown_bar_view.h" | 13 #include "chrome/browser/ui/views/dropdown_bar_view.h" |
| 14 #include "ui/views/controls/button/button.h" | 14 #include "ui/views/controls/button/vector_icon_button_delegate.h" |
| 15 #include "ui/views/controls/textfield/textfield.h" | 15 #include "ui/views/controls/textfield/textfield.h" |
| 16 #include "ui/views/controls/textfield/textfield_controller.h" | 16 #include "ui/views/controls/textfield/textfield_controller.h" |
| 17 #include "ui/views/view_targeter_delegate.h" | 17 #include "ui/views/view_targeter_delegate.h" |
| 18 | 18 |
| 19 class FindBarHost; | 19 class FindBarHost; |
| 20 class FindNotificationDetails; | 20 class FindNotificationDetails; |
| 21 | 21 |
| 22 namespace views { | 22 namespace views { |
| 23 class ImageButton; | 23 class ImageButton; |
| 24 class Label; | 24 class Label; |
| 25 class MouseEvent; | 25 class MouseEvent; |
| 26 class Painter; | 26 class Painter; |
| 27 class Separator; | 27 class Separator; |
| 28 } | 28 } |
| 29 | 29 |
| 30 //////////////////////////////////////////////////////////////////////////////// | 30 //////////////////////////////////////////////////////////////////////////////// |
| 31 // | 31 // |
| 32 // The FindBarView is responsible for drawing the UI controls of the | 32 // The FindBarView is responsible for drawing the UI controls of the |
| 33 // FindBar, the find text box, the 'Find' button and the 'Close' | 33 // FindBar, the find text box, the 'Find' button and the 'Close' |
| 34 // button. It communicates the user search words to the FindBarHost. | 34 // button. It communicates the user search words to the FindBarHost. |
| 35 // | 35 // |
| 36 //////////////////////////////////////////////////////////////////////////////// | 36 //////////////////////////////////////////////////////////////////////////////// |
| 37 class FindBarView : public DropdownBarView, | 37 class FindBarView : public DropdownBarView, |
| 38 public views::ButtonListener, | 38 public views::VectorIconButtonDelegate, |
| 39 public views::TextfieldController, | 39 public views::TextfieldController, |
| 40 public views::ViewTargeterDelegate { | 40 public views::ViewTargeterDelegate { |
| 41 public: | 41 public: |
| 42 explicit FindBarView(FindBarHost* host); | 42 explicit FindBarView(FindBarHost* host); |
| 43 ~FindBarView() override; | 43 ~FindBarView() override; |
| 44 | 44 |
| 45 // Accessors for the text and selection displayed in the text box. | 45 // Accessors for the text and selection displayed in the text box. |
| 46 void SetFindTextAndSelectedRange(const base::string16& find_text, | 46 void SetFindTextAndSelectedRange(const base::string16& find_text, |
| 47 const gfx::Range& selected_range); | 47 const gfx::Range& selected_range); |
| 48 base::string16 GetFindText() const; | 48 base::string16 GetFindText() const; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 64 | 64 |
| 65 // Claims focus for the text field and selects its contents. | 65 // Claims focus for the text field and selects its contents. |
| 66 void SetFocusAndSelection(bool select_all) override; | 66 void SetFocusAndSelection(bool select_all) override; |
| 67 | 67 |
| 68 // DropdownBarView: | 68 // DropdownBarView: |
| 69 void OnPaint(gfx::Canvas* canvas) override; | 69 void OnPaint(gfx::Canvas* canvas) override; |
| 70 void OnPaintBackground(gfx::Canvas* canvas) override; | 70 void OnPaintBackground(gfx::Canvas* canvas) override; |
| 71 void Layout() override; | 71 void Layout() override; |
| 72 gfx::Size GetPreferredSize() const override; | 72 gfx::Size GetPreferredSize() const override; |
| 73 | 73 |
| 74 // views::ButtonListener: | 74 // views::VectorIconButtonDelegate: |
| 75 void ButtonPressed(views::Button* sender, const ui::Event& event) override; | 75 void ButtonPressed(views::Button* sender, const ui::Event& event) override; |
| 76 SkColor GetVectorIconBaseColor() const override; |
| 76 | 77 |
| 77 // views::TextfieldController: | 78 // views::TextfieldController: |
| 78 bool HandleKeyEvent(views::Textfield* sender, | 79 bool HandleKeyEvent(views::Textfield* sender, |
| 79 const ui::KeyEvent& key_event) override; | 80 const ui::KeyEvent& key_event) override; |
| 80 void OnAfterUserAction(views::Textfield* sender) override; | 81 void OnAfterUserAction(views::Textfield* sender) override; |
| 81 void OnAfterPaste() override; | 82 void OnAfterPaste() override; |
| 82 | 83 |
| 83 // views::ViewTargeterDelegate: | 84 // views::ViewTargeterDelegate: |
| 84 views::View* TargetForRect(View* root, const gfx::Rect& rect) override; | 85 views::View* TargetForRect(View* root, const gfx::Rect& rect) override; |
| 85 | 86 |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 views::ImageButton* find_next_button_; | 142 views::ImageButton* find_next_button_; |
| 142 views::ImageButton* close_button_; | 143 views::ImageButton* close_button_; |
| 143 | 144 |
| 144 // The preferred height of the find bar. | 145 // The preferred height of the find bar. |
| 145 int preferred_height_; | 146 int preferred_height_; |
| 146 | 147 |
| 147 DISALLOW_COPY_AND_ASSIGN(FindBarView); | 148 DISALLOW_COPY_AND_ASSIGN(FindBarView); |
| 148 }; | 149 }; |
| 149 | 150 |
| 150 #endif // CHROME_BROWSER_UI_VIEWS_FIND_BAR_VIEW_H_ | 151 #endif // CHROME_BROWSER_UI_VIEWS_FIND_BAR_VIEW_H_ |
| OLD | NEW |