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/views/content_setting_bubble_contents.h" | 5 #include "chrome/browser/ui/views/content_setting_bubble_contents.h" |
6 | 6 |
7 #if defined(TOOLKIT_USES_GTK) | 7 #if defined(TOOLKIT_USES_GTK) |
8 #include <gdk/gdk.h> | 8 #include <gdk/gdk.h> |
9 #endif | 9 #endif |
10 | 10 |
11 #include "base/utf_string_conversions.h" | 11 #include "base/utf_string_conversions.h" |
12 #include "chrome/browser/content_settings/host_content_settings_map.h" | 12 #include "chrome/browser/content_settings/host_content_settings_map.h" |
13 #include "chrome/browser/plugin_updater.h" | 13 #include "chrome/browser/plugin_updater.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/views/browser_dialogs.h" | 16 #include "chrome/browser/ui/views/browser_dialogs.h" |
17 #include "chrome/browser/ui/views/bubble/bubble.h" | 17 #include "chrome/browser/ui/views/bubble/bubble.h" |
18 #include "content/browser/tab_contents/tab_contents.h" | 18 #include "content/browser/tab_contents/tab_contents.h" |
| 19 #include "content/common/content_notification_types.h" |
19 #include "content/common/notification_source.h" | 20 #include "content/common/notification_source.h" |
20 #include "content/common/notification_type.h" | |
21 #include "grit/generated_resources.h" | 21 #include "grit/generated_resources.h" |
22 #include "ui/base/l10n/l10n_util.h" | 22 #include "ui/base/l10n/l10n_util.h" |
23 #include "views/controls/button/radio_button.h" | 23 #include "views/controls/button/radio_button.h" |
24 #include "views/controls/button/text_button.h" | 24 #include "views/controls/button/text_button.h" |
25 #include "views/controls/image_view.h" | 25 #include "views/controls/image_view.h" |
26 #include "views/controls/label.h" | 26 #include "views/controls/label.h" |
27 #include "views/controls/link.h" | 27 #include "views/controls/link.h" |
28 #include "views/controls/separator.h" | 28 #include "views/controls/separator.h" |
29 #include "views/layout/grid_layout.h" | 29 #include "views/layout/grid_layout.h" |
30 #include "views/layout/layout_constants.h" | 30 #include "views/layout/layout_constants.h" |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 ContentSettingBubbleModel* content_setting_bubble_model, | 98 ContentSettingBubbleModel* content_setting_bubble_model, |
99 Profile* profile, | 99 Profile* profile, |
100 TabContents* tab_contents) | 100 TabContents* tab_contents) |
101 : content_setting_bubble_model_(content_setting_bubble_model), | 101 : content_setting_bubble_model_(content_setting_bubble_model), |
102 profile_(profile), | 102 profile_(profile), |
103 tab_contents_(tab_contents), | 103 tab_contents_(tab_contents), |
104 bubble_(NULL), | 104 bubble_(NULL), |
105 custom_link_(NULL), | 105 custom_link_(NULL), |
106 manage_link_(NULL), | 106 manage_link_(NULL), |
107 close_button_(NULL) { | 107 close_button_(NULL) { |
108 registrar_.Add(this, NotificationType::TAB_CONTENTS_DESTROYED, | 108 registrar_.Add(this, content::NOTIFICATION_TAB_CONTENTS_DESTROYED, |
109 Source<TabContents>(tab_contents)); | 109 Source<TabContents>(tab_contents)); |
110 } | 110 } |
111 | 111 |
112 ContentSettingBubbleContents::~ContentSettingBubbleContents() { | 112 ContentSettingBubbleContents::~ContentSettingBubbleContents() { |
113 } | 113 } |
114 | 114 |
115 gfx::Size ContentSettingBubbleContents::GetPreferredSize() { | 115 gfx::Size ContentSettingBubbleContents::GetPreferredSize() { |
116 gfx::Size preferred_size(views::View::GetPreferredSize()); | 116 gfx::Size preferred_size(views::View::GetPreferredSize()); |
117 int preferred_width = | 117 int preferred_width = |
118 (!content_setting_bubble_model_->bubble_content().domain_lists.empty() && | 118 (!content_setting_bubble_model_->bubble_content().domain_lists.empty() && |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 // CAREFUL: Showing the settings window activates it, which deactivates the | 161 // CAREFUL: Showing the settings window activates it, which deactivates the |
162 // info bubble, which causes it to close, which deletes us. | 162 // info bubble, which causes it to close, which deletes us. |
163 return; | 163 return; |
164 } | 164 } |
165 | 165 |
166 PopupLinks::const_iterator i(popup_links_.find(source)); | 166 PopupLinks::const_iterator i(popup_links_.find(source)); |
167 DCHECK(i != popup_links_.end()); | 167 DCHECK(i != popup_links_.end()); |
168 content_setting_bubble_model_->OnPopupClicked(i->second); | 168 content_setting_bubble_model_->OnPopupClicked(i->second); |
169 } | 169 } |
170 | 170 |
171 void ContentSettingBubbleContents::Observe(NotificationType type, | 171 void ContentSettingBubbleContents::Observe(int type, |
172 const NotificationSource& source, | 172 const NotificationSource& source, |
173 const NotificationDetails& details) { | 173 const NotificationDetails& details) { |
174 DCHECK(type == NotificationType::TAB_CONTENTS_DESTROYED); | 174 DCHECK(type == content::NOTIFICATION_TAB_CONTENTS_DESTROYED); |
175 DCHECK(source == Source<TabContents>(tab_contents_)); | 175 DCHECK(source == Source<TabContents>(tab_contents_)); |
176 tab_contents_ = NULL; | 176 tab_contents_ = NULL; |
177 } | 177 } |
178 | 178 |
179 void ContentSettingBubbleContents::InitControlLayout() { | 179 void ContentSettingBubbleContents::InitControlLayout() { |
180 using views::GridLayout; | 180 using views::GridLayout; |
181 | 181 |
182 GridLayout* layout = new views::GridLayout(this); | 182 GridLayout* layout = new views::GridLayout(this); |
183 SetLayoutManager(layout); | 183 SetLayoutManager(layout); |
184 | 184 |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
323 layout->StartRow(0, double_column_set_id); | 323 layout->StartRow(0, double_column_set_id); |
324 manage_link_ = new views::Link(UTF8ToWide(bubble_content.manage_link)); | 324 manage_link_ = new views::Link(UTF8ToWide(bubble_content.manage_link)); |
325 manage_link_->set_listener(this); | 325 manage_link_->set_listener(this); |
326 layout->AddView(manage_link_); | 326 layout->AddView(manage_link_); |
327 | 327 |
328 close_button_ = | 328 close_button_ = |
329 new views::NativeTextButton(this, | 329 new views::NativeTextButton(this, |
330 UTF16ToWide(l10n_util::GetStringUTF16(IDS_DONE))); | 330 UTF16ToWide(l10n_util::GetStringUTF16(IDS_DONE))); |
331 layout->AddView(close_button_); | 331 layout->AddView(close_button_); |
332 } | 332 } |
OLD | NEW |