OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/gtk/first_run_bubble.h" | 5 #include "chrome/browser/gtk/first_run_bubble.h" |
6 | 6 |
7 #include <gtk/gtk.h> | 7 #include <gtk/gtk.h> |
8 | 8 |
9 #include "app/gtk_util.h" | 9 #include "app/gtk_util.h" |
10 #include "app/l10n_util.h" | 10 #include "app/l10n_util.h" |
11 #include "base/i18n/rtl.h" | 11 #include "base/i18n/rtl.h" |
12 #include "base/utf_string_conversions.h" | 12 #include "base/utf_string_conversions.h" |
13 #include "chrome/browser/gtk/gtk_theme_provider.h" | 13 #include "chrome/browser/gtk/gtk_theme_provider.h" |
14 #include "chrome/browser/options_window.h" | 14 #include "chrome/browser/options_window.h" |
15 #include "chrome/browser/search_engines/template_url_model.h" | 15 #include "chrome/browser/search_engines/util.h" |
16 #include "chrome/common/notification_service.h" | 16 #include "chrome/common/notification_service.h" |
17 #include "gfx/gtk_util.h" | 17 #include "gfx/gtk_util.h" |
18 #include "grit/chromium_strings.h" | 18 #include "grit/chromium_strings.h" |
19 #include "grit/generated_resources.h" | 19 #include "grit/generated_resources.h" |
20 #include "grit/locale_settings.h" | 20 #include "grit/locale_settings.h" |
21 | 21 |
22 namespace { | 22 namespace { |
23 // Markup for the text of the Omnibox search label | 23 // Markup for the text of the Omnibox search label |
24 const char kSearchLabelMarkup[] = "<big><b>%s</b></big>"; | 24 const char kSearchLabelMarkup[] = "<big><b>%s</b></big>"; |
25 | 25 |
26 // Padding for the buttons on first run bubble. | 26 // Padding for the buttons on first run bubble. |
27 const int kButtonPadding = 4; | 27 const int kButtonPadding = 4; |
28 | 28 |
29 // Padding between content and edge of info bubble. | 29 // Padding between content and edge of info bubble. |
30 const int kContentBorder = 7; | 30 const int kContentBorder = 7; |
31 | |
32 string16 GetDefaultSearchEngineName(Profile* profile) { | |
33 if (!profile) { | |
34 NOTREACHED(); | |
35 return string16(); | |
36 } | |
37 const TemplateURL* const default_provider = | |
38 profile->GetTemplateURLModel()->GetDefaultSearchProvider(); | |
39 if (!default_provider) { | |
40 return string16(); | |
41 } | |
42 return WideToUTF16(default_provider->short_name()); | |
43 } | |
44 } // namespace | 31 } // namespace |
45 | 32 |
46 // static | 33 // static |
47 void FirstRunBubble::Show(Profile* profile, | 34 void FirstRunBubble::Show(Profile* profile, |
48 GtkWidget* anchor, | 35 GtkWidget* anchor, |
49 const gfx::Rect& rect, | 36 const gfx::Rect& rect, |
50 FirstRun::BubbleType bubble_type) { | 37 FirstRun::BubbleType bubble_type) { |
51 new FirstRunBubble(profile, anchor, rect); | 38 new FirstRunBubble(profile, anchor, rect); |
52 } | 39 } |
53 | 40 |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 | 171 |
185 void FirstRunBubble::HandleKeepButton(GtkWidget* sender) { | 172 void FirstRunBubble::HandleKeepButton(GtkWidget* sender) { |
186 bubble_->Close(); | 173 bubble_->Close(); |
187 | 174 |
188 } | 175 } |
189 void FirstRunBubble::HandleChangeButton(GtkWidget* sender) { | 176 void FirstRunBubble::HandleChangeButton(GtkWidget* sender) { |
190 bubble_->Close(); | 177 bubble_->Close(); |
191 ShowOptionsWindow(OPTIONS_PAGE_GENERAL, OPTIONS_GROUP_DEFAULT_SEARCH, | 178 ShowOptionsWindow(OPTIONS_PAGE_GENERAL, OPTIONS_GROUP_DEFAULT_SEARCH, |
192 profile_); | 179 profile_); |
193 } | 180 } |
OLD | NEW |