| 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/first_run_bubble.h" | 5 #include "chrome/browser/ui/gtk/first_run_bubble.h" |
| 6 | 6 |
| 7 #include <gtk/gtk.h> | 7 #include <gtk/gtk.h> |
| 8 | 8 |
| 9 #include "base/i18n/rtl.h" | 9 #include "base/i18n/rtl.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| 11 #include "chrome/browser/search_engines/util.h" | 11 #include "chrome/browser/search_engines/util.h" |
| 12 #include "chrome/browser/ui/browser_list.h" | 12 #include "chrome/browser/ui/browser_list.h" |
| 13 #include "chrome/browser/ui/gtk/gtk_theme_service.h" | 13 #include "chrome/browser/ui/gtk/theme_service_gtk.h" |
| 14 #include "grit/generated_resources.h" | 14 #include "grit/generated_resources.h" |
| 15 #include "ui/base/gtk/gtk_hig_constants.h" | 15 #include "ui/base/gtk/gtk_hig_constants.h" |
| 16 #include "ui/base/l10n/l10n_util.h" | 16 #include "ui/base/l10n/l10n_util.h" |
| 17 | 17 |
| 18 namespace { | 18 namespace { |
| 19 // Markup for the text of the Omnibox search label | 19 // Markup for the text of the Omnibox search label |
| 20 const char kSearchLabelMarkup[] = "<big><b>%s</b></big>"; | 20 const char kSearchLabelMarkup[] = "<big><b>%s</b></big>"; |
| 21 | 21 |
| 22 // Padding between content and edge of bubble. | 22 // Padding between content and edge of bubble. |
| 23 const int kContentBorder = 7; | 23 const int kContentBorder = 7; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 36 | 36 |
| 37 void FirstRunBubble::BubbleClosing(BubbleGtk* bubble, bool closed_by_escape) { | 37 void FirstRunBubble::BubbleClosing(BubbleGtk* bubble, bool closed_by_escape) { |
| 38 // TODO(port): Enable parent window | 38 // TODO(port): Enable parent window |
| 39 } | 39 } |
| 40 | 40 |
| 41 FirstRunBubble::FirstRunBubble(Profile* profile, | 41 FirstRunBubble::FirstRunBubble(Profile* profile, |
| 42 GtkWidget* anchor, | 42 GtkWidget* anchor, |
| 43 const gfx::Rect& rect) | 43 const gfx::Rect& rect) |
| 44 : profile_(profile), | 44 : profile_(profile), |
| 45 bubble_(NULL) { | 45 bubble_(NULL) { |
| 46 GtkThemeService* theme_service = GtkThemeService::GetFrom(profile_); | 46 ThemeServiceGtk* theme_service = ThemeServiceGtk::GetFrom(profile_); |
| 47 GtkWidget* title = theme_service->BuildLabel("", ui::kGdkBlack); | 47 GtkWidget* title = theme_service->BuildLabel("", ui::kGdkBlack); |
| 48 char* markup = g_markup_printf_escaped(kSearchLabelMarkup, | 48 char* markup = g_markup_printf_escaped(kSearchLabelMarkup, |
| 49 l10n_util::GetStringFUTF8(IDS_FR_BUBBLE_TITLE, | 49 l10n_util::GetStringFUTF8(IDS_FR_BUBBLE_TITLE, |
| 50 GetDefaultSearchEngineName(profile_)).c_str()); | 50 GetDefaultSearchEngineName(profile_)).c_str()); |
| 51 gtk_label_set_markup(GTK_LABEL(title), markup); | 51 gtk_label_set_markup(GTK_LABEL(title), markup); |
| 52 g_free(markup); | 52 g_free(markup); |
| 53 | 53 |
| 54 GtkWidget* change = theme_service->BuildChromeLinkButton( | 54 GtkWidget* change = theme_service->BuildChromeLinkButton( |
| 55 l10n_util::GetStringUTF8(IDS_FR_BUBBLE_CHANGE)); | 55 l10n_util::GetStringUTF8(IDS_FR_BUBBLE_CHANGE)); |
| 56 g_signal_connect(change, "clicked", G_CALLBACK(&HandleChangeLinkThunk), this); | 56 g_signal_connect(change, "clicked", G_CALLBACK(&HandleChangeLinkThunk), this); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 82 delete this; | 82 delete this; |
| 83 } | 83 } |
| 84 | 84 |
| 85 void FirstRunBubble::HandleChangeLink(GtkWidget* sender) { | 85 void FirstRunBubble::HandleChangeLink(GtkWidget* sender) { |
| 86 // Get |profile_|'s browser before closing the bubble, which deletes |this|. | 86 // Get |profile_|'s browser before closing the bubble, which deletes |this|. |
| 87 Browser* browser = BrowserList::GetLastActiveWithProfile(profile_); | 87 Browser* browser = BrowserList::GetLastActiveWithProfile(profile_); |
| 88 bubble_->Close(); | 88 bubble_->Close(); |
| 89 if (browser) | 89 if (browser) |
| 90 browser->OpenSearchEngineOptionsDialog(); | 90 browser->OpenSearchEngineOptionsDialog(); |
| 91 } | 91 } |
| OLD | NEW |