Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(212)

Side by Side Diff: chrome/browser/ui/views/content_setting_bubble_contents.cc

Issue 7497030: PluginList cleanup (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix crash Created 9 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/cocoa/drag_util.mm ('k') | chrome/browser/ui/webui/flash_ui.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
14 #include "chrome/browser/profiles/profile.h" 13 #include "chrome/browser/profiles/profile.h"
15 #include "chrome/browser/ui/content_settings/content_setting_bubble_model.h" 14 #include "chrome/browser/ui/content_settings/content_setting_bubble_model.h"
16 #include "chrome/browser/ui/views/browser_dialogs.h" 15 #include "chrome/browser/ui/views/browser_dialogs.h"
17 #include "chrome/browser/ui/views/bubble/bubble.h" 16 #include "chrome/browser/ui/views/bubble/bubble.h"
18 #include "content/browser/tab_contents/tab_contents.h" 17 #include "content/browser/tab_contents/tab_contents.h"
19 #include "content/common/content_notification_types.h" 18 #include "content/common/content_notification_types.h"
20 #include "content/common/notification_source.h" 19 #include "content/common/notification_source.h"
21 #include "grit/generated_resources.h" 20 #include "grit/generated_resources.h"
22 #include "ui/base/l10n/l10n_util.h" 21 #include "ui/base/l10n/l10n_util.h"
23 #include "views/controls/button/radio_button.h" 22 #include "views/controls/button/radio_button.h"
24 #include "views/controls/button/text_button.h" 23 #include "views/controls/button/text_button.h"
25 #include "views/controls/image_view.h" 24 #include "views/controls/image_view.h"
26 #include "views/controls/label.h" 25 #include "views/controls/label.h"
27 #include "views/controls/link.h" 26 #include "views/controls/link.h"
28 #include "views/controls/separator.h" 27 #include "views/controls/separator.h"
29 #include "views/layout/grid_layout.h" 28 #include "views/layout/grid_layout.h"
30 #include "views/layout/layout_constants.h" 29 #include "views/layout/layout_constants.h"
31 #include "webkit/glue/plugins/plugin_list.h" 30 #include "webkit/plugins/npapi/plugin_list.h"
32 31
33 #if defined(TOOLKIT_USES_GTK) 32 #if defined(TOOLKIT_USES_GTK)
34 #include "ui/gfx/gtk_util.h" 33 #include "ui/gfx/gtk_util.h"
35 #endif 34 #endif
36 35
37 // If we don't clamp the maximum width, then very long URLs and titles can make 36 // If we don't clamp the maximum width, then very long URLs and titles can make
38 // the bubble arbitrarily wide. 37 // the bubble arbitrarily wide.
39 const int kMaxContentsWidth = 500; 38 const int kMaxContentsWidth = 500;
40 39
41 // When we have multiline labels, we should set a minimum width lest we get very 40 // When we have multiline labels, we should set a minimum width lest we get very
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 bubble_content_empty = false; 198 bubble_content_empty = false;
200 } 199 }
201 200
202 const std::set<std::string>& plugins = bubble_content.resource_identifiers; 201 const std::set<std::string>& plugins = bubble_content.resource_identifiers;
203 if (!plugins.empty()) { 202 if (!plugins.empty()) {
204 if (!bubble_content_empty) 203 if (!bubble_content_empty)
205 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); 204 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing);
206 for (std::set<std::string>::const_iterator it = plugins.begin(); 205 for (std::set<std::string>::const_iterator it = plugins.begin();
207 it != plugins.end(); ++it) { 206 it != plugins.end(); ++it) {
208 std::wstring name = UTF16ToWide( 207 std::wstring name = UTF16ToWide(
209 NPAPI::PluginList::Singleton()->GetPluginGroupName(*it)); 208 webkit::npapi::PluginList::Singleton()->GetPluginGroupName(*it));
210 if (name.empty()) 209 if (name.empty())
211 name = UTF8ToWide(*it); 210 name = UTF8ToWide(*it);
212 layout->StartRow(0, single_column_set_id); 211 layout->StartRow(0, single_column_set_id);
213 layout->AddView(new views::Label(name)); 212 layout->AddView(new views::Label(name));
214 bubble_content_empty = false; 213 bubble_content_empty = false;
215 } 214 }
216 } 215 }
217 216
218 if (content_setting_bubble_model_->content_type() == 217 if (content_setting_bubble_model_->content_type() ==
219 CONTENT_SETTINGS_TYPE_POPUPS) { 218 CONTENT_SETTINGS_TYPE_POPUPS) {
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 layout->StartRow(0, double_column_set_id); 322 layout->StartRow(0, double_column_set_id);
324 manage_link_ = new views::Link(UTF8ToWide(bubble_content.manage_link)); 323 manage_link_ = new views::Link(UTF8ToWide(bubble_content.manage_link));
325 manage_link_->set_listener(this); 324 manage_link_->set_listener(this);
326 layout->AddView(manage_link_); 325 layout->AddView(manage_link_);
327 326
328 close_button_ = 327 close_button_ =
329 new views::NativeTextButton(this, 328 new views::NativeTextButton(this,
330 UTF16ToWide(l10n_util::GetStringUTF16(IDS_DONE))); 329 UTF16ToWide(l10n_util::GetStringUTF16(IDS_DONE)));
331 layout->AddView(close_button_); 330 layout->AddView(close_button_);
332 } 331 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/drag_util.mm ('k') | chrome/browser/ui/webui/flash_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698