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