| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_GTK_FIND_BAR_GTK_H_ | 5 #ifndef CHROME_BROWSER_UI_GTK_FIND_BAR_GTK_H_ |
| 6 #define CHROME_BROWSER_UI_GTK_FIND_BAR_GTK_H_ | 6 #define CHROME_BROWSER_UI_GTK_FIND_BAR_GTK_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <gtk/gtk.h> | 9 #include <gtk/gtk.h> |
| 10 | 10 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/compiler_specific.h" |
| 12 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 13 #include "chrome/browser/ui/find_bar/find_bar.h" | 14 #include "chrome/browser/ui/find_bar/find_bar.h" |
| 14 #include "chrome/browser/ui/gtk/focus_store_gtk.h" | 15 #include "chrome/browser/ui/gtk/focus_store_gtk.h" |
| 15 #include "chrome/browser/ui/gtk/slide_animator_gtk.h" | 16 #include "chrome/browser/ui/gtk/slide_animator_gtk.h" |
| 16 #include "content/public/browser/notification_observer.h" | 17 #include "content/public/browser/notification_observer.h" |
| 17 #include "content/public/browser/notification_registrar.h" | 18 #include "content/public/browser/notification_registrar.h" |
| 18 #include "ui/base/gtk/gtk_signal.h" | 19 #include "ui/base/gtk/gtk_signal.h" |
| 19 #include "ui/base/gtk/owned_widget_gtk.h" | 20 #include "ui/base/gtk/owned_widget_gtk.h" |
| 20 #include "ui/gfx/point.h" | 21 #include "ui/gfx/point.h" |
| 21 | 22 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 34 class FindBarGtk : public FindBar, | 35 class FindBarGtk : public FindBar, |
| 35 public FindBarTesting, | 36 public FindBarTesting, |
| 36 public content::NotificationObserver { | 37 public content::NotificationObserver { |
| 37 public: | 38 public: |
| 38 explicit FindBarGtk(BrowserWindowGtk* window); | 39 explicit FindBarGtk(BrowserWindowGtk* window); |
| 39 virtual ~FindBarGtk(); | 40 virtual ~FindBarGtk(); |
| 40 | 41 |
| 41 GtkWidget* widget() const { return slide_widget_->widget(); } | 42 GtkWidget* widget() const { return slide_widget_->widget(); } |
| 42 | 43 |
| 43 // Methods from FindBar. | 44 // Methods from FindBar. |
| 44 virtual FindBarController* GetFindBarController() const; | 45 virtual FindBarController* GetFindBarController() const OVERRIDE; |
| 45 virtual void SetFindBarController(FindBarController* find_bar_controller); | 46 virtual void SetFindBarController( |
| 46 virtual void Show(bool animate); | 47 FindBarController* find_bar_controller) OVERRIDE; |
| 47 virtual void Hide(bool animate); | 48 virtual void Show(bool animate) OVERRIDE; |
| 48 virtual void SetFocusAndSelection(); | 49 virtual void Hide(bool animate) OVERRIDE; |
| 49 virtual void ClearResults(const FindNotificationDetails& results); | 50 virtual void SetFocusAndSelection() OVERRIDE; |
| 50 virtual void StopAnimation(); | 51 virtual void ClearResults(const FindNotificationDetails& results) OVERRIDE; |
| 52 virtual void StopAnimation() OVERRIDE; |
| 51 virtual void MoveWindowIfNecessary(const gfx::Rect& selection_rect, | 53 virtual void MoveWindowIfNecessary(const gfx::Rect& selection_rect, |
| 52 bool no_redraw); | 54 bool no_redraw) OVERRIDE; |
| 53 virtual void SetFindText(const string16& find_text); | 55 virtual void SetFindText(const string16& find_text) OVERRIDE; |
| 54 virtual void UpdateUIForFindResult(const FindNotificationDetails& result, | 56 virtual void UpdateUIForFindResult(const FindNotificationDetails& result, |
| 55 const string16& find_text); | 57 const string16& find_text) OVERRIDE; |
| 56 virtual void AudibleAlert(); | 58 virtual void AudibleAlert() OVERRIDE; |
| 57 virtual bool IsFindBarVisible(); | 59 virtual bool IsFindBarVisible() OVERRIDE; |
| 58 virtual void RestoreSavedFocus(); | 60 virtual void RestoreSavedFocus() OVERRIDE; |
| 59 virtual FindBarTesting* GetFindBarTesting(); | 61 virtual FindBarTesting* GetFindBarTesting() OVERRIDE; |
| 60 | 62 |
| 61 // Methods from FindBarTesting. | 63 // Methods from FindBarTesting. |
| 62 virtual bool GetFindBarWindowInfo(gfx::Point* position, | 64 virtual bool GetFindBarWindowInfo(gfx::Point* position, |
| 63 bool* fully_visible); | 65 bool* fully_visible) OVERRIDE; |
| 64 virtual string16 GetFindText(); | 66 virtual string16 GetFindText() OVERRIDE; |
| 65 virtual string16 GetFindSelectedText(); | 67 virtual string16 GetFindSelectedText() OVERRIDE; |
| 66 virtual string16 GetMatchCountText(); | 68 virtual string16 GetMatchCountText() OVERRIDE; |
| 67 virtual int GetWidth(); | 69 virtual int GetWidth() OVERRIDE; |
| 68 | 70 |
| 69 // Overridden from content::NotificationObserver: | 71 // Overridden from content::NotificationObserver: |
| 70 virtual void Observe(int type, | 72 virtual void Observe(int type, |
| 71 const content::NotificationSource& source, | 73 const content::NotificationSource& source, |
| 72 const content::NotificationDetails& details); | 74 const content::NotificationDetails& details) OVERRIDE; |
| 73 | 75 |
| 74 private: | 76 private: |
| 75 void InitWidgets(); | 77 void InitWidgets(); |
| 76 | 78 |
| 77 // Store the currently focused widget if it is not in the find bar. | 79 // Store the currently focused widget if it is not in the find bar. |
| 78 // This should always be called before we claim focus. | 80 // This should always be called before we claim focus. |
| 79 void StoreOutsideFocus(); | 81 void StoreOutsideFocus(); |
| 80 | 82 |
| 81 // For certain keystrokes, such as up or down, we want to forward the event | 83 // For certain keystrokes, such as up or down, we want to forward the event |
| 82 // to the renderer rather than handling it ourselves. Returns true if the | 84 // to the renderer rather than handling it ourselves. Returns true if the |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 // The selection rect we are currently showing. We cache it to avoid covering | 234 // The selection rect we are currently showing. We cache it to avoid covering |
| 233 // it up. | 235 // it up. |
| 234 gfx::Rect selection_rect_; | 236 gfx::Rect selection_rect_; |
| 235 | 237 |
| 236 content::NotificationRegistrar registrar_; | 238 content::NotificationRegistrar registrar_; |
| 237 | 239 |
| 238 DISALLOW_COPY_AND_ASSIGN(FindBarGtk); | 240 DISALLOW_COPY_AND_ASSIGN(FindBarGtk); |
| 239 }; | 241 }; |
| 240 | 242 |
| 241 #endif // CHROME_BROWSER_UI_GTK_FIND_BAR_GTK_H_ | 243 #endif // CHROME_BROWSER_UI_GTK_FIND_BAR_GTK_H_ |
| OLD | NEW |