OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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" | 17 #include "chrome/browser/ui/gtk/gtk_theme_service.h" |
18 #include "chrome/browser/ui/gtk/gtk_util.h" | 18 #include "chrome/browser/ui/gtk/gtk_util.h" |
19 #include "chrome/common/content_settings.h" | 19 #include "chrome/common/content_settings.h" |
20 #include "content/browser/tab_contents/tab_contents.h" | 20 #include "content/browser/tab_contents/tab_contents.h" |
| 21 #include "content/common/content_notification_types.h" |
21 #include "content/common/notification_source.h" | 22 #include "content/common/notification_source.h" |
22 #include "content/common/notification_type.h" | |
23 #include "grit/generated_resources.h" | 23 #include "grit/generated_resources.h" |
24 #include "grit/ui_resources.h" | 24 #include "grit/ui_resources.h" |
25 #include "ui/base/l10n/l10n_util.h" | 25 #include "ui/base/l10n/l10n_util.h" |
26 #include "ui/base/text/text_elider.h" | 26 #include "ui/base/text/text_elider.h" |
27 #include "ui/gfx/gtk_util.h" | 27 #include "ui/gfx/gtk_util.h" |
28 #include "webkit/plugins/npapi/plugin_list.h" | 28 #include "webkit/plugins/npapi/plugin_list.h" |
29 | 29 |
30 namespace { | 30 namespace { |
31 | 31 |
32 // Padding between content and edge of bubble. | 32 // Padding between content and edge of bubble. |
(...skipping 18 matching lines...) Expand all Loading... |
51 BubbleDelegateGtk* delegate, | 51 BubbleDelegateGtk* delegate, |
52 ContentSettingBubbleModel* content_setting_bubble_model, | 52 ContentSettingBubbleModel* content_setting_bubble_model, |
53 Profile* profile, | 53 Profile* profile, |
54 TabContents* tab_contents) | 54 TabContents* tab_contents) |
55 : anchor_(anchor), | 55 : anchor_(anchor), |
56 profile_(profile), | 56 profile_(profile), |
57 tab_contents_(tab_contents), | 57 tab_contents_(tab_contents), |
58 delegate_(delegate), | 58 delegate_(delegate), |
59 content_setting_bubble_model_(content_setting_bubble_model), | 59 content_setting_bubble_model_(content_setting_bubble_model), |
60 bubble_(NULL) { | 60 bubble_(NULL) { |
61 registrar_.Add(this, NotificationType::TAB_CONTENTS_DESTROYED, | 61 registrar_.Add(this, content::NOTIFICATION_TAB_CONTENTS_DESTROYED, |
62 Source<TabContents>(tab_contents)); | 62 Source<TabContents>(tab_contents)); |
63 BuildBubble(); | 63 BuildBubble(); |
64 } | 64 } |
65 | 65 |
66 ContentSettingBubbleGtk::~ContentSettingBubbleGtk() { | 66 ContentSettingBubbleGtk::~ContentSettingBubbleGtk() { |
67 } | 67 } |
68 | 68 |
69 void ContentSettingBubbleGtk::Close() { | 69 void ContentSettingBubbleGtk::Close() { |
70 if (bubble_) | 70 if (bubble_) |
71 bubble_->Close(); | 71 bubble_->Close(); |
72 } | 72 } |
73 | 73 |
74 void ContentSettingBubbleGtk::BubbleClosing(BubbleGtk* bubble, | 74 void ContentSettingBubbleGtk::BubbleClosing(BubbleGtk* bubble, |
75 bool closed_by_escape) { | 75 bool closed_by_escape) { |
76 delegate_->BubbleClosing(bubble, closed_by_escape); | 76 delegate_->BubbleClosing(bubble, closed_by_escape); |
77 delete this; | 77 delete this; |
78 } | 78 } |
79 | 79 |
80 void ContentSettingBubbleGtk::Observe(NotificationType type, | 80 void ContentSettingBubbleGtk::Observe(int type, |
81 const NotificationSource& source, | 81 const NotificationSource& source, |
82 const NotificationDetails& details) { | 82 const NotificationDetails& details) { |
83 DCHECK(type == NotificationType::TAB_CONTENTS_DESTROYED); | 83 DCHECK(type == content::NOTIFICATION_TAB_CONTENTS_DESTROYED); |
84 DCHECK(source == Source<TabContents>(tab_contents_)); | 84 DCHECK(source == Source<TabContents>(tab_contents_)); |
85 tab_contents_ = NULL; | 85 tab_contents_ = NULL; |
86 } | 86 } |
87 | 87 |
88 void ContentSettingBubbleGtk::BuildBubble() { | 88 void ContentSettingBubbleGtk::BuildBubble() { |
89 GtkThemeService* theme_provider = GtkThemeService::GetFrom(profile_); | 89 GtkThemeService* theme_provider = GtkThemeService::GetFrom(profile_); |
90 | 90 |
91 GtkWidget* bubble_content = gtk_vbox_new(FALSE, gtk_util::kControlSpacing); | 91 GtkWidget* bubble_content = gtk_vbox_new(FALSE, gtk_util::kControlSpacing); |
92 gtk_container_set_border_width(GTK_CONTAINER(bubble_content), kContentBorder); | 92 gtk_container_set_border_width(GTK_CONTAINER(bubble_content), kContentBorder); |
93 | 93 |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 | 301 |
302 void ContentSettingBubbleGtk::OnCustomLinkClicked(GtkWidget* button) { | 302 void ContentSettingBubbleGtk::OnCustomLinkClicked(GtkWidget* button) { |
303 content_setting_bubble_model_->OnCustomLinkClicked(); | 303 content_setting_bubble_model_->OnCustomLinkClicked(); |
304 Close(); | 304 Close(); |
305 } | 305 } |
306 | 306 |
307 void ContentSettingBubbleGtk::OnManageLinkClicked(GtkWidget* button) { | 307 void ContentSettingBubbleGtk::OnManageLinkClicked(GtkWidget* button) { |
308 content_setting_bubble_model_->OnManageLinkClicked(); | 308 content_setting_bubble_model_->OnManageLinkClicked(); |
309 Close(); | 309 Close(); |
310 } | 310 } |
OLD | NEW |