| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_HOST_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_FIND_BAR_HOST_H_ |
| 6 #define CHROME_BROWSER_UI_VIEWS_FIND_BAR_HOST_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_FIND_BAR_HOST_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "chrome/browser/renderer_host/render_view_host_delegate.h" | 9 #include "chrome/browser/renderer_host/render_view_host_delegate.h" |
| 10 #include "chrome/browser/ui/find_bar/find_bar.h" | 10 #include "chrome/browser/ui/find_bar/find_bar.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 // the BrowserView is attached to the frame's Widget for the first time. | 33 // the BrowserView is attached to the frame's Widget for the first time. |
| 34 // | 34 // |
| 35 //////////////////////////////////////////////////////////////////////////////// | 35 //////////////////////////////////////////////////////////////////////////////// |
| 36 class FindBarHost : public DropdownBarHost, | 36 class FindBarHost : public DropdownBarHost, |
| 37 public FindBar, | 37 public FindBar, |
| 38 public FindBarTesting { | 38 public FindBarTesting { |
| 39 public: | 39 public: |
| 40 explicit FindBarHost(BrowserView* browser_view); | 40 explicit FindBarHost(BrowserView* browser_view); |
| 41 virtual ~FindBarHost(); | 41 virtual ~FindBarHost(); |
| 42 | 42 |
| 43 // Forwards selected keystrokes to the renderer. This is useful to make sure | 43 // Forwards selected key events to the renderer. This is useful to make sure |
| 44 // that arrow keys and PageUp and PageDown result in scrolling, instead of | 44 // that arrow keys and PageUp and PageDown result in scrolling, instead of |
| 45 // being eaten because the FindBar has focus. Returns true if the keystroke | 45 // being eaten because the FindBar has focus. Returns true if the keystroke |
| 46 // was forwarded, false if not. | 46 // was forwarded, false if not. |
| 47 bool MaybeForwardKeystrokeToWebpage( | 47 bool MaybeForwardKeyEventToWebpage(const views::KeyEvent& key_event); |
| 48 const views::Textfield::Keystroke& key_stroke); | |
| 49 | 48 |
| 50 // FindBar implementation: | 49 // FindBar implementation: |
| 51 virtual FindBarController* GetFindBarController() const; | 50 virtual FindBarController* GetFindBarController() const; |
| 52 virtual void SetFindBarController(FindBarController* find_bar_controller); | 51 virtual void SetFindBarController(FindBarController* find_bar_controller); |
| 53 virtual void Show(bool animate); | 52 virtual void Show(bool animate); |
| 54 virtual void Hide(bool animate); | 53 virtual void Hide(bool animate); |
| 55 virtual void SetFocusAndSelection(); | 54 virtual void SetFocusAndSelection(); |
| 56 virtual void ClearResults(const FindNotificationDetails& results); | 55 virtual void ClearResults(const FindNotificationDetails& results); |
| 57 virtual void StopAnimation(); | 56 virtual void StopAnimation(); |
| 58 virtual void MoveWindowIfNecessary(const gfx::Rect& selection_rect, | 57 virtual void MoveWindowIfNecessary(const gfx::Rect& selection_rect, |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 virtual void GetWidgetBounds(gfx::Rect* bounds); | 108 virtual void GetWidgetBounds(gfx::Rect* bounds); |
| 110 | 109 |
| 111 // Additional accelerator handling (on top of what DropDownBarHost does). | 110 // Additional accelerator handling (on top of what DropDownBarHost does). |
| 112 virtual void RegisterAccelerators(); | 111 virtual void RegisterAccelerators(); |
| 113 virtual void UnregisterAccelerators(); | 112 virtual void UnregisterAccelerators(); |
| 114 | 113 |
| 115 private: | 114 private: |
| 116 // Allows implementation to tweak widget position. | 115 // Allows implementation to tweak widget position. |
| 117 void GetWidgetPositionNative(gfx::Rect* avoid_overlapping_rect); | 116 void GetWidgetPositionNative(gfx::Rect* avoid_overlapping_rect); |
| 118 | 117 |
| 119 // Allows native implementation to prevent keystrokes from being forwarded. | 118 // Allows native implementation to prevent key events from being forwarded. |
| 120 bool ShouldForwardKeystrokeToWebpageNative( | 119 bool ShouldForwardKeyEventToWebpageNative( |
| 121 const views::Textfield::Keystroke& key_stroke); | 120 const views::KeyEvent& key_event); |
| 122 | 121 |
| 123 // Returns the FindBarView. | 122 // Returns the FindBarView. |
| 124 FindBarView* find_bar_view(); | 123 FindBarView* find_bar_view(); |
| 125 | 124 |
| 126 // A pointer back to the owning controller. | 125 // A pointer back to the owning controller. |
| 127 FindBarController* find_bar_controller_; | 126 FindBarController* find_bar_controller_; |
| 128 | 127 |
| 129 DISALLOW_COPY_AND_ASSIGN(FindBarHost); | 128 DISALLOW_COPY_AND_ASSIGN(FindBarHost); |
| 130 }; | 129 }; |
| 131 | 130 |
| 132 #endif // CHROME_BROWSER_UI_VIEWS_FIND_BAR_HOST_H_ | 131 #endif // CHROME_BROWSER_UI_VIEWS_FIND_BAR_HOST_H_ |
| OLD | NEW |