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_POPUP_GTK_H_ | 5 #ifndef CHROME_BROWSER_UI_GTK_WEBSITE_SETTINGS_WEBSITE_SETTINGS_POPUP_GTK_H_ |
6 #define CHROME_BROWSER_UI_GTK_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 "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" |
14 #include "chrome/browser/ui/website_settings/website_settings_ui.h" | 16 #include "chrome/browser/ui/website_settings/website_settings_ui.h" |
15 | 17 |
16 class Browser; | 18 class Browser; |
17 class GtkThemeService; | 19 class GtkThemeService; |
18 class GURL; | 20 class GURL; |
| 21 class PermissionSelector; |
19 class Profile; | 22 class Profile; |
20 class TabContents; | 23 class TabContents; |
21 class WebsiteSettings; | 24 class WebsiteSettings; |
22 | 25 |
23 namespace content { | 26 namespace content { |
24 struct SSLStatus; | 27 struct SSLStatus; |
25 } | 28 } |
26 | 29 |
27 // GTK implementation of the website settings UI. | 30 // GTK implementation of the website settings UI. |
28 class WebsiteSettingsPopupGtk : public WebsiteSettingsUI, | 31 class WebsiteSettingsPopupGtk : public WebsiteSettingsUI, |
| 32 public PermissionSelectorObserver, |
29 public BubbleDelegateGtk { | 33 public BubbleDelegateGtk { |
30 public: | 34 public: |
31 // Creates a |WebsiteSettingsPopupGtk| and displays the UI. The |url| | 35 // Creates a |WebsiteSettingsPopupGtk| and displays the UI. The |url| |
32 // contains the omnibox URL of the currently active tab, |parent| contains | 36 // contains the omnibox URL of the currently active tab, |parent| contains |
33 // the currently active window, |profile| contains the currently active | 37 // the currently active window, |profile| contains the currently active |
34 // profile and |ssl| contains the |SSLStatus| of the connection to the | 38 // profile and |ssl| contains the |SSLStatus| of the connection to the |
35 // website in the currently active tab that is wrapped by the | 39 // website in the currently active tab that is wrapped by the |
36 // |tab_contents|. | 40 // |tab_contents|. |
37 static void Show(gfx::NativeWindow parent, | 41 static void Show(gfx::NativeWindow parent, |
38 Profile* profile, | 42 Profile* profile, |
39 TabContents* tab_contents, | 43 TabContents* tab_contents, |
40 const GURL& url, | 44 const GURL& url, |
41 const content::SSLStatus& ssl); | 45 const content::SSLStatus& ssl); |
42 | 46 |
43 private: | 47 private: |
44 WebsiteSettingsPopupGtk(gfx::NativeWindow parent, | 48 WebsiteSettingsPopupGtk(gfx::NativeWindow parent, |
45 Profile* profile, | 49 Profile* profile, |
46 TabContents* tab_contents, | 50 TabContents* tab_contents, |
47 const GURL& url, | 51 const GURL& url, |
48 const content::SSLStatus& ssl); | 52 const content::SSLStatus& ssl); |
49 | 53 |
50 // WebsiteSettingsUI implementations. | 54 // WebsiteSettingsUI implementations. |
51 virtual void SetCookieInfo(const CookieInfoList& cookie_info_list) OVERRIDE; | 55 virtual void SetCookieInfo(const CookieInfoList& cookie_info_list) OVERRIDE; |
52 virtual void SetPermissionInfo( | 56 virtual void SetPermissionInfo( |
53 const PermissionInfoList& permission_info_list) OVERRIDE; | 57 const PermissionInfoList& permission_info_list) OVERRIDE; |
54 virtual void SetIdentityInfo(const IdentityInfo& identity_info) OVERRIDE; | 58 virtual void SetIdentityInfo(const IdentityInfo& identity_info) OVERRIDE; |
55 virtual void SetFirstVisit(const string16& first_visit) OVERRIDE; | 59 virtual void SetFirstVisit(const string16& first_visit) OVERRIDE; |
56 | 60 |
| 61 // PermissionSelectorObserver implementations. |
| 62 virtual void OnPermissionChanged(PermissionSelector* selector) OVERRIDE; |
| 63 virtual void OnComboboxShown() OVERRIDE; |
| 64 |
57 // BubbleDelegateGtk implementation. | 65 // BubbleDelegateGtk implementation. |
58 virtual void BubbleClosing(BubbleGtk* bubble, bool closed_by_escape) OVERRIDE; | 66 virtual void BubbleClosing(BubbleGtk* bubble, bool closed_by_escape) OVERRIDE; |
59 | 67 |
60 | 68 |
61 virtual ~WebsiteSettingsPopupGtk(); | 69 virtual ~WebsiteSettingsPopupGtk(); |
62 | 70 |
63 // Layouts the different sections retrieved from the model. | 71 // Layouts the different sections retrieved from the model. |
64 void InitContents(); | 72 void InitContents(); |
65 | 73 |
66 // Removes all children of |container|. | 74 // Removes all children of |container|. |
67 void ClearContainer(GtkWidget* container); | 75 void ClearContainer(GtkWidget* container); |
68 | 76 |
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 | 77 // Creates a popup section and returns a virtual box that contains the |
73 // section content. | 78 // section content. |
74 GtkWidget* CreateSection(std::string section_title, | 79 GtkWidget* CreateSection(std::string section_title, |
75 GtkWidget* section_content); | 80 GtkWidget* section_content); |
76 | 81 |
77 // Callbacks for the link buttons. | 82 // Callbacks for the link buttons. |
78 CHROMEGTK_CALLBACK_0(WebsiteSettingsPopupGtk, void, OnCookiesLinkClicked); | 83 CHROMEGTK_CALLBACK_0(WebsiteSettingsPopupGtk, void, OnCookiesLinkClicked); |
79 CHROMEGTK_CALLBACK_0(WebsiteSettingsPopupGtk, void, OnPermissionChanged); | |
80 CHROMEGTK_CALLBACK_0(WebsiteSettingsPopupGtk, void, | 84 CHROMEGTK_CALLBACK_0(WebsiteSettingsPopupGtk, void, |
81 OnPermissionsSettingsLinkClicked); | 85 OnPermissionsSettingsLinkClicked); |
82 CHROMEGTK_CALLBACK_1(WebsiteSettingsPopupGtk, void, OnComboBoxShown, | |
83 GParamSpec*); | |
84 CHROMEGTK_CALLBACK_0(WebsiteSettingsPopupGtk, void, OnViewCertLinkClicked); | 86 CHROMEGTK_CALLBACK_0(WebsiteSettingsPopupGtk, void, OnViewCertLinkClicked); |
85 | 87 |
86 // Parent window. | 88 // Parent window. |
87 GtkWindow* parent_; | 89 GtkWindow* parent_; |
88 | 90 |
89 // The container that contains the content of the popup. | 91 // The container that contains the content of the popup. |
90 GtkWidget* contents_; | 92 GtkWidget* contents_; |
91 | 93 |
92 // The widget relative to which the popup is positioned. | 94 // The widget relative to which the popup is positioned. |
93 GtkWidget* anchor_; | 95 GtkWidget* anchor_; |
(...skipping 28 matching lines...) Expand all Loading... |
122 // Container for the identity tab content. | 124 // Container for the identity tab content. |
123 GtkWidget* identity_tab_contents_; | 125 GtkWidget* identity_tab_contents_; |
124 | 126 |
125 // Container for the information about the first visit date of the website. | 127 // Container for the information about the first visit date of the website. |
126 GtkWidget* first_visit_contents_; | 128 GtkWidget* first_visit_contents_; |
127 | 129 |
128 // The UI translates user actions to specific events and forwards them to the | 130 // The UI translates user actions to specific events and forwards them to the |
129 // |presenter_|. The |presenter_| handles these events and updates the UI. | 131 // |presenter_|. The |presenter_| handles these events and updates the UI. |
130 scoped_ptr<WebsiteSettings> presenter_; | 132 scoped_ptr<WebsiteSettings> presenter_; |
131 | 133 |
| 134 // The permission selectors that allow the user to change individual |
| 135 // permissions. |
| 136 ScopedVector<PermissionSelector> selectors_; |
| 137 |
132 DISALLOW_COPY_AND_ASSIGN(WebsiteSettingsPopupGtk); | 138 DISALLOW_COPY_AND_ASSIGN(WebsiteSettingsPopupGtk); |
133 }; | 139 }; |
134 | 140 |
135 #endif // CHROME_BROWSER_UI_GTK_WEBSITE_SETTINGS_POPUP_GTK_H_ | 141 #endif // CHROME_BROWSER_UI_GTK_WEBSITE_SETTINGS_WEBSITE_SETTINGS_POPUP_GTK_H_ |
OLD | NEW |