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/extensions/extension_installed_bubble_gtk.h" | 5 #include "chrome/browser/ui/gtk/extensions/extension_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" |
11 #include "base/i18n/rtl.h" | 11 #include "base/i18n/rtl.h" |
12 #include "base/message_loop.h" | 12 #include "base/message_loop.h" |
13 #include "base/utf_string_conversions.h" | 13 #include "base/utf_string_conversions.h" |
14 #include "chrome/browser/ui/browser.h" | 14 #include "chrome/browser/ui/browser.h" |
15 #include "chrome/browser/ui/browser_dialogs.h" | 15 #include "chrome/browser/ui/browser_dialogs.h" |
16 #include "chrome/browser/ui/gtk/browser_actions_toolbar_gtk.h" | 16 #include "chrome/browser/ui/gtk/browser_actions_toolbar_gtk.h" |
17 #include "chrome/browser/ui/gtk/browser_toolbar_gtk.h" | 17 #include "chrome/browser/ui/gtk/browser_toolbar_gtk.h" |
18 #include "chrome/browser/ui/gtk/browser_window_gtk.h" | 18 #include "chrome/browser/ui/gtk/browser_window_gtk.h" |
19 #include "chrome/browser/ui/gtk/gtk_theme_service.h" | 19 #include "chrome/browser/ui/gtk/gtk_theme_service.h" |
20 #include "chrome/browser/ui/gtk/gtk_util.h" | 20 #include "chrome/browser/ui/gtk/gtk_util.h" |
21 #include "chrome/browser/ui/gtk/location_bar_view_gtk.h" | 21 #include "chrome/browser/ui/gtk/location_bar_view_gtk.h" |
22 #include "chrome/common/chrome_notification_types.h" | 22 #include "chrome/common/chrome_notification_types.h" |
23 #include "chrome/common/extensions/extension.h" | 23 #include "chrome/common/extensions/extension.h" |
24 #include "chrome/common/extensions/extension_action.h" | 24 #include "chrome/common/extensions/extension_action.h" |
25 #include "content/public/browser/notification_details.h" | 25 #include "content/public/browser/notification_details.h" |
26 #include "content/public/browser/notification_source.h" | 26 #include "content/public/browser/notification_source.h" |
27 #include "grit/chromium_strings.h" | |
28 #include "grit/generated_resources.h" | 27 #include "grit/generated_resources.h" |
29 #include "grit/theme_resources.h" | 28 #include "grit/theme_resources.h" |
30 #include "ui/base/l10n/l10n_util.h" | 29 #include "ui/base/l10n/l10n_util.h" |
31 #include "ui/base/resource/resource_bundle.h" | 30 #include "ui/base/resource/resource_bundle.h" |
32 #include "ui/gfx/gtk_util.h" | 31 #include "ui/gfx/gtk_util.h" |
33 | 32 |
34 namespace { | 33 namespace { |
35 | 34 |
36 const int kHorizontalColumnSpacing = 10; | 35 const int kHorizontalColumnSpacing = 10; |
37 const int kIconPadding = 3; | 36 const int kIconPadding = 3; |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 | 215 |
217 // Center text column. | 216 // Center text column. |
218 GtkWidget* text_column = gtk_vbox_new(FALSE, kTextColumnVerticalSpacing); | 217 GtkWidget* text_column = gtk_vbox_new(FALSE, kTextColumnVerticalSpacing); |
219 gtk_box_pack_start(GTK_BOX(bubble_content), text_column, FALSE, FALSE, 0); | 218 gtk_box_pack_start(GTK_BOX(bubble_content), text_column, FALSE, FALSE, 0); |
220 | 219 |
221 // Heading label | 220 // Heading label |
222 GtkWidget* heading_label = gtk_label_new(NULL); | 221 GtkWidget* heading_label = gtk_label_new(NULL); |
223 string16 extension_name = UTF8ToUTF16(extension_->name()); | 222 string16 extension_name = UTF8ToUTF16(extension_->name()); |
224 base::i18n::AdjustStringForLocaleDirection(&extension_name); | 223 base::i18n::AdjustStringForLocaleDirection(&extension_name); |
225 std::string heading_text = l10n_util::GetStringFUTF8( | 224 std::string heading_text = l10n_util::GetStringFUTF8( |
226 IDS_EXTENSION_INSTALLED_HEADING, extension_name, | 225 IDS_EXTENSION_INSTALLED_HEADING, extension_name); |
227 l10n_util::GetStringUTF16(IDS_SHORT_PRODUCT_NAME)); | |
228 char* markup = g_markup_printf_escaped("<span size=\"larger\">%s</span>", | 226 char* markup = g_markup_printf_escaped("<span size=\"larger\">%s</span>", |
229 heading_text.c_str()); | 227 heading_text.c_str()); |
230 gtk_label_set_markup(GTK_LABEL(heading_label), markup); | 228 gtk_label_set_markup(GTK_LABEL(heading_label), markup); |
231 g_free(markup); | 229 g_free(markup); |
232 | 230 |
233 gtk_util::SetLabelWidth(heading_label, kTextColumnWidth); | 231 gtk_util::SetLabelWidth(heading_label, kTextColumnWidth); |
234 gtk_box_pack_start(GTK_BOX(text_column), heading_label, FALSE, FALSE, 0); | 232 gtk_box_pack_start(GTK_BOX(text_column), heading_label, FALSE, FALSE, 0); |
235 | 233 |
236 // Page action label | 234 // Page action label |
237 if (type_ == PAGE_ACTION) { | 235 if (type_ == PAGE_ACTION) { |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
321 // on all references being cleared before it is destroyed. | 319 // on all references being cleared before it is destroyed. |
322 MessageLoopForUI::current()->PostTask( | 320 MessageLoopForUI::current()->PostTask( |
323 FROM_HERE, | 321 FROM_HERE, |
324 base::Bind(&ExtensionInstalledBubbleGtk::Close, this)); | 322 base::Bind(&ExtensionInstalledBubbleGtk::Close, this)); |
325 } | 323 } |
326 | 324 |
327 void ExtensionInstalledBubbleGtk::Close() { | 325 void ExtensionInstalledBubbleGtk::Close() { |
328 Release(); // Balanced in ctor. | 326 Release(); // Balanced in ctor. |
329 bubble_ = NULL; | 327 bubble_ = NULL; |
330 } | 328 } |
OLD | NEW |