Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(861)

Side by Side Diff: chrome/browser/ui/gtk/first_run_bubble.cc

Issue 10918275: [gtk] website settings bubble (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: slightly simpler drawing Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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.h" 13 #include "chrome/browser/ui/browser.h"
14 #include "chrome/browser/ui/browser_finder.h" 14 #include "chrome/browser/ui/browser_finder.h"
15 #include "chrome/browser/ui/chrome_pages.h" 15 #include "chrome/browser/ui/chrome_pages.h"
16 #include "chrome/browser/ui/gtk/gtk_theme_service.h" 16 #include "chrome/browser/ui/gtk/gtk_theme_service.h"
17 #include "grit/generated_resources.h" 17 #include "grit/generated_resources.h"
18 #include "ui/base/gtk/gtk_hig_constants.h" 18 #include "ui/base/gtk/gtk_hig_constants.h"
19 #include "ui/base/l10n/l10n_util.h" 19 #include "ui/base/l10n/l10n_util.h"
20 20
21 namespace { 21 namespace {
22
22 // Markup for the text of the Omnibox search label 23 // Markup for the text of the Omnibox search label
23 const char kSearchLabelMarkup[] = "<big><b>%s</b></big>"; 24 const char kSearchLabelMarkup[] = "<big><b>%s</b></big>";
24 25
25 // Padding between content and edge of bubble.
26 const int kContentBorder = 7;
27
28 // Vertical spacing between labels.
29 const int kInterLineSpacing = 5;
30
31 } // namespace 26 } // namespace
32 27
33 // static 28 // static
34 void FirstRunBubble::Show(Browser* browser, 29 void FirstRunBubble::Show(Browser* browser,
35 GtkWidget* anchor, 30 GtkWidget* anchor,
36 const gfx::Rect& rect) { 31 const gfx::Rect& rect) {
37 first_run::LogFirstRunMetric(first_run::FIRST_RUN_BUBBLE_SHOWN); 32 first_run::LogFirstRunMetric(first_run::FIRST_RUN_BUBBLE_SHOWN);
38 33
39 new FirstRunBubble(browser, anchor, rect); 34 new FirstRunBubble(browser, anchor, rect);
40 } 35 }
(...skipping 15 matching lines...) Expand all
56 gtk_label_set_markup(GTK_LABEL(title), markup); 51 gtk_label_set_markup(GTK_LABEL(title), markup);
57 g_free(markup); 52 g_free(markup);
58 53
59 GtkWidget* change = theme_service->BuildChromeLinkButton( 54 GtkWidget* change = theme_service->BuildChromeLinkButton(
60 l10n_util::GetStringUTF8(IDS_FR_BUBBLE_CHANGE)); 55 l10n_util::GetStringUTF8(IDS_FR_BUBBLE_CHANGE));
61 g_signal_connect(change, "clicked", G_CALLBACK(&HandleChangeLinkThunk), this); 56 g_signal_connect(change, "clicked", G_CALLBACK(&HandleChangeLinkThunk), this);
62 57
63 GtkWidget* subtext = theme_service->BuildLabel( 58 GtkWidget* subtext = theme_service->BuildLabel(
64 l10n_util::GetStringUTF8(IDS_FR_BUBBLE_SUBTEXT), ui::kGdkBlack); 59 l10n_util::GetStringUTF8(IDS_FR_BUBBLE_SUBTEXT), ui::kGdkBlack);
65 60
66 GtkWidget* top_line = gtk_hbox_new(FALSE, kContentBorder); 61 GtkWidget* top_line = gtk_hbox_new(FALSE, ui::kControlSpacing);
67 gtk_box_pack_start(GTK_BOX(top_line), title, FALSE, FALSE, 0); 62 gtk_box_pack_start(GTK_BOX(top_line), title, FALSE, FALSE, 0);
68 gtk_box_pack_start(GTK_BOX(top_line), change, FALSE, FALSE, 0); 63 gtk_box_pack_start(GTK_BOX(top_line), change, FALSE, FALSE, 0);
69 64
70 GtkWidget* content = gtk_vbox_new(FALSE, kInterLineSpacing); 65 GtkWidget* content = gtk_vbox_new(FALSE, ui::kControlSpacing);
71 gtk_container_set_border_width(GTK_CONTAINER(content), kContentBorder); 66 gtk_container_set_border_width(GTK_CONTAINER(content),
67 ui::kContentAreaBorder);
72 g_signal_connect(content, "destroy", G_CALLBACK(&HandleDestroyThunk), this); 68 g_signal_connect(content, "destroy", G_CALLBACK(&HandleDestroyThunk), this);
73 gtk_box_pack_start(GTK_BOX(content), top_line, FALSE, FALSE, 0); 69 gtk_box_pack_start(GTK_BOX(content), top_line, FALSE, FALSE, 0);
74 gtk_box_pack_start(GTK_BOX(content), subtext, FALSE, FALSE, 0); 70 gtk_box_pack_start(GTK_BOX(content), subtext, FALSE, FALSE, 0);
75 71
76 BubbleGtk::ArrowLocationGtk arrow_location = !base::i18n::IsRTL() ? 72 BubbleGtk::ArrowLocationGtk arrow_location = !base::i18n::IsRTL() ?
77 BubbleGtk::ARROW_LOCATION_TOP_LEFT : BubbleGtk::ARROW_LOCATION_TOP_RIGHT; 73 BubbleGtk::ARROW_LOCATION_TOP_LEFT : BubbleGtk::ARROW_LOCATION_TOP_RIGHT;
78 bubble_ = BubbleGtk::Show(anchor, 74 bubble_ = BubbleGtk::Show(anchor,
79 &rect, 75 &rect,
80 content, 76 content,
81 arrow_location, 77 arrow_location,
(...skipping 14 matching lines...) Expand all
96 92
97 void FirstRunBubble::HandleChangeLink(GtkWidget* sender) { 93 void FirstRunBubble::HandleChangeLink(GtkWidget* sender) {
98 first_run::LogFirstRunMetric(first_run::FIRST_RUN_BUBBLE_CHANGE_INVOKED); 94 first_run::LogFirstRunMetric(first_run::FIRST_RUN_BUBBLE_CHANGE_INVOKED);
99 95
100 // Cache browser_ before closing the bubble, which deletes |this|. 96 // Cache browser_ before closing the bubble, which deletes |this|.
101 Browser* browser = browser_; 97 Browser* browser = browser_;
102 bubble_->Close(); 98 bubble_->Close();
103 if (browser) 99 if (browser)
104 chrome::ShowSearchEngineSettings(browser); 100 chrome::ShowSearchEngineSettings(browser);
105 } 101 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/gtk/extensions/extension_popup_gtk.cc ('k') | chrome/browser/ui/gtk/global_error_bubble.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698