| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_UI_GTK_WEBSITE_SETTINGS_POPUP_GTK_H_ | |
| 6 #define CHROME_BROWSER_UI_GTK_WEBSITE_SETTINGS_POPUP_GTK_H_ | |
| 7 | |
| 8 #include <gtk/gtk.h> | |
| 9 | |
| 10 #include "base/basictypes.h" | |
| 11 #include "base/compiler_specific.h" | |
| 12 #include "base/memory/scoped_ptr.h" | |
| 13 #include "chrome/browser/ui/gtk/bubble/bubble_gtk.h" | |
| 14 #include "chrome/browser/ui/website_settings/website_settings_ui.h" | |
| 15 | |
| 16 class Browser; | |
| 17 class GtkThemeService; | |
| 18 class GURL; | |
| 19 class Profile; | |
| 20 class TabContents; | |
| 21 class WebsiteSettings; | |
| 22 | |
| 23 namespace content { | |
| 24 struct SSLStatus; | |
| 25 } | |
| 26 | |
| 27 // GTK implementation of the website settings UI. | |
| 28 class WebsiteSettingsPopupGtk : public WebsiteSettingsUI, | |
| 29 public BubbleDelegateGtk { | |
| 30 public: | |
| 31 // Creates a |WebsiteSettingsPopupGtk| and displays the UI. The |url| | |
| 32 // contains the omnibox URL of the currently active tab, |parent| contains | |
| 33 // the currently active window, |profile| contains the currently active | |
| 34 // profile and |ssl| contains the |SSLStatus| of the connection to the | |
| 35 // website in the currently active tab that is wrapped by the | |
| 36 // |tab_contents|. | |
| 37 static void Show(gfx::NativeWindow parent, | |
| 38 Profile* profile, | |
| 39 TabContents* tab_contents, | |
| 40 const GURL& url, | |
| 41 const content::SSLStatus& ssl); | |
| 42 | |
| 43 private: | |
| 44 WebsiteSettingsPopupGtk(gfx::NativeWindow parent, | |
| 45 Profile* profile, | |
| 46 TabContents* tab_contents, | |
| 47 const GURL& url, | |
| 48 const content::SSLStatus& ssl); | |
| 49 | |
| 50 // WebsiteSettingsUI implementations. | |
| 51 virtual void SetCookieInfo(const CookieInfoList& cookie_info_list) OVERRIDE; | |
| 52 virtual void SetPermissionInfo( | |
| 53 const PermissionInfoList& permission_info_list) OVERRIDE; | |
| 54 virtual void SetIdentityInfo(const IdentityInfo& identity_info) OVERRIDE; | |
| 55 virtual void SetFirstVisit(const string16& first_visit) OVERRIDE; | |
| 56 | |
| 57 // BubbleDelegateGtk implementation. | |
| 58 virtual void BubbleClosing(BubbleGtk* bubble, bool closed_by_escape) OVERRIDE; | |
| 59 | |
| 60 | |
| 61 virtual ~WebsiteSettingsPopupGtk(); | |
| 62 | |
| 63 // Layouts the different sections retrieved from the model. | |
| 64 void InitContents(); | |
| 65 | |
| 66 // Removes all children of |container|. | |
| 67 void ClearContainer(GtkWidget* container); | |
| 68 | |
| 69 // Creates a label that contains the given |text| and has the given |width|. | |
| 70 GtkWidget* CreateTextLabel(const std::string& text, int width); | |
| 71 | |
| 72 // Creates a popup section and returns a virtual box that contains the | |
| 73 // section content. | |
| 74 GtkWidget* CreateSection(std::string section_title, | |
| 75 GtkWidget* section_content); | |
| 76 | |
| 77 // Callbacks for the link buttons. | |
| 78 CHROMEGTK_CALLBACK_0(WebsiteSettingsPopupGtk, void, OnCookiesLinkClicked); | |
| 79 CHROMEGTK_CALLBACK_0(WebsiteSettingsPopupGtk, void, OnPermissionChanged); | |
| 80 CHROMEGTK_CALLBACK_0(WebsiteSettingsPopupGtk, void, | |
| 81 OnPermissionsSettingsLinkClicked); | |
| 82 CHROMEGTK_CALLBACK_1(WebsiteSettingsPopupGtk, void, OnComboBoxShown, | |
| 83 GParamSpec*); | |
| 84 CHROMEGTK_CALLBACK_0(WebsiteSettingsPopupGtk, void, OnViewCertLinkClicked); | |
| 85 | |
| 86 // Parent window. | |
| 87 GtkWindow* parent_; | |
| 88 | |
| 89 // The container that contains the content of the popup. | |
| 90 GtkWidget* contents_; | |
| 91 | |
| 92 // The widget relative to which the popup is positioned. | |
| 93 GtkWidget* anchor_; | |
| 94 | |
| 95 // Provides colors and stuff. | |
| 96 GtkThemeService* theme_service_; | |
| 97 | |
| 98 // The popup bubble container. | |
| 99 BubbleGtk* bubble_; | |
| 100 | |
| 101 Profile* profile_; | |
| 102 | |
| 103 TabContents* tab_contents_; | |
| 104 | |
| 105 // The browser object of the current window. This is needed to open the | |
| 106 // settings page in a new tab. | |
| 107 Browser* browser_; | |
| 108 | |
| 109 // For secure connection |cert_id_| is set to the ID of the server | |
| 110 // certificate. For non secure connections |cert_id_| is 0. | |
| 111 int cert_id_; | |
| 112 | |
| 113 // Container for the popup header content. | |
| 114 GtkWidget* header_box_; | |
| 115 | |
| 116 // Container for the cookies and site data section content. | |
| 117 GtkWidget* cookies_section_contents_; | |
| 118 | |
| 119 // Container for the permissions section content. | |
| 120 GtkWidget* permissions_section_contents_; | |
| 121 | |
| 122 // Container for the identity tab content. | |
| 123 GtkWidget* identity_tab_contents_; | |
| 124 | |
| 125 // Container for the information about the first visit date of the website. | |
| 126 GtkWidget* first_visit_contents_; | |
| 127 | |
| 128 // The UI translates user actions to specific events and forwards them to the | |
| 129 // |presenter_|. The |presenter_| handles these events and updates the UI. | |
| 130 scoped_ptr<WebsiteSettings> presenter_; | |
| 131 | |
| 132 DISALLOW_COPY_AND_ASSIGN(WebsiteSettingsPopupGtk); | |
| 133 }; | |
| 134 | |
| 135 #endif // CHROME_BROWSER_UI_GTK_WEBSITE_SETTINGS_POPUP_GTK_H_ | |
| OLD | NEW |