| 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/search_engines/util.h" | 12 #include "chrome/browser/search_engines/util.h" |
| 12 #include "chrome/browser/ui/browser_list.h" | 13 #include "chrome/browser/ui/browser_list.h" |
| 13 #include "chrome/browser/ui/gtk/theme_service_gtk.h" | 14 #include "chrome/browser/ui/gtk/theme_service_gtk.h" |
| 14 #include "grit/generated_resources.h" | 15 #include "grit/generated_resources.h" |
| 15 #include "ui/base/gtk/gtk_hig_constants.h" | 16 #include "ui/base/gtk/gtk_hig_constants.h" |
| 16 #include "ui/base/l10n/l10n_util.h" | 17 #include "ui/base/l10n/l10n_util.h" |
| 17 | 18 |
| 18 namespace { | 19 namespace { |
| 19 // Markup for the text of the Omnibox search label | 20 // Markup for the text of the Omnibox search label |
| 20 const char kSearchLabelMarkup[] = "<big><b>%s</b></big>"; | 21 const char kSearchLabelMarkup[] = "<big><b>%s</b></big>"; |
| 21 | 22 |
| 22 // Padding between content and edge of bubble. | 23 // Padding between content and edge of bubble. |
| 23 const int kContentBorder = 7; | 24 const int kContentBorder = 7; |
| 24 | 25 |
| 25 // Vertical spacing between labels. | 26 // Vertical spacing between labels. |
| 26 const int kInterLineSpacing = 5; | 27 const int kInterLineSpacing = 5; |
| 27 | 28 |
| 28 } // namespace | 29 } // namespace |
| 29 | 30 |
| 30 // static | 31 // static |
| 31 void FirstRunBubble::Show(Profile* profile, | 32 void FirstRunBubble::Show(Profile* profile, |
| 32 GtkWidget* anchor, | 33 GtkWidget* anchor, |
| 33 const gfx::Rect& rect) { | 34 const gfx::Rect& rect) { |
| 35 first_run::LogFirstRunMetric(first_run::FIRST_RUN_BUBBLE_SHOWN); |
| 36 |
| 34 new FirstRunBubble(profile, anchor, rect); | 37 new FirstRunBubble(profile, anchor, rect); |
| 35 } | 38 } |
| 36 | 39 |
| 37 void FirstRunBubble::BubbleClosing(BubbleGtk* bubble, bool closed_by_escape) { | 40 void FirstRunBubble::BubbleClosing(BubbleGtk* bubble, bool closed_by_escape) { |
| 38 // TODO(port): Enable parent window | 41 // TODO(port): Enable parent window |
| 39 } | 42 } |
| 40 | 43 |
| 41 FirstRunBubble::FirstRunBubble(Profile* profile, | 44 FirstRunBubble::FirstRunBubble(Profile* profile, |
| 42 GtkWidget* anchor, | 45 GtkWidget* anchor, |
| 43 const gfx::Rect& rect) | 46 const gfx::Rect& rect) |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 } | 79 } |
| 77 | 80 |
| 78 FirstRunBubble::~FirstRunBubble() { | 81 FirstRunBubble::~FirstRunBubble() { |
| 79 } | 82 } |
| 80 | 83 |
| 81 void FirstRunBubble::HandleDestroy(GtkWidget* sender) { | 84 void FirstRunBubble::HandleDestroy(GtkWidget* sender) { |
| 82 delete this; | 85 delete this; |
| 83 } | 86 } |
| 84 | 87 |
| 85 void FirstRunBubble::HandleChangeLink(GtkWidget* sender) { | 88 void FirstRunBubble::HandleChangeLink(GtkWidget* sender) { |
| 89 first_run::LogFirstRunMetric(first_run::FIRST_RUN_BUBBLE_CHANGE_INVOKED); |
| 90 |
| 86 // Get |profile_|'s browser before closing the bubble, which deletes |this|. | 91 // Get |profile_|'s browser before closing the bubble, which deletes |this|. |
| 87 Browser* browser = BrowserList::GetLastActiveWithProfile(profile_); | 92 Browser* browser = BrowserList::GetLastActiveWithProfile(profile_); |
| 88 bubble_->Close(); | 93 bubble_->Close(); |
| 89 if (browser) | 94 if (browser) |
| 90 browser->OpenSearchEngineOptionsDialog(); | 95 browser->OpenSearchEngineOptionsDialog(); |
| 91 } | 96 } |
| OLD | NEW |