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 <algorithm> | 11 #include <algorithm> |
12 #include <set> | 12 #include <set> |
13 #include <string> | 13 #include <string> |
14 #include <vector> | 14 #include <vector> |
15 | 15 |
16 #include "base/utf_string_conversions.h" | 16 #include "base/utf_string_conversions.h" |
17 #include "chrome/browser/content_settings/host_content_settings_map.h" | 17 #include "chrome/browser/content_settings/host_content_settings_map.h" |
18 #include "chrome/browser/profiles/profile.h" | 18 #include "chrome/browser/profiles/profile.h" |
19 #include "chrome/browser/ui/content_settings/content_setting_bubble_model.h" | 19 #include "chrome/browser/ui/content_settings/content_setting_bubble_model.h" |
20 #include "chrome/browser/ui/views/browser_dialogs.h" | 20 #include "chrome/browser/ui/views/browser_dialogs.h" |
21 #include "chrome/browser/ui/views/bubble/bubble.h" | 21 #include "chrome/browser/ui/views/bubble/bubble.h" |
| 22 #include "content/browser/plugin_service.h" |
22 #include "content/browser/tab_contents/tab_contents.h" | 23 #include "content/browser/tab_contents/tab_contents.h" |
23 #include "content/public/browser/notification_source.h" | 24 #include "content/public/browser/notification_source.h" |
24 #include "content/public/browser/notification_types.h" | 25 #include "content/public/browser/notification_types.h" |
25 #include "grit/generated_resources.h" | 26 #include "grit/generated_resources.h" |
26 #include "ui/base/l10n/l10n_util.h" | 27 #include "ui/base/l10n/l10n_util.h" |
27 #include "views/controls/button/radio_button.h" | 28 #include "views/controls/button/radio_button.h" |
28 #include "views/controls/button/text_button.h" | 29 #include "views/controls/button/text_button.h" |
29 #include "views/controls/image_view.h" | 30 #include "views/controls/image_view.h" |
30 #include "views/controls/label.h" | 31 #include "views/controls/label.h" |
31 #include "views/controls/link.h" | 32 #include "views/controls/link.h" |
32 #include "views/controls/separator.h" | 33 #include "views/controls/separator.h" |
33 #include "views/layout/grid_layout.h" | 34 #include "views/layout/grid_layout.h" |
34 #include "views/layout/layout_constants.h" | 35 #include "views/layout/layout_constants.h" |
35 #include "webkit/plugins/npapi/plugin_list.h" | |
36 | 36 |
37 #if defined(TOOLKIT_USES_GTK) | 37 #if defined(TOOLKIT_USES_GTK) |
38 #include "ui/gfx/gtk_util.h" | 38 #include "ui/gfx/gtk_util.h" |
39 #endif | 39 #endif |
40 | 40 |
41 #if defined(USE_AURA) | 41 #if defined(USE_AURA) |
42 #include "ui/aura/cursor.h" | 42 #include "ui/aura/cursor.h" |
43 #endif | 43 #endif |
44 | 44 |
45 // If we don't clamp the maximum width, then very long URLs and titles can make | 45 // If we don't clamp the maximum width, then very long URLs and titles can make |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 bubble_content_empty = false; | 210 bubble_content_empty = false; |
211 } | 211 } |
212 | 212 |
213 const std::set<std::string>& plugins = bubble_content.resource_identifiers; | 213 const std::set<std::string>& plugins = bubble_content.resource_identifiers; |
214 if (!plugins.empty()) { | 214 if (!plugins.empty()) { |
215 if (!bubble_content_empty) | 215 if (!bubble_content_empty) |
216 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); | 216 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); |
217 for (std::set<std::string>::const_iterator it = plugins.begin(); | 217 for (std::set<std::string>::const_iterator it = plugins.begin(); |
218 it != plugins.end(); ++it) { | 218 it != plugins.end(); ++it) { |
219 string16 name = | 219 string16 name = |
220 webkit::npapi::PluginList::Singleton()->GetPluginGroupName(*it); | 220 PluginService::GetInstance()->GetPluginGroupName(*it); |
221 if (name.empty()) | 221 if (name.empty()) |
222 name = UTF8ToUTF16(*it); | 222 name = UTF8ToUTF16(*it); |
223 layout->StartRow(0, single_column_set_id); | 223 layout->StartRow(0, single_column_set_id); |
224 layout->AddView(new views::Label(name)); | 224 layout->AddView(new views::Label(name)); |
225 bubble_content_empty = false; | 225 bubble_content_empty = false; |
226 } | 226 } |
227 } | 227 } |
228 | 228 |
229 if (content_setting_bubble_model_->content_type() == | 229 if (content_setting_bubble_model_->content_type() == |
230 CONTENT_SETTINGS_TYPE_POPUPS) { | 230 CONTENT_SETTINGS_TYPE_POPUPS) { |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 | 333 |
334 layout->StartRow(0, double_column_set_id); | 334 layout->StartRow(0, double_column_set_id); |
335 manage_link_ = new views::Link(UTF8ToUTF16(bubble_content.manage_link)); | 335 manage_link_ = new views::Link(UTF8ToUTF16(bubble_content.manage_link)); |
336 manage_link_->set_listener(this); | 336 manage_link_->set_listener(this); |
337 layout->AddView(manage_link_); | 337 layout->AddView(manage_link_); |
338 | 338 |
339 close_button_ = new views::NativeTextButton( | 339 close_button_ = new views::NativeTextButton( |
340 this, l10n_util::GetStringUTF16(IDS_DONE)); | 340 this, l10n_util::GetStringUTF16(IDS_DONE)); |
341 layout->AddView(close_button_); | 341 layout->AddView(close_button_); |
342 } | 342 } |
OLD | NEW |