| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_GTK_BLOCKED_POPUP_CONTAINER_VIEW_GTK_H_ |
| 6 #define CHROME_BROWSER_GTK_BLOCKED_POPUP_CONTAINER_VIEW_GTK_H_ |
| 7 |
| 8 #include <gtk/gtk.h> |
| 9 |
| 10 #include <set> |
| 11 #include <utility> |
| 12 #include <vector> |
| 13 |
| 14 #include "app/slide_animation.h" |
| 15 #include "base/basictypes.h" |
| 16 #include "base/gfx/native_widget_types.h" |
| 17 #include "base/gfx/rect.h" |
| 18 #include "base/scoped_ptr.h" |
| 19 #include "base/string_util.h" |
| 20 #include "chrome/browser/blocked_popup_container.h" |
| 21 #include "chrome/browser/gtk/menu_gtk.h" |
| 22 #include "chrome/browser/tab_contents/tab_contents_delegate.h" |
| 23 #include "chrome/common/owned_widget_gtk.h" |
| 24 |
| 25 class BlockedPopupContainerInternalView; |
| 26 class CustomDrawButton; |
| 27 class MenuGtk; |
| 28 class PrefService; |
| 29 class Profile; |
| 30 class TabContents; |
| 31 class TabContentsViewGtk; |
| 32 class TextButton; |
| 33 |
| 34 namespace views { |
| 35 class ImageButton; |
| 36 } |
| 37 |
| 38 // The GTK blocked popup container notification. |
| 39 class BlockedPopupContainerViewGtk : public BlockedPopupContainerView, |
| 40 public MenuGtk::Delegate { |
| 41 public: |
| 42 virtual ~BlockedPopupContainerViewGtk(); |
| 43 |
| 44 // Returns the Gtk view that currently owns us. |
| 45 TabContentsViewGtk* ContainingView(); |
| 46 |
| 47 // Returns the URL and title for popup |index|, used to construct a string for |
| 48 // display. |
| 49 void GetURLAndTitleForPopup(size_t index, |
| 50 string16* url, |
| 51 string16* title) const; |
| 52 |
| 53 GtkWidget* widget() { return container_.get(); } |
| 54 |
| 55 // Overridden from BlockedPopupContainerView: |
| 56 virtual void SetPosition(); |
| 57 virtual void ShowView(); |
| 58 virtual void UpdateLabel(); |
| 59 virtual void HideView(); |
| 60 virtual void Destroy(); |
| 61 |
| 62 // Overridden from MenuGtk::Delegate: |
| 63 virtual bool IsCommandEnabled(int command_id) const; |
| 64 virtual bool IsItemChecked(int command_id) const; |
| 65 virtual void ExecuteCommand(int command_id); |
| 66 |
| 67 private: |
| 68 // For the static constructor BlockedPopupContainerView::Create(). |
| 69 friend class BlockedPopupContainerView; |
| 70 |
| 71 // Creates a container for a certain TabContents. |
| 72 explicit BlockedPopupContainerViewGtk(BlockedPopupContainer* container); |
| 73 |
| 74 // Builds all the messy GTK stuff. |
| 75 void Init(); |
| 76 |
| 77 // Callbacks for the two buttons in the notification |
| 78 static void OnMenuButtonClicked(GtkButton *button, |
| 79 BlockedPopupContainerViewGtk* container); |
| 80 static void OnCloseButtonClicked(GtkButton *button, |
| 81 BlockedPopupContainerViewGtk* container); |
| 82 |
| 83 // Our model; calling the shots. |
| 84 BlockedPopupContainer* model_; |
| 85 |
| 86 // The top level of our local GTK hierarchy. |
| 87 OwnedWidgetGtk container_; |
| 88 |
| 89 // The "Blocked Popups: XXX" button. |
| 90 GtkWidget* menu_button_; |
| 91 |
| 92 // Closes the container. |
| 93 scoped_ptr<CustomDrawButton> close_button_; |
| 94 |
| 95 // The popup menu with options to launch blocked popups. |
| 96 scoped_ptr<MenuGtk> launch_menu_; |
| 97 |
| 98 DISALLOW_COPY_AND_ASSIGN(BlockedPopupContainerViewGtk); |
| 99 }; |
| 100 |
| 101 #endif // CHROME_BROWSER_GTK_BLOCKED_POPUP_CONTAINER_VIEW_GTK_H_ |
| OLD | NEW |