| OLD | NEW |
| 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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_VIEWS_FIND_BAR_HOST_H_ | 5 #ifndef CHROME_BROWSER_VIEWS_FIND_BAR_HOST_H_ |
| 6 #define CHROME_BROWSER_VIEWS_FIND_BAR_HOST_H_ | 6 #define CHROME_BROWSER_VIEWS_FIND_BAR_HOST_H_ |
| 7 | 7 |
| 8 #include "app/animation.h" | 8 #include "app/animation.h" |
| 9 #include "base/gfx/rect.h" | 9 #include "base/gfx/rect.h" |
| 10 #include "base/gfx/native_widget_types.h" | 10 #include "base/gfx/native_widget_types.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 // for example if the window is obscuring the selection results. It also | 37 // for example if the window is obscuring the selection results. It also |
| 38 // receives notifications about the search results and communicates that to | 38 // receives notifications about the search results and communicates that to |
| 39 // the view. | 39 // the view. |
| 40 // | 40 // |
| 41 // There is one FindBarHost per BrowserView, and its state is updated | 41 // There is one FindBarHost per BrowserView, and its state is updated |
| 42 // whenever the selected Tab is changed. The FindBarHost is created when | 42 // whenever the selected Tab is changed. The FindBarHost is created when |
| 43 // the BrowserView is attached to the frame's Widget for the first time. | 43 // the BrowserView is attached to the frame's Widget for the first time. |
| 44 // | 44 // |
| 45 //////////////////////////////////////////////////////////////////////////////// | 45 //////////////////////////////////////////////////////////////////////////////// |
| 46 class FindBarHost : public views::AcceleratorTarget, | 46 class FindBarHost : public views::AcceleratorTarget, |
| 47 public views::FocusChangeListener, | 47 public views::FocusChangeListener, |
| 48 public AnimationDelegate, | 48 public AnimationDelegate, |
| 49 public FindBar, | 49 public FindBar, |
| 50 public FindBarTesting { | 50 public FindBarTesting { |
| 51 public: | 51 public: |
| 52 explicit FindBarHost(BrowserView* browser_view); | 52 explicit FindBarHost(BrowserView* browser_view); |
| 53 virtual ~FindBarHost(); | 53 virtual ~FindBarHost(); |
| 54 | 54 |
| 55 // Whether we are animating the position of the Find window. | 55 // Whether we are animating the position of the Find window. |
| 56 bool IsAnimating(); | 56 bool IsAnimating(); |
| 57 | 57 |
| 58 // Forwards selected keystrokes to the renderer. This is useful to make sure | 58 // Forwards selected keystrokes to the renderer. This is useful to make sure |
| 59 // that arrow keys and PageUp and PageDown result in scrolling, instead of | 59 // that arrow keys and PageUp and PageDown result in scrolling, instead of |
| 60 // being eaten because the FindBar has focus. Returns true if the keystroke | 60 // being eaten because the FindBar has focus. Returns true if the keystroke |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 // Allows implementation to tweak dialog position. | 148 // Allows implementation to tweak dialog position. |
| 149 void SetDialogPositionNative(const gfx::Rect& new_pos, bool no_redraw); | 149 void SetDialogPositionNative(const gfx::Rect& new_pos, bool no_redraw); |
| 150 // Allows implementation to tweak dialog position. | 150 // Allows implementation to tweak dialog position. |
| 151 void GetDialogPositionNative(gfx::Rect* avoid_overlapping_rect); | 151 void GetDialogPositionNative(gfx::Rect* avoid_overlapping_rect); |
| 152 // Returns the native view (is a child of the window widget in gtk). | 152 // Returns the native view (is a child of the window widget in gtk). |
| 153 gfx::NativeView GetNativeView(BrowserView* browser_view); | 153 gfx::NativeView GetNativeView(BrowserView* browser_view); |
| 154 // Returns a keyboard event suitable for fowarding. | 154 // Returns a keyboard event suitable for fowarding. |
| 155 NativeWebKeyboardEvent GetKeyboardEvent( | 155 NativeWebKeyboardEvent GetKeyboardEvent( |
| 156 const TabContents* contents, | 156 const TabContents* contents, |
| 157 const views::Textfield::Keystroke& key_stroke); | 157 const views::Textfield::Keystroke& key_stroke); |
| 158 // Allows native implementation to prevent keystrokes from being forwarded. |
| 159 bool ShouldForwardKeystrokeToWebpageNative( |
| 160 const views::Textfield::Keystroke& key_stroke); |
| 158 | 161 |
| 159 // The BrowserView that created us. | 162 // The BrowserView that created us. |
| 160 BrowserView* browser_view_; | 163 BrowserView* browser_view_; |
| 161 | 164 |
| 162 // Our view, which is responsible for drawing the UI. | 165 // Our view, which is responsible for drawing the UI. |
| 163 FindBarView* view_; | 166 FindBarView* view_; |
| 164 | 167 |
| 165 // The y position pixel offset of the window while animating the Find dialog. | 168 // The y position pixel offset of the window while animating the Find dialog. |
| 166 int find_dialog_animation_offset_; | 169 int find_dialog_animation_offset_; |
| 167 | 170 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 184 | 187 |
| 185 // Host is the Widget implementation that is created and maintained by the | 188 // Host is the Widget implementation that is created and maintained by the |
| 186 // find bar. It contains the FindBarView. | 189 // find bar. It contains the FindBarView. |
| 187 scoped_ptr<views::Widget> host_; | 190 scoped_ptr<views::Widget> host_; |
| 188 | 191 |
| 189 DISALLOW_COPY_AND_ASSIGN(FindBarHost); | 192 DISALLOW_COPY_AND_ASSIGN(FindBarHost); |
| 190 }; | 193 }; |
| 191 | 194 |
| 192 #endif // CHROME_BROWSER_VIEWS_FIND_BAR_HOST_H_ | 195 #endif // CHROME_BROWSER_VIEWS_FIND_BAR_HOST_H_ |
| 193 | 196 |
| OLD | NEW |