| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this |
| 2 // source code is governed by a BSD-style license that can be found in the | 2 // source code is governed by a BSD-style license that can be found in the |
| 3 // LICENSE file. | 3 // LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_GTK_BLOCKED_POPUP_CONTAINER_VIEW_GTK_H_ | 5 #ifndef CHROME_BROWSER_GTK_BLOCKED_POPUP_CONTAINER_VIEW_GTK_H_ |
| 6 #define CHROME_BROWSER_GTK_BLOCKED_POPUP_CONTAINER_VIEW_GTK_H_ | 6 #define CHROME_BROWSER_GTK_BLOCKED_POPUP_CONTAINER_VIEW_GTK_H_ |
| 7 | 7 |
| 8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/scoped_ptr.h" | 11 #include "base/scoped_ptr.h" |
| 12 #include "chrome/browser/blocked_popup_container.h" | 12 #include "chrome/browser/blocked_popup_container.h" |
| 13 #include "chrome/browser/gtk/menu_gtk.h" | 13 #include "chrome/browser/gtk/menu_gtk.h" |
| 14 #include "chrome/common/owned_widget_gtk.h" | 14 #include "chrome/common/owned_widget_gtk.h" |
| 15 | 15 |
| 16 class BlockedPopupContainerInternalView; | 16 class BlockedPopupContainerInternalView; |
| 17 class CustomDrawButton; | 17 class CustomDrawButton; |
| 18 class GtkThemeProperties; |
| 18 class MenuGtk; | 19 class MenuGtk; |
| 19 class PrefService; | 20 class PrefService; |
| 20 class Profile; | 21 class Profile; |
| 21 class TabContents; | 22 class TabContents; |
| 22 class TabContentsViewGtk; | 23 class TabContentsViewGtk; |
| 23 class TextButton; | 24 class TextButton; |
| 24 | 25 |
| 25 namespace views { | 26 namespace views { |
| 26 class ImageButton; | 27 class ImageButton; |
| 27 } | 28 } |
| 28 | 29 |
| 29 // The GTK blocked popup container notification. | 30 // The GTK blocked popup container notification. |
| 30 class BlockedPopupContainerViewGtk : public BlockedPopupContainerView, | 31 class BlockedPopupContainerViewGtk : public BlockedPopupContainerView, |
| 31 public MenuGtk::Delegate { | 32 public MenuGtk::Delegate { |
| 32 public: | 33 public: |
| 33 virtual ~BlockedPopupContainerViewGtk(); | 34 virtual ~BlockedPopupContainerViewGtk(); |
| 34 | 35 |
| 35 // Returns the Gtk view that currently owns us. | 36 // Returns the Gtk view that currently owns us. |
| 36 TabContentsViewGtk* ContainingView(); | 37 TabContentsViewGtk* ContainingView(); |
| 37 | 38 |
| 38 // Returns the URL and title for popup |index|, used to construct a string for | 39 // Returns the URL and title for popup |index|, used to construct a string for |
| 39 // display. | 40 // display. |
| 40 void GetURLAndTitleForPopup(size_t index, | 41 void GetURLAndTitleForPopup(size_t index, |
| 41 string16* url, | 42 string16* url, |
| 42 string16* title) const; | 43 string16* title) const; |
| 43 | 44 |
| 45 // Notification that the theme has changed at that we should detect new |
| 46 // values. |
| 47 void UserChangedTheme(GtkThemeProperties* properties); |
| 48 |
| 44 GtkWidget* widget() { return container_.get(); } | 49 GtkWidget* widget() { return container_.get(); } |
| 45 | 50 |
| 46 // Overridden from BlockedPopupContainerView: | 51 // Overridden from BlockedPopupContainerView: |
| 47 virtual void SetPosition(); | 52 virtual void SetPosition(); |
| 48 virtual void ShowView(); | 53 virtual void ShowView(); |
| 49 virtual void UpdateLabel(); | 54 virtual void UpdateLabel(); |
| 50 virtual void HideView(); | 55 virtual void HideView(); |
| 51 virtual void Destroy(); | 56 virtual void Destroy(); |
| 52 | 57 |
| 53 // Overridden from MenuGtk::Delegate: | 58 // Overridden from MenuGtk::Delegate: |
| (...skipping 11 matching lines...) Expand all Loading... |
| 65 // Builds all the messy GTK stuff. | 70 // Builds all the messy GTK stuff. |
| 66 void Init(); | 71 void Init(); |
| 67 | 72 |
| 68 // Callbacks for the two buttons in the notification | 73 // Callbacks for the two buttons in the notification |
| 69 static void OnMenuButtonClicked(GtkButton *button, | 74 static void OnMenuButtonClicked(GtkButton *button, |
| 70 BlockedPopupContainerViewGtk* container); | 75 BlockedPopupContainerViewGtk* container); |
| 71 static void OnCloseButtonClicked(GtkButton *button, | 76 static void OnCloseButtonClicked(GtkButton *button, |
| 72 BlockedPopupContainerViewGtk* container); | 77 BlockedPopupContainerViewGtk* container); |
| 73 | 78 |
| 74 // Draws |container_| with a custom background. | 79 // Draws |container_| with a custom background. |
| 75 static gboolean OnContainerExpose(GtkWidget* widget, GdkEventExpose* event); | 80 static gboolean OnContainerExpose(GtkWidget* widget, GdkEventExpose* event, |
| 81 BlockedPopupContainerViewGtk* container); |
| 76 | 82 |
| 77 // Our model; calling the shots. | 83 // Our model; calling the shots. |
| 78 BlockedPopupContainer* model_; | 84 BlockedPopupContainer* model_; |
| 79 | 85 |
| 80 // The top level of our local GTK hierarchy. | 86 // The top level of our local GTK hierarchy. |
| 81 OwnedWidgetGtk container_; | 87 OwnedWidgetGtk container_; |
| 82 | 88 |
| 83 // The "Blocked Popups: XXX" button. | 89 // The "Blocked Popups: XXX" button. |
| 84 GtkWidget* menu_button_; | 90 GtkWidget* menu_button_; |
| 85 | 91 |
| 92 // Whether we should let GTK paint the background and the button decorations. |
| 93 bool use_gtk_rendering_; |
| 94 |
| 86 // Closes the container. | 95 // Closes the container. |
| 87 scoped_ptr<CustomDrawButton> close_button_; | 96 scoped_ptr<CustomDrawButton> close_button_; |
| 88 | 97 |
| 89 // The popup menu with options to launch blocked popups. | 98 // The popup menu with options to launch blocked popups. |
| 90 scoped_ptr<MenuGtk> launch_menu_; | 99 scoped_ptr<MenuGtk> launch_menu_; |
| 91 | 100 |
| 92 DISALLOW_COPY_AND_ASSIGN(BlockedPopupContainerViewGtk); | 101 DISALLOW_COPY_AND_ASSIGN(BlockedPopupContainerViewGtk); |
| 93 }; | 102 }; |
| 94 | 103 |
| 95 #endif // CHROME_BROWSER_GTK_BLOCKED_POPUP_CONTAINER_VIEW_GTK_H_ | 104 #endif // CHROME_BROWSER_GTK_BLOCKED_POPUP_CONTAINER_VIEW_GTK_H_ |
| OLD | NEW |