OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #include "chrome/browser/gtk/options/content_filter_page_gtk.h" | 5 #include "chrome/browser/gtk/options/content_filter_page_gtk.h" |
6 | 6 |
7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
8 #include "chrome/browser/browser.h" | 8 #include "chrome/browser/browser.h" |
9 #include "chrome/browser/geolocation/geolocation_content_settings_map.h" | 9 #include "chrome/browser/geolocation/geolocation_content_settings_map.h" |
10 #include "chrome/browser/geolocation/geolocation_exceptions_table_model.h" | 10 #include "chrome/browser/geolocation/geolocation_exceptions_table_model.h" |
11 #include "chrome/browser/host_content_settings_map.h" | 11 #include "chrome/browser/host_content_settings_map.h" |
12 #include "chrome/browser/profile.h" | 12 #include "chrome/browser/profile.h" |
13 #include "chrome/browser/gtk/browser_window_gtk.h" | 13 #include "chrome/browser/gtk/browser_window_gtk.h" |
14 #include "chrome/browser/gtk/gtk_chrome_link_button.h" | 14 #include "chrome/browser/gtk/gtk_chrome_link_button.h" |
15 #include "chrome/browser/gtk/gtk_util.h" | 15 #include "chrome/browser/gtk/gtk_util.h" |
16 #include "chrome/browser/gtk/options/content_exceptions_window_gtk.h" | 16 #include "chrome/browser/gtk/options/content_exceptions_window_gtk.h" |
17 #include "chrome/browser/gtk/options/simple_content_exceptions_window.h" | 17 #include "chrome/browser/gtk/options/simple_content_exceptions_window.h" |
18 #include "chrome/browser/gtk/options/options_layout_gtk.h" | |
19 #include "chrome/browser/notifications/desktop_notification_service.h" | 18 #include "chrome/browser/notifications/desktop_notification_service.h" |
20 #include "chrome/browser/notifications/notification_exceptions_table_model.h" | 19 #include "chrome/browser/notifications/notification_exceptions_table_model.h" |
21 #include "chrome/common/pref_names.h" | 20 #include "chrome/common/pref_names.h" |
22 #include "chrome/common/url_constants.h" | 21 #include "chrome/common/url_constants.h" |
23 #include "grit/generated_resources.h" | 22 #include "grit/generated_resources.h" |
24 #include "grit/locale_settings.h" | 23 #include "grit/locale_settings.h" |
25 | 24 |
26 ContentFilterPageGtk::ContentFilterPageGtk(Profile* profile, | 25 ContentFilterPageGtk::ContentFilterPageGtk(Profile* profile, |
27 ContentSettingsType content_type) | 26 ContentSettingsType content_type) |
28 : OptionsPageBase(profile), | 27 : OptionsPageBase(profile), |
29 content_type_(content_type), | 28 content_type_(content_type), |
30 ask_radio_(NULL) { | 29 ask_radio_(NULL) { |
31 static const int kTitleIDs[] = { | 30 static const int kTitleIDs[] = { |
32 0, // This dialog isn't used for cookies. | 31 0, // This dialog isn't used for cookies. |
33 IDS_IMAGES_SETTING_LABEL, | 32 IDS_IMAGES_SETTING_LABEL, |
34 IDS_JS_SETTING_LABEL, | 33 IDS_JS_SETTING_LABEL, |
35 IDS_PLUGIN_SETTING_LABEL, | 34 IDS_PLUGIN_SETTING_LABEL, |
36 IDS_POPUP_SETTING_LABEL, | 35 IDS_POPUP_SETTING_LABEL, |
37 IDS_GEOLOCATION_SETTING_LABEL, | 36 IDS_GEOLOCATION_SETTING_LABEL, |
38 IDS_NOTIFICATIONS_SETTING_LABEL, | 37 IDS_NOTIFICATIONS_SETTING_LABEL, |
39 }; | 38 }; |
40 COMPILE_ASSERT(arraysize(kTitleIDs) == CONTENT_SETTINGS_NUM_TYPES, | 39 COMPILE_ASSERT(arraysize(kTitleIDs) == CONTENT_SETTINGS_NUM_TYPES, |
41 kTitleIDs_IncorrectSize); | 40 kTitleIDs_IncorrectSize); |
42 | 41 |
43 scoped_ptr<OptionsLayoutBuilderGtk> | 42 GtkWidget* title_label = gtk_util::CreateBoldLabel( |
44 options_builder(OptionsLayoutBuilderGtk::Create()); | 43 l10n_util::GetStringUTF8(kTitleIDs[content_type_])); |
45 options_builder->AddOptionGroup( | 44 page_ = gtk_vbox_new(FALSE, gtk_util::kControlSpacing); |
46 l10n_util::GetStringUTF8(kTitleIDs[content_type_]), | 45 gtk_box_pack_start(GTK_BOX(page_), title_label, FALSE, FALSE, 0); |
47 InitGroup(), true); | 46 gtk_container_add(GTK_CONTAINER(page_), InitGroup()); |
48 page_ = options_builder->get_page_widget(); | |
49 } | 47 } |
50 | 48 |
51 ContentFilterPageGtk::~ContentFilterPageGtk() { | 49 ContentFilterPageGtk::~ContentFilterPageGtk() { |
52 } | 50 } |
53 | 51 |
54 | 52 |
55 GtkWidget* ContentFilterPageGtk::InitGroup() { | 53 GtkWidget* ContentFilterPageGtk::InitGroup() { |
56 GtkWidget* vbox = gtk_vbox_new(FALSE, gtk_util::kControlSpacing); | 54 GtkWidget* vbox = gtk_vbox_new(FALSE, gtk_util::kControlSpacing); |
57 | 55 |
58 static const int kAllowIDs[] = { | 56 static const int kAllowIDs[] = { |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 } | 211 } |
214 | 212 |
215 void ContentFilterPageGtk::OnPluginsPageLinkClicked(GtkWidget* button) { | 213 void ContentFilterPageGtk::OnPluginsPageLinkClicked(GtkWidget* button) { |
216 // We open a new browser window so the Options dialog doesn't get lost | 214 // We open a new browser window so the Options dialog doesn't get lost |
217 // behind other windows. | 215 // behind other windows. |
218 Browser* browser = Browser::Create(profile()); | 216 Browser* browser = Browser::Create(profile()); |
219 browser->OpenURL(GURL(chrome::kChromeUIPluginsURL), | 217 browser->OpenURL(GURL(chrome::kChromeUIPluginsURL), |
220 GURL(), NEW_FOREGROUND_TAB, PageTransition::LINK); | 218 GURL(), NEW_FOREGROUND_TAB, PageTransition::LINK); |
221 browser->window()->Show(); | 219 browser->window()->Show(); |
222 } | 220 } |
OLD | NEW |