| OLD | NEW |
| 1 // Copyright (c) 2011 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 #include "chrome/browser/ui/gtk/content_setting_bubble_gtk.h" | 5 #include "chrome/browser/ui/gtk/content_setting_bubble_gtk.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/i18n/rtl.h" | 11 #include "base/i18n/rtl.h" |
| 12 #include "base/utf_string_conversions.h" | 12 #include "base/utf_string_conversions.h" |
| 13 #include "chrome/browser/content_settings/host_content_settings_map.h" | 13 #include "chrome/browser/content_settings/host_content_settings_map.h" |
| 14 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
| 15 #include "chrome/browser/ui/content_settings/content_setting_bubble_model.h" | 15 #include "chrome/browser/ui/content_settings/content_setting_bubble_model.h" |
| 16 #include "chrome/browser/ui/gtk/gtk_chrome_link_button.h" | 16 #include "chrome/browser/ui/gtk/gtk_chrome_link_button.h" |
| 17 #include "chrome/browser/ui/gtk/gtk_theme_service.h" | |
| 18 #include "chrome/browser/ui/gtk/gtk_util.h" | 17 #include "chrome/browser/ui/gtk/gtk_util.h" |
| 18 #include "chrome/browser/ui/gtk/theme_service_gtk.h" |
| 19 #include "chrome/common/content_settings.h" | 19 #include "chrome/common/content_settings.h" |
| 20 #include "content/public/browser/notification_source.h" | 20 #include "content/public/browser/notification_source.h" |
| 21 #include "content/public/browser/notification_types.h" | 21 #include "content/public/browser/notification_types.h" |
| 22 #include "content/public/browser/plugin_service.h" | 22 #include "content/public/browser/plugin_service.h" |
| 23 #include "content/public/browser/web_contents.h" | 23 #include "content/public/browser/web_contents.h" |
| 24 #include "grit/generated_resources.h" | 24 #include "grit/generated_resources.h" |
| 25 #include "grit/ui_resources.h" | 25 #include "grit/ui_resources.h" |
| 26 #include "ui/base/gtk/gtk_hig_constants.h" | 26 #include "ui/base/gtk/gtk_hig_constants.h" |
| 27 #include "ui/base/l10n/l10n_util.h" | 27 #include "ui/base/l10n/l10n_util.h" |
| 28 #include "ui/base/text/text_elider.h" | 28 #include "ui/base/text/text_elider.h" |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 void ContentSettingBubbleGtk::Observe( | 84 void ContentSettingBubbleGtk::Observe( |
| 85 int type, | 85 int type, |
| 86 const content::NotificationSource& source, | 86 const content::NotificationSource& source, |
| 87 const content::NotificationDetails& details) { | 87 const content::NotificationDetails& details) { |
| 88 DCHECK(type == content::NOTIFICATION_WEB_CONTENTS_DESTROYED); | 88 DCHECK(type == content::NOTIFICATION_WEB_CONTENTS_DESTROYED); |
| 89 DCHECK(source == content::Source<WebContents>(web_contents_)); | 89 DCHECK(source == content::Source<WebContents>(web_contents_)); |
| 90 web_contents_ = NULL; | 90 web_contents_ = NULL; |
| 91 } | 91 } |
| 92 | 92 |
| 93 void ContentSettingBubbleGtk::BuildBubble() { | 93 void ContentSettingBubbleGtk::BuildBubble() { |
| 94 GtkThemeService* theme_provider = GtkThemeService::GetFrom(profile_); | 94 ThemeServiceGtk* theme_provider = ThemeServiceGtk::GetFrom(profile_); |
| 95 | 95 |
| 96 GtkWidget* bubble_content = gtk_vbox_new(FALSE, ui::kControlSpacing); | 96 GtkWidget* bubble_content = gtk_vbox_new(FALSE, ui::kControlSpacing); |
| 97 gtk_container_set_border_width(GTK_CONTAINER(bubble_content), kContentBorder); | 97 gtk_container_set_border_width(GTK_CONTAINER(bubble_content), kContentBorder); |
| 98 | 98 |
| 99 const ContentSettingBubbleModel::BubbleContent& content = | 99 const ContentSettingBubbleModel::BubbleContent& content = |
| 100 content_setting_bubble_model_->bubble_content(); | 100 content_setting_bubble_model_->bubble_content(); |
| 101 if (!content.title.empty()) { | 101 if (!content.title.empty()) { |
| 102 // Add the content label. | 102 // Add the content label. |
| 103 GtkWidget* label = gtk_label_new(content.title.c_str()); | 103 GtkWidget* label = gtk_label_new(content.title.c_str()); |
| 104 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); | 104 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 | 308 |
| 309 void ContentSettingBubbleGtk::OnCustomLinkClicked(GtkWidget* button) { | 309 void ContentSettingBubbleGtk::OnCustomLinkClicked(GtkWidget* button) { |
| 310 content_setting_bubble_model_->OnCustomLinkClicked(); | 310 content_setting_bubble_model_->OnCustomLinkClicked(); |
| 311 Close(); | 311 Close(); |
| 312 } | 312 } |
| 313 | 313 |
| 314 void ContentSettingBubbleGtk::OnManageLinkClicked(GtkWidget* button) { | 314 void ContentSettingBubbleGtk::OnManageLinkClicked(GtkWidget* button) { |
| 315 content_setting_bubble_model_->OnManageLinkClicked(); | 315 content_setting_bubble_model_->OnManageLinkClicked(); |
| 316 Close(); | 316 Close(); |
| 317 } | 317 } |
| OLD | NEW |