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

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

Issue 7748026: content: Reapply "Start splitting up chrome/browser/ui/gtk/gtk_util.h" (r98287) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase on Monday. Created 9 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
« no previous file with comments | « chrome/browser/ui/gtk/task_manager_gtk.cc ('k') | chrome/browser/ui/login/login_prompt_gtk.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/theme_install_bubble_view_gtk.h" 5 #include "chrome/browser/ui/gtk/theme_install_bubble_view_gtk.h"
6 6
7 #include <math.h> 7 #include <math.h>
8 8
9 #include "chrome/browser/ui/gtk/gtk_util.h" 9 #include "chrome/browser/ui/gtk/gtk_util.h"
10 #include "chrome/browser/ui/gtk/rounded_window.h" 10 #include "chrome/browser/ui/gtk/rounded_window.h"
11 #include "chrome/common/chrome_notification_types.h" 11 #include "chrome/common/chrome_notification_types.h"
12 #include "content/common/notification_service.h" 12 #include "content/common/notification_service.h"
13 #include "grit/generated_resources.h" 13 #include "grit/generated_resources.h"
14 #include "ui/base/gtk/gtk_hig_constants.h"
14 #include "ui/base/l10n/l10n_util.h" 15 #include "ui/base/l10n/l10n_util.h"
15 16
16 // Roundedness of bubble. 17 // Roundedness of bubble.
17 static const int kBubbleCornerRadius = 4; 18 static const int kBubbleCornerRadius = 4;
18 19
19 // Padding between border of bubble and text. 20 // Padding between border of bubble and text.
20 static const int kTextPadding = 8; 21 static const int kTextPadding = 8;
21 22
22 // The bubble is partially transparent. 23 // The bubble is partially transparent.
23 static const double kBubbleOpacity = static_cast<double>(0xcc) / 0xff; 24 static const double kBubbleOpacity = static_cast<double>(0xcc) / 0xff;
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 widget_ = gtk_window_new(GTK_WINDOW_POPUP); 91 widget_ = gtk_window_new(GTK_WINDOW_POPUP);
91 gtk_container_set_border_width(GTK_CONTAINER(widget_), kTextPadding); 92 gtk_container_set_border_width(GTK_CONTAINER(widget_), kTextPadding);
92 GtkWidget* label = gtk_label_new(NULL); 93 GtkWidget* label = gtk_label_new(NULL);
93 94
94 gchar* markup = g_markup_printf_escaped( 95 gchar* markup = g_markup_printf_escaped(
95 "<span size='xx-large'>%s</span>", 96 "<span size='xx-large'>%s</span>",
96 l10n_util::GetStringUTF8(IDS_THEME_LOADING_TITLE).c_str()); 97 l10n_util::GetStringUTF8(IDS_THEME_LOADING_TITLE).c_str());
97 gtk_label_set_markup(GTK_LABEL(label), markup); 98 gtk_label_set_markup(GTK_LABEL(label), markup);
98 g_free(markup); 99 g_free(markup);
99 100
100 gtk_widget_modify_fg(label, GTK_STATE_NORMAL, &gtk_util::kGdkWhite); 101 gtk_widget_modify_fg(label, GTK_STATE_NORMAL, &ui::kGdkWhite);
101 gtk_container_add(GTK_CONTAINER(widget_), label); 102 gtk_container_add(GTK_CONTAINER(widget_), label);
102 103
103 // We need to show the label so we'll know the widget's actual size when we 104 // We need to show the label so we'll know the widget's actual size when we
104 // call MoveWindow(). 105 // call MoveWindow().
105 gtk_widget_show_all(label); 106 gtk_widget_show_all(label);
106 107
107 bool composited = false; 108 bool composited = false;
108 if (gtk_util::IsScreenComposited()) { 109 if (gtk_util::IsScreenComposited()) {
109 composited = true; 110 composited = true;
110 GdkScreen* screen = gtk_widget_get_screen(widget_); 111 GdkScreen* screen = gtk_widget_get_screen(widget_);
111 GdkColormap* colormap = gdk_screen_get_rgba_colormap(screen); 112 GdkColormap* colormap = gdk_screen_get_rgba_colormap(screen);
112 113
113 if (colormap) 114 if (colormap)
114 gtk_widget_set_colormap(widget_, colormap); 115 gtk_widget_set_colormap(widget_, colormap);
115 else 116 else
116 composited = false; 117 composited = false;
117 } 118 }
118 119
119 if (composited) { 120 if (composited) {
120 gtk_widget_set_app_paintable(widget_, TRUE); 121 gtk_widget_set_app_paintable(widget_, TRUE);
121 g_signal_connect(widget_, "expose-event", 122 g_signal_connect(widget_, "expose-event",
122 G_CALLBACK(OnExposeThunk), this); 123 G_CALLBACK(OnExposeThunk), this);
123 gtk_widget_realize(widget_); 124 gtk_widget_realize(widget_);
124 } else { 125 } else {
125 gtk_widget_modify_bg(widget_, GTK_STATE_NORMAL, &gtk_util::kGdkBlack); 126 gtk_widget_modify_bg(widget_, GTK_STATE_NORMAL, &ui::kGdkBlack);
126 GdkColor color; 127 GdkColor color;
127 gtk_util::ActAsRoundedWindow(widget_, color, kBubbleCornerRadius, 128 gtk_util::ActAsRoundedWindow(widget_, color, kBubbleCornerRadius,
128 gtk_util::ROUNDED_ALL, gtk_util::BORDER_NONE); 129 gtk_util::ROUNDED_ALL, gtk_util::BORDER_NONE);
129 } 130 }
130 131
131 MoveWindow(); 132 MoveWindow();
132 133
133 g_signal_connect(widget_, "unmap-event", 134 g_signal_connect(widget_, "unmap-event",
134 G_CALLBACK(OnUnmapEventThunk), this); 135 G_CALLBACK(OnUnmapEventThunk), this);
135 136
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 0, M_PI_2); 181 0, M_PI_2);
181 cairo_arc(cr, inner_rect.x(), inner_rect.bottom(), inset, 182 cairo_arc(cr, inner_rect.x(), inner_rect.bottom(), inset,
182 M_PI_2, M_PI); 183 M_PI_2, M_PI);
183 184
184 cairo_set_source_rgba(cr, 0.0, 0.0, 0.0, kBubbleOpacity); 185 cairo_set_source_rgba(cr, 0.0, 0.0, 0.0, kBubbleOpacity);
185 cairo_fill(cr); 186 cairo_fill(cr);
186 cairo_destroy(cr); 187 cairo_destroy(cr);
187 188
188 return FALSE; 189 return FALSE;
189 } 190 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/gtk/task_manager_gtk.cc ('k') | chrome/browser/ui/login/login_prompt_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698