| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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_GTK_LOCATION_BAR_VIEW_GTK_H_ | 5 #ifndef CHROME_BROWSER_GTK_LOCATION_BAR_VIEW_GTK_H_ |
| 6 #define CHROME_BROWSER_GTK_LOCATION_BAR_VIEW_GTK_H_ | 6 #define CHROME_BROWSER_GTK_LOCATION_BAR_VIEW_GTK_H_ |
| 7 | 7 |
| 8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 #include "chrome/common/notification_registrar.h" | 21 #include "chrome/common/notification_registrar.h" |
| 22 #include "chrome/common/owned_widget_gtk.h" | 22 #include "chrome/common/owned_widget_gtk.h" |
| 23 #include "chrome/common/page_transition_types.h" | 23 #include "chrome/common/page_transition_types.h" |
| 24 #include "third_party/skia/include/core/SkBitmap.h" | 24 #include "third_party/skia/include/core/SkBitmap.h" |
| 25 #include "webkit/glue/window_open_disposition.h" | 25 #include "webkit/glue/window_open_disposition.h" |
| 26 | 26 |
| 27 class AutocompleteEditViewGtk; | 27 class AutocompleteEditViewGtk; |
| 28 class BubblePositioner; | 28 class BubblePositioner; |
| 29 class Browser; | 29 class Browser; |
| 30 class CommandUpdater; | 30 class CommandUpdater; |
| 31 class ExtensionAction2; | 31 class ExtensionAction; |
| 32 class GtkThemeProvider; | 32 class GtkThemeProvider; |
| 33 class Profile; | 33 class Profile; |
| 34 class SkBitmap; | 34 class SkBitmap; |
| 35 class TabContents; | 35 class TabContents; |
| 36 class ToolbarModel; | 36 class ToolbarModel; |
| 37 | 37 |
| 38 class LocationBarViewGtk : public AutocompleteEditController, | 38 class LocationBarViewGtk : public AutocompleteEditController, |
| 39 public LocationBar, | 39 public LocationBar, |
| 40 public LocationBarTesting, | 40 public LocationBarTesting, |
| 41 public NotificationObserver { | 41 public NotificationObserver { |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 | 99 |
| 100 // Translation between a security level and the background color. Both the | 100 // Translation between a security level and the background color. Both the |
| 101 // location bar and edit have to manage and match the background color. | 101 // location bar and edit have to manage and match the background color. |
| 102 static const GdkColor kBackgroundColorByLevel[3]; | 102 static const GdkColor kBackgroundColorByLevel[3]; |
| 103 | 103 |
| 104 private: | 104 private: |
| 105 class PageActionViewGtk : public ImageLoadingTracker::Observer { | 105 class PageActionViewGtk : public ImageLoadingTracker::Observer { |
| 106 public: | 106 public: |
| 107 PageActionViewGtk( | 107 PageActionViewGtk( |
| 108 LocationBarViewGtk* owner, Profile* profile, | 108 LocationBarViewGtk* owner, Profile* profile, |
| 109 ExtensionAction2* page_action); | 109 ExtensionAction* page_action); |
| 110 virtual ~PageActionViewGtk(); | 110 virtual ~PageActionViewGtk(); |
| 111 | 111 |
| 112 GtkWidget* widget() { return event_box_.get(); } | 112 GtkWidget* widget() { return event_box_.get(); } |
| 113 | 113 |
| 114 // Called to notify the PageAction that it should determine whether to be | 114 // Called to notify the PageAction that it should determine whether to be |
| 115 // visible or hidden. |contents| is the TabContents that is active, |url| | 115 // visible or hidden. |contents| is the TabContents that is active, |url| |
| 116 // is the current page URL. | 116 // is the current page URL. |
| 117 void UpdateVisibility(TabContents* contents, GURL url); | 117 void UpdateVisibility(TabContents* contents, GURL url); |
| 118 | 118 |
| 119 // A callback from ImageLoadingTracker for when the image has loaded. | 119 // A callback from ImageLoadingTracker for when the image has loaded. |
| 120 virtual void OnImageLoaded(SkBitmap* image, size_t index); | 120 virtual void OnImageLoaded(SkBitmap* image, size_t index); |
| 121 | 121 |
| 122 private: | 122 private: |
| 123 static gboolean OnButtonPressed(GtkWidget* sender, GdkEventButton* event, | 123 static gboolean OnButtonPressed(GtkWidget* sender, GdkEventButton* event, |
| 124 PageActionViewGtk* page_action_view); | 124 PageActionViewGtk* page_action_view); |
| 125 static gboolean OnExposeEvent(GtkWidget* widget, | 125 static gboolean OnExposeEvent(GtkWidget* widget, |
| 126 GdkEventExpose* event, | 126 GdkEventExpose* event, |
| 127 PageActionViewGtk* page_action_view); | 127 PageActionViewGtk* page_action_view); |
| 128 | 128 |
| 129 // The location bar view that owns us. | 129 // The location bar view that owns us. |
| 130 LocationBarViewGtk* owner_; | 130 LocationBarViewGtk* owner_; |
| 131 | 131 |
| 132 // The current profile (not owned by us). | 132 // The current profile (not owned by us). |
| 133 Profile* profile_; | 133 Profile* profile_; |
| 134 | 134 |
| 135 // The PageAction that this view represents. The PageAction is not owned by | 135 // The PageAction that this view represents. The PageAction is not owned by |
| 136 // us, it resides in the extension of this particular profile. | 136 // us, it resides in the extension of this particular profile. |
| 137 ExtensionAction2* page_action_; | 137 ExtensionAction* page_action_; |
| 138 | 138 |
| 139 // A cache of all the different icon paths associated with this page action. | 139 // A cache of all the different icon paths associated with this page action. |
| 140 typedef std::map<std::string, GdkPixbuf*> PixbufMap; | 140 typedef std::map<std::string, GdkPixbuf*> PixbufMap; |
| 141 PixbufMap pixbufs_; | 141 PixbufMap pixbufs_; |
| 142 | 142 |
| 143 // A cache of the last dynamically generated bitmap and the pixbuf that | 143 // A cache of the last dynamically generated bitmap and the pixbuf that |
| 144 // corresponds to it. We keep track of both so we can free old pixbufs as | 144 // corresponds to it. We keep track of both so we can free old pixbufs as |
| 145 // their icons are replaced. | 145 // their icons are replaced. |
| 146 SkBitmap last_icon_skbitmap_; | 146 SkBitmap last_icon_skbitmap_; |
| 147 GdkPixbuf* last_icon_pixbuf_; | 147 GdkPixbuf* last_icon_pixbuf_; |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 | 246 |
| 247 // Provides colors and rendering mode. | 247 // Provides colors and rendering mode. |
| 248 GtkThemeProvider* theme_provider_; | 248 GtkThemeProvider* theme_provider_; |
| 249 | 249 |
| 250 NotificationRegistrar registrar_; | 250 NotificationRegistrar registrar_; |
| 251 | 251 |
| 252 DISALLOW_COPY_AND_ASSIGN(LocationBarViewGtk); | 252 DISALLOW_COPY_AND_ASSIGN(LocationBarViewGtk); |
| 253 }; | 253 }; |
| 254 | 254 |
| 255 #endif // CHROME_BROWSER_GTK_LOCATION_BAR_VIEW_GTK_H_ | 255 #endif // CHROME_BROWSER_GTK_LOCATION_BAR_VIEW_GTK_H_ |
| OLD | NEW |