| OLD | NEW |
| 1 // Copyright (c) 2012 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/extensions/bundle_installed_bubble_gtk.h" | 5 #include "chrome/browser/ui/gtk/extensions/bundle_installed_bubble_gtk.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 string16 heading = bundle->GetHeadingTextFor(state); | 113 string16 heading = bundle->GetHeadingTextFor(state); |
| 114 BundleInstaller::ItemList items = bundle->GetItemsWithState(state); | 114 BundleInstaller::ItemList items = bundle->GetItemsWithState(state); |
| 115 if (heading.empty() || items.empty()) | 115 if (heading.empty() || items.empty()) |
| 116 return; | 116 return; |
| 117 | 117 |
| 118 GtkWidget* heading_label = gtk_util::CreateBoldLabel(UTF16ToUTF8(heading)); | 118 GtkWidget* heading_label = gtk_util::CreateBoldLabel(UTF16ToUTF8(heading)); |
| 119 gtk_util::SetLabelWidth(heading_label, kContentWidth); | 119 gtk_util::SetLabelWidth(heading_label, kContentWidth); |
| 120 gtk_box_pack_start(GTK_BOX(parent), heading_label, FALSE, FALSE, 0); | 120 gtk_box_pack_start(GTK_BOX(parent), heading_label, FALSE, FALSE, 0); |
| 121 | 121 |
| 122 for (size_t i = 0; i < items.size(); ++i) { | 122 for (size_t i = 0; i < items.size(); ++i) { |
| 123 string16 extension_name = UTF8ToUTF16(items[i].localized_name); | |
| 124 base::i18n::AdjustStringForLocaleDirection(&extension_name); | |
| 125 | |
| 126 GtkWidget* extension_label = gtk_label_new(UTF16ToUTF8( | 123 GtkWidget* extension_label = gtk_label_new(UTF16ToUTF8( |
| 127 l10n_util::GetStringFUTF16( | 124 items[i].GetNameForDisplay()).c_str()); |
| 128 IDS_EXTENSION_PERMISSION_LINE, extension_name)).c_str()); | |
| 129 gtk_util::SetLabelWidth(extension_label, kContentWidth); | 125 gtk_util::SetLabelWidth(extension_label, kContentWidth); |
| 130 gtk_box_pack_start(GTK_BOX(parent), extension_label, false, false, | 126 gtk_box_pack_start(GTK_BOX(parent), extension_label, false, false, |
| 131 kListItemPadding); | 127 kListItemPadding); |
| 132 } | 128 } |
| 133 } | 129 } |
| 134 | 130 |
| 135 void BundleInstalledBubbleGtk::BubbleClosing(BubbleGtk* bubble, | 131 void BundleInstalledBubbleGtk::BubbleClosing(BubbleGtk* bubble, |
| 136 bool closed_by_escape) { | 132 bool closed_by_escape) { |
| 137 // We need to allow the bubble to close and remove the widgets from | 133 // We need to allow the bubble to close and remove the widgets from |
| 138 // the window before we call Release() because close_button_ depends | 134 // the window before we call Release() because close_button_ depends |
| 139 // on all references being cleared before it is destroyed. | 135 // on all references being cleared before it is destroyed. |
| 140 MessageLoopForUI::current()->PostTask( | 136 MessageLoopForUI::current()->PostTask( |
| 141 FROM_HERE, | 137 FROM_HERE, |
| 142 base::Bind(&BundleInstalledBubbleGtk::Close, this)); | 138 base::Bind(&BundleInstalledBubbleGtk::Close, this)); |
| 143 } | 139 } |
| 144 | 140 |
| 145 void BundleInstalledBubbleGtk::Close() { | 141 void BundleInstalledBubbleGtk::Close() { |
| 146 bubble_ = NULL; | 142 bubble_ = NULL; |
| 147 | 143 |
| 148 Release(); // Balanced in BundleInstalledBubbleGtk(). | 144 Release(); // Balanced in BundleInstalledBubbleGtk(). |
| 149 } | 145 } |
| 150 | 146 |
| 151 void BundleInstalledBubbleGtk::OnButtonClick(GtkWidget* button, | 147 void BundleInstalledBubbleGtk::OnButtonClick(GtkWidget* button, |
| 152 BundleInstalledBubbleGtk* bubble) { | 148 BundleInstalledBubbleGtk* bubble) { |
| 153 if (button == bubble->close_button_->widget()) | 149 if (button == bubble->close_button_->widget()) |
| 154 bubble->bubble_->Close(); | 150 bubble->bubble_->Close(); |
| 155 else | 151 else |
| 156 NOTREACHED(); | 152 NOTREACHED(); |
| 157 } | 153 } |
| OLD | NEW |