Chromium Code Reviews| 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 |
|
markusheintz_
2012/09/19 16:44:44
nit: pls rm the empty line
Evan Stade
2012/09/20 08:55:01
Done.
| |
| 51 | |
| 47 private: | 52 private: |
| 48 WebsiteSettingsPopupGtk(gfx::NativeWindow parent, | 53 WebsiteSettingsPopupGtk(gfx::NativeWindow parent, |
| 49 Profile* profile, | 54 Profile* profile, |
| 50 TabContents* tab_contents, | 55 TabContents* tab_contents, |
| 51 const GURL& url, | 56 const GURL& url, |
| 52 const content::SSLStatus& ssl); | 57 const content::SSLStatus& ssl); |
| 53 | 58 |
| 59 virtual ~WebsiteSettingsPopupGtk(); | |
| 60 | |
| 54 // WebsiteSettingsUI implementations. | 61 // WebsiteSettingsUI implementations. |
| 55 virtual void SetCookieInfo(const CookieInfoList& cookie_info_list) OVERRIDE; | 62 virtual void SetCookieInfo(const CookieInfoList& cookie_info_list) OVERRIDE; |
| 56 virtual void SetPermissionInfo( | 63 virtual void SetPermissionInfo( |
| 57 const PermissionInfoList& permission_info_list) OVERRIDE; | 64 const PermissionInfoList& permission_info_list) OVERRIDE; |
| 58 virtual void SetIdentityInfo(const IdentityInfo& identity_info) OVERRIDE; | 65 virtual void SetIdentityInfo(const IdentityInfo& identity_info) OVERRIDE; |
| 59 virtual void SetFirstVisit(const string16& first_visit) OVERRIDE; | 66 virtual void SetFirstVisit(const string16& first_visit) OVERRIDE; |
| 60 virtual void SetSelectedTab(WebsiteSettingsUI::TabId tab_id) OVERRIDE; | 67 virtual void SetSelectedTab(WebsiteSettingsUI::TabId tab_id) OVERRIDE; |
| 61 | 68 |
| 62 // PermissionSelectorObserver implementations. | 69 // PermissionSelectorObserver implementations. |
| 63 virtual void OnPermissionChanged(PermissionSelector* selector) OVERRIDE; | 70 virtual void OnPermissionChanged(PermissionSelector* selector) OVERRIDE; |
| 64 virtual void OnComboboxShown() OVERRIDE; | 71 virtual void OnComboboxShown() OVERRIDE; |
| 65 | 72 |
| 66 // BubbleDelegateGtk implementation. | 73 // BubbleDelegateGtk implementation. |
| 67 virtual void BubbleClosing(BubbleGtk* bubble, bool closed_by_escape) OVERRIDE; | 74 virtual void BubbleClosing(BubbleGtk* bubble, bool closed_by_escape) OVERRIDE; |
| 68 | 75 |
| 69 virtual ~WebsiteSettingsPopupGtk(); | 76 // content::NotificationObserver implementation. |
| 77 virtual void Observe(int type, | |
| 78 const content::NotificationSource& source, | |
| 79 const content::NotificationDetails& details) OVERRIDE; | |
| 70 | 80 |
| 71 // Layouts the different sections retrieved from the model. | 81 // Layouts the different sections retrieved from the model. |
| 72 void InitContents(); | 82 void InitContents(); |
| 73 | 83 |
| 84 // Creates a tab for the tabstrip with label indicated by |ids|. This tab | |
| 85 // is not used in GTK theme mode. | |
| 86 GtkWidget* BuildTab(int ids); | |
| 87 | |
| 88 // Gives the index in the notebook for the given tab widget. | |
| 89 int TabstripButtonToTabIndex(GtkWidget* tab); | |
| 90 | |
| 74 // Callbacks for the link buttons. | 91 // Callbacks for the link buttons. |
| 92 CHROMEGTK_CALLBACK_1(WebsiteSettingsPopupGtk, gboolean, | |
| 93 OnTabButtonPress, GdkEvent*); | |
| 94 CHROMEGTK_CALLBACK_1(WebsiteSettingsPopupGtk, gboolean, | |
| 95 OnTabExpose, GdkEventExpose*); | |
| 96 CHROMEGTK_CALLBACK_1(WebsiteSettingsPopupGtk, gboolean, | |
| 97 OnTabstripExpose, GdkEventExpose*); | |
| 75 CHROMEGTK_CALLBACK_0(WebsiteSettingsPopupGtk, void, OnCookiesLinkClicked); | 98 CHROMEGTK_CALLBACK_0(WebsiteSettingsPopupGtk, void, OnCookiesLinkClicked); |
| 76 CHROMEGTK_CALLBACK_0(WebsiteSettingsPopupGtk, void, OnViewCertLinkClicked); | 99 CHROMEGTK_CALLBACK_0(WebsiteSettingsPopupGtk, void, OnViewCertLinkClicked); |
| 77 CHROMEGTK_CALLBACK_0(WebsiteSettingsPopupGtk, void, OnCloseButtonClicked); | 100 CHROMEGTK_CALLBACK_0(WebsiteSettingsPopupGtk, void, OnCloseButtonClicked); |
| 78 CHROMEGTK_CALLBACK_0(WebsiteSettingsPopupGtk, void, OnHelpLinkClicked); | 101 CHROMEGTK_CALLBACK_0(WebsiteSettingsPopupGtk, void, OnHelpLinkClicked); |
| 79 | 102 |
| 80 // Parent window. | 103 // Parent window. |
| 81 GtkWindow* parent_; | 104 GtkWindow* parent_; |
| 82 | 105 |
| 83 // The container that contains the content of the popup. | 106 // The container that contains the content of the popup. |
| 84 GtkWidget* contents_; | 107 GtkWidget* contents_; |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 100 // settings page in a new tab. | 123 // settings page in a new tab. |
| 101 Browser* browser_; | 124 Browser* browser_; |
| 102 | 125 |
| 103 // For secure connection |cert_id_| is set to the ID of the server | 126 // For secure connection |cert_id_| is set to the ID of the server |
| 104 // certificate. For non secure connections |cert_id_| is 0. | 127 // certificate. For non secure connections |cert_id_| is 0. |
| 105 int cert_id_; | 128 int cert_id_; |
| 106 | 129 |
| 107 // Container for the popup header content. | 130 // Container for the popup header content. |
| 108 GtkWidget* header_box_; | 131 GtkWidget* header_box_; |
| 109 | 132 |
| 133 // Close button for the bubble. | |
| 134 scoped_ptr<CustomDrawButton> close_button_; | |
| 135 | |
| 110 // Container for the cookies and site data section content. | 136 // Container for the cookies and site data section content. |
| 111 GtkWidget* cookies_section_contents_; | 137 GtkWidget* cookies_section_contents_; |
| 112 | 138 |
| 113 // Container for the permissions section content. | 139 // Container for the permissions section content. |
| 114 GtkWidget* permissions_section_contents_; | 140 GtkWidget* permissions_section_contents_; |
| 115 | 141 |
| 116 // Container for the remote host (website) identity section of the connection | 142 // Container for the remote host (website) identity section of the connection |
| 117 // tab. | 143 // tab. |
| 118 GtkWidget* identity_contents_; | 144 GtkWidget* identity_contents_; |
| 119 | 145 |
| 120 // Container for the connection section of the connection tab. | 146 // Container for the connection section of the connection tab. |
| 121 GtkWidget* connection_contents_; | 147 GtkWidget* connection_contents_; |
| 122 | 148 |
| 123 // Container for the information about the first visit date of the website. | 149 // Container for the information about the first visit date of the website. |
| 124 GtkWidget* first_visit_contents_; | 150 GtkWidget* first_visit_contents_; |
| 125 | 151 |
| 152 // The widget that wraps the tabstrip. | |
| 153 GtkWidget* tabstrip_alignment_; | |
| 154 | |
| 126 // The widget that contains the tabs display on the popup. | 155 // The widget that contains the tabs display on the popup. |
| 127 GtkWidget* notebook_; | 156 GtkWidget* notebook_; |
| 128 | 157 |
| 129 // The UI translates user actions to specific events and forwards them to the | 158 // The UI translates user actions to specific events and forwards them to the |
| 130 // |presenter_|. The |presenter_| handles these events and updates the UI. | 159 // |presenter_|. The |presenter_| handles these events and updates the UI. |
| 131 scoped_ptr<WebsiteSettings> presenter_; | 160 scoped_ptr<WebsiteSettings> presenter_; |
| 132 | 161 |
| 133 // The permission selectors that allow the user to change individual | 162 // The permission selectors that allow the user to change individual |
| 134 // permissions. | 163 // permissions. |
| 135 ScopedVector<PermissionSelector> selectors_; | 164 ScopedVector<PermissionSelector> selectors_; |
| 136 | 165 |
| 166 content::NotificationRegistrar registrar_; | |
| 167 | |
| 137 DISALLOW_COPY_AND_ASSIGN(WebsiteSettingsPopupGtk); | 168 DISALLOW_COPY_AND_ASSIGN(WebsiteSettingsPopupGtk); |
| 138 }; | 169 }; |
| 139 | 170 |
| 140 #endif // CHROME_BROWSER_UI_GTK_WEBSITE_SETTINGS_WEBSITE_SETTINGS_POPUP_GTK_H_ | 171 #endif // CHROME_BROWSER_UI_GTK_WEBSITE_SETTINGS_WEBSITE_SETTINGS_POPUP_GTK_H_ |
| OLD | NEW |