| 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_OMNIBOX_OMNIBOX_POPUP_VIEW_GTK_H_ | 5 #ifndef CHROME_BROWSER_UI_GTK_OMNIBOX_OMNIBOX_POPUP_VIEW_GTK_H_ |
| 6 #define CHROME_BROWSER_UI_GTK_OMNIBOX_OMNIBOX_POPUP_VIEW_GTK_H_ | 6 #define CHROME_BROWSER_UI_GTK_OMNIBOX_OMNIBOX_POPUP_VIEW_GTK_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <gtk/gtk.h> | 9 #include <gtk/gtk.h> |
| 10 | 10 |
| 11 #include <map> | 11 #include <map> |
| 12 #include <string> | 12 #include <string> |
| 13 | 13 |
| 14 #include "base/basictypes.h" | 14 #include "base/basictypes.h" |
| 15 #include "base/compiler_specific.h" |
| 15 #include "base/memory/scoped_ptr.h" | 16 #include "base/memory/scoped_ptr.h" |
| 16 #include "chrome/browser/autocomplete/autocomplete_match.h" | 17 #include "chrome/browser/autocomplete/autocomplete_match.h" |
| 17 #include "chrome/browser/autocomplete/autocomplete_popup_view.h" | 18 #include "chrome/browser/autocomplete/autocomplete_popup_view.h" |
| 18 #include "content/public/browser/notification_observer.h" | 19 #include "content/public/browser/notification_observer.h" |
| 19 #include "content/public/browser/notification_registrar.h" | 20 #include "content/public/browser/notification_registrar.h" |
| 20 #include "ui/base/gtk/gtk_signal.h" | 21 #include "ui/base/gtk/gtk_signal.h" |
| 21 #include "ui/gfx/font.h" | 22 #include "ui/gfx/font.h" |
| 22 #include "webkit/glue/window_open_disposition.h" | 23 #include "webkit/glue/window_open_disposition.h" |
| 23 | 24 |
| 24 class AutocompleteEditModel; | 25 class AutocompleteEditModel; |
| 25 class AutocompletePopupModel; | 26 class AutocompletePopupModel; |
| 26 class GtkThemeService; | 27 class GtkThemeService; |
| 27 class OmniboxView; | 28 class OmniboxView; |
| 28 class SkBitmap; | 29 class SkBitmap; |
| 29 | 30 |
| 30 class OmniboxPopupViewGtk : public AutocompletePopupView, | 31 class OmniboxPopupViewGtk : public AutocompletePopupView, |
| 31 public content::NotificationObserver { | 32 public content::NotificationObserver { |
| 32 public: | 33 public: |
| 33 OmniboxPopupViewGtk(const gfx::Font& font, | 34 OmniboxPopupViewGtk(const gfx::Font& font, |
| 34 OmniboxView* omnibox_view, | 35 OmniboxView* omnibox_view, |
| 35 AutocompleteEditModel* edit_model, | 36 AutocompleteEditModel* edit_model, |
| 36 GtkWidget* location_bar); | 37 GtkWidget* location_bar); |
| 37 virtual ~OmniboxPopupViewGtk(); | 38 virtual ~OmniboxPopupViewGtk(); |
| 38 | 39 |
| 39 // Overridden from AutocompletePopupView: | 40 // Overridden from AutocompletePopupView: |
| 40 virtual bool IsOpen() const; | 41 virtual bool IsOpen() const OVERRIDE; |
| 41 virtual void InvalidateLine(size_t line); | 42 virtual void InvalidateLine(size_t line) OVERRIDE; |
| 42 virtual void UpdatePopupAppearance(); | 43 virtual void UpdatePopupAppearance() OVERRIDE; |
| 43 virtual gfx::Rect GetTargetBounds(); | 44 virtual gfx::Rect GetTargetBounds() OVERRIDE; |
| 44 virtual void PaintUpdatesNow(); | 45 virtual void PaintUpdatesNow() OVERRIDE; |
| 45 virtual void OnDragCanceled(); | 46 virtual void OnDragCanceled() OVERRIDE; |
| 46 | 47 |
| 47 // Overridden from content::NotificationObserver: | 48 // Overridden from content::NotificationObserver: |
| 48 virtual void Observe(int type, | 49 virtual void Observe(int type, |
| 49 const content::NotificationSource& source, | 50 const content::NotificationSource& source, |
| 50 const content::NotificationDetails& details); | 51 const content::NotificationDetails& details) OVERRIDE; |
| 51 | 52 |
| 52 private: | 53 private: |
| 53 // Be friendly for unit tests. | 54 // Be friendly for unit tests. |
| 54 friend class OmniboxPopupViewGtkTest; | 55 friend class OmniboxPopupViewGtkTest; |
| 55 | 56 |
| 56 static void SetupLayoutForMatch( | 57 static void SetupLayoutForMatch( |
| 57 PangoLayout* layout, | 58 PangoLayout* layout, |
| 58 const string16& text, | 59 const string16& text, |
| 59 const AutocompleteMatch::ACMatchClassifications& classifications, | 60 const AutocompleteMatch::ACMatchClassifications& classifications, |
| 60 const GdkColor* base_color, | 61 const GdkColor* base_color, |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 // erroneously ignore the next drag. | 132 // erroneously ignore the next drag. |
| 132 bool ignore_mouse_drag_; | 133 bool ignore_mouse_drag_; |
| 133 | 134 |
| 134 // Whether our popup is currently open / shown, or closed / hidden. | 135 // Whether our popup is currently open / shown, or closed / hidden. |
| 135 bool opened_; | 136 bool opened_; |
| 136 | 137 |
| 137 DISALLOW_COPY_AND_ASSIGN(OmniboxPopupViewGtk); | 138 DISALLOW_COPY_AND_ASSIGN(OmniboxPopupViewGtk); |
| 138 }; | 139 }; |
| 139 | 140 |
| 140 #endif // CHROME_BROWSER_UI_GTK_OMNIBOX_OMNIBOX_POPUP_VIEW_GTK_H_ | 141 #endif // CHROME_BROWSER_UI_GTK_OMNIBOX_OMNIBOX_POPUP_VIEW_GTK_H_ |
| OLD | NEW |