| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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_WEBSITE_SETTINGS_WEBSITE_SETTINGS_POPUP_GTK_H_ | 5 #ifndef CHROME_BROWSER_UI_GTK_WEBSITE_SETTINGS_WEBSITE_SETTINGS_POPUP_GTK_H_ |
| 6 #define CHROME_BROWSER_UI_GTK_WEBSITE_SETTINGS_WEBSITE_SETTINGS_POPUP_GTK_H_ | 6 #define CHROME_BROWSER_UI_GTK_WEBSITE_SETTINGS_WEBSITE_SETTINGS_POPUP_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/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "base/memory/scoped_vector.h" | 13 #include "base/memory/scoped_vector.h" |
| 14 #include "chrome/browser/ui/gtk/bubble/bubble_gtk.h" | 14 #include "chrome/browser/ui/gtk/bubble/bubble_gtk.h" |
| 15 #include "chrome/browser/ui/gtk/website_settings/permission_selector_observer.h" | 15 #include "chrome/browser/ui/gtk/website_settings/permission_selector_observer.h" |
| 16 #include "chrome/browser/ui/website_settings/website_settings_ui.h" | 16 #include "chrome/browser/ui/website_settings/website_settings_ui.h" |
| 17 #include "content/public/browser/notification_observer.h" |
| 18 #include "content/public/browser/notification_registrar.h" |
| 17 | 19 |
| 18 class Browser; | 20 class Browser; |
| 21 class CustomDrawButton; |
| 19 class GtkThemeService; | 22 class GtkThemeService; |
| 20 class GURL; | 23 class GURL; |
| 21 class PermissionSelector; | 24 class PermissionSelector; |
| 22 class Profile; | 25 class Profile; |
| 23 class TabContents; | 26 class TabContents; |
| 24 class WebsiteSettings; | 27 class WebsiteSettings; |
| 25 | 28 |
| 26 namespace content { | 29 namespace content { |
| 27 struct SSLStatus; | 30 struct SSLStatus; |
| 28 } | 31 } |
| 29 | 32 |
| 30 // GTK implementation of the website settings UI. | 33 // GTK implementation of the website settings UI. |
| 31 class WebsiteSettingsPopupGtk : public WebsiteSettingsUI, | 34 class WebsiteSettingsPopupGtk : public WebsiteSettingsUI, |
| 32 public PermissionSelectorObserver, | 35 public PermissionSelectorObserver, |
| 33 public BubbleDelegateGtk { | 36 public BubbleDelegateGtk, |
| 37 public content::NotificationObserver { |
| 34 public: | 38 public: |
| 35 // Creates a |WebsiteSettingsPopupGtk| and displays the UI. The |url| | 39 // Creates a |WebsiteSettingsPopupGtk| and displays the UI. The |url| |
| 36 // contains the omnibox URL of the currently active tab, |parent| contains | 40 // contains the omnibox URL of the currently active tab, |parent| contains |
| 37 // the currently active window, |profile| contains the currently active | 41 // the currently active window, |profile| contains the currently active |
| 38 // profile and |ssl| contains the |SSLStatus| of the connection to the | 42 // profile and |ssl| contains the |SSLStatus| of the connection to the |
| 39 // website in the currently active tab that is wrapped by the | 43 // website in the currently active tab that is wrapped by the |
| 40 // |tab_contents|. | 44 // |tab_contents|. |
| 41 static void Show(gfx::NativeWindow parent, | 45 static void Show(gfx::NativeWindow parent, |
| 42 Profile* profile, | 46 Profile* profile, |
| 43 TabContents* tab_contents, | 47 TabContents* tab_contents, |
| 44 const GURL& url, | 48 const GURL& url, |
| 45 const content::SSLStatus& ssl); | 49 const content::SSLStatus& ssl); |
| 46 | 50 |
| 51 virtual ~WebsiteSettingsPopupGtk(); |
| 52 |
| 47 private: | 53 private: |
| 48 WebsiteSettingsPopupGtk(gfx::NativeWindow parent, | 54 WebsiteSettingsPopupGtk(gfx::NativeWindow parent, |
| 49 Profile* profile, | 55 Profile* profile, |
| 50 TabContents* tab_contents, | 56 TabContents* tab_contents, |
| 51 const GURL& url, | 57 const GURL& url, |
| 52 const content::SSLStatus& ssl); | 58 const content::SSLStatus& ssl); |
| 53 | 59 |
| 54 // WebsiteSettingsUI implementations. | 60 // WebsiteSettingsUI implementations. |
| 55 virtual void SetCookieInfo(const CookieInfoList& cookie_info_list) OVERRIDE; | 61 virtual void SetCookieInfo(const CookieInfoList& cookie_info_list) OVERRIDE; |
| 56 virtual void SetPermissionInfo( | 62 virtual void SetPermissionInfo( |
| 57 const PermissionInfoList& permission_info_list) OVERRIDE; | 63 const PermissionInfoList& permission_info_list) OVERRIDE; |
| 58 virtual void SetIdentityInfo(const IdentityInfo& identity_info) OVERRIDE; | 64 virtual void SetIdentityInfo(const IdentityInfo& identity_info) OVERRIDE; |
| 59 virtual void SetFirstVisit(const string16& first_visit) OVERRIDE; | 65 virtual void SetFirstVisit(const string16& first_visit) OVERRIDE; |
| 60 virtual void SetSelectedTab(WebsiteSettingsUI::TabId tab_id) OVERRIDE; | 66 virtual void SetSelectedTab(WebsiteSettingsUI::TabId tab_id) OVERRIDE; |
| 61 | 67 |
| 62 // PermissionSelectorObserver implementations. | 68 // PermissionSelectorObserver implementations. |
| 63 virtual void OnPermissionChanged(PermissionSelector* selector) OVERRIDE; | 69 virtual void OnPermissionChanged(PermissionSelector* selector) OVERRIDE; |
| 64 virtual void OnComboboxShown() OVERRIDE; | 70 virtual void OnComboboxShown() OVERRIDE; |
| 65 | 71 |
| 66 // BubbleDelegateGtk implementation. | 72 // BubbleDelegateGtk implementation. |
| 67 virtual void BubbleClosing(BubbleGtk* bubble, bool closed_by_escape) OVERRIDE; | 73 virtual void BubbleClosing(BubbleGtk* bubble, bool closed_by_escape) OVERRIDE; |
| 68 | 74 |
| 69 virtual ~WebsiteSettingsPopupGtk(); | 75 // content::NotificationObserver implementation. |
| 76 virtual void Observe(int type, |
| 77 const content::NotificationSource& source, |
| 78 const content::NotificationDetails& details) OVERRIDE; |
| 70 | 79 |
| 71 // Layouts the different sections retrieved from the model. | 80 // Layouts the different sections retrieved from the model. |
| 72 void InitContents(); | 81 void InitContents(); |
| 73 | 82 |
| 83 // Creates a tab for the tabstrip with label indicated by |ids|. This tab |
| 84 // is not used in GTK theme mode. |
| 85 GtkWidget* BuildTab(int ids); |
| 86 |
| 87 // Gives the index in the notebook for the given tab widget. |
| 88 int TabstripButtonToTabIndex(GtkWidget* tab); |
| 89 |
| 74 // Callbacks for the link buttons. | 90 // Callbacks for the link buttons. |
| 91 CHROMEGTK_CALLBACK_1(WebsiteSettingsPopupGtk, gboolean, |
| 92 OnTabButtonPress, GdkEvent*); |
| 93 CHROMEGTK_CALLBACK_1(WebsiteSettingsPopupGtk, gboolean, |
| 94 OnTabExpose, GdkEventExpose*); |
| 95 CHROMEGTK_CALLBACK_1(WebsiteSettingsPopupGtk, gboolean, |
| 96 OnTabstripExpose, GdkEventExpose*); |
| 75 CHROMEGTK_CALLBACK_0(WebsiteSettingsPopupGtk, void, OnCookiesLinkClicked); | 97 CHROMEGTK_CALLBACK_0(WebsiteSettingsPopupGtk, void, OnCookiesLinkClicked); |
| 76 CHROMEGTK_CALLBACK_0(WebsiteSettingsPopupGtk, void, OnViewCertLinkClicked); | 98 CHROMEGTK_CALLBACK_0(WebsiteSettingsPopupGtk, void, OnViewCertLinkClicked); |
| 77 CHROMEGTK_CALLBACK_0(WebsiteSettingsPopupGtk, void, OnCloseButtonClicked); | 99 CHROMEGTK_CALLBACK_0(WebsiteSettingsPopupGtk, void, OnCloseButtonClicked); |
| 78 CHROMEGTK_CALLBACK_0(WebsiteSettingsPopupGtk, void, OnHelpLinkClicked); | 100 CHROMEGTK_CALLBACK_0(WebsiteSettingsPopupGtk, void, OnHelpLinkClicked); |
| 79 | 101 |
| 80 // Parent window. | 102 // Parent window. |
| 81 GtkWindow* parent_; | 103 GtkWindow* parent_; |
| 82 | 104 |
| 83 // The container that contains the content of the popup. | 105 // The container that contains the content of the popup. |
| 84 GtkWidget* contents_; | 106 GtkWidget* contents_; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 100 // settings page in a new tab. | 122 // settings page in a new tab. |
| 101 Browser* browser_; | 123 Browser* browser_; |
| 102 | 124 |
| 103 // For secure connection |cert_id_| is set to the ID of the server | 125 // For secure connection |cert_id_| is set to the ID of the server |
| 104 // certificate. For non secure connections |cert_id_| is 0. | 126 // certificate. For non secure connections |cert_id_| is 0. |
| 105 int cert_id_; | 127 int cert_id_; |
| 106 | 128 |
| 107 // Container for the popup header content. | 129 // Container for the popup header content. |
| 108 GtkWidget* header_box_; | 130 GtkWidget* header_box_; |
| 109 | 131 |
| 132 // Close button for the bubble. |
| 133 scoped_ptr<CustomDrawButton> close_button_; |
| 134 |
| 110 // Container for the cookies and site data section content. | 135 // Container for the cookies and site data section content. |
| 111 GtkWidget* cookies_section_contents_; | 136 GtkWidget* cookies_section_contents_; |
| 112 | 137 |
| 113 // Container for the permissions section content. | 138 // Container for the permissions section content. |
| 114 GtkWidget* permissions_section_contents_; | 139 GtkWidget* permissions_section_contents_; |
| 115 | 140 |
| 116 // Container for the remote host (website) identity section of the connection | 141 // Container for the remote host (website) identity section of the connection |
| 117 // tab. | 142 // tab. |
| 118 GtkWidget* identity_contents_; | 143 GtkWidget* identity_contents_; |
| 119 | 144 |
| 120 // Container for the connection section of the connection tab. | 145 // Container for the connection section of the connection tab. |
| 121 GtkWidget* connection_contents_; | 146 GtkWidget* connection_contents_; |
| 122 | 147 |
| 123 // Container for the information about the first visit date of the website. | 148 // Container for the information about the first visit date of the website. |
| 124 GtkWidget* first_visit_contents_; | 149 GtkWidget* first_visit_contents_; |
| 125 | 150 |
| 151 // The widget that wraps the tabstrip. |
| 152 GtkWidget* tabstrip_alignment_; |
| 153 |
| 126 // The widget that contains the tabs display on the popup. | 154 // The widget that contains the tabs display on the popup. |
| 127 GtkWidget* notebook_; | 155 GtkWidget* notebook_; |
| 128 | 156 |
| 129 // The UI translates user actions to specific events and forwards them to the | 157 // The UI translates user actions to specific events and forwards them to the |
| 130 // |presenter_|. The |presenter_| handles these events and updates the UI. | 158 // |presenter_|. The |presenter_| handles these events and updates the UI. |
| 131 scoped_ptr<WebsiteSettings> presenter_; | 159 scoped_ptr<WebsiteSettings> presenter_; |
| 132 | 160 |
| 133 // The permission selectors that allow the user to change individual | 161 // The permission selectors that allow the user to change individual |
| 134 // permissions. | 162 // permissions. |
| 135 ScopedVector<PermissionSelector> selectors_; | 163 ScopedVector<PermissionSelector> selectors_; |
| 136 | 164 |
| 165 content::NotificationRegistrar registrar_; |
| 166 |
| 137 DISALLOW_COPY_AND_ASSIGN(WebsiteSettingsPopupGtk); | 167 DISALLOW_COPY_AND_ASSIGN(WebsiteSettingsPopupGtk); |
| 138 }; | 168 }; |
| 139 | 169 |
| 140 #endif // CHROME_BROWSER_UI_GTK_WEBSITE_SETTINGS_WEBSITE_SETTINGS_POPUP_GTK_H_ | 170 #endif // CHROME_BROWSER_UI_GTK_WEBSITE_SETTINGS_WEBSITE_SETTINGS_POPUP_GTK_H_ |
| OLD | NEW |