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