OLD | NEW |
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/gtk/gtk_hig_constants.h" |
| 15 #include "ui/base/gtk/gtk_screen_utils.h" |
15 #include "ui/base/l10n/l10n_util.h" | 16 #include "ui/base/l10n/l10n_util.h" |
16 | 17 |
17 // Roundedness of bubble. | 18 // Roundedness of bubble. |
18 static const int kBubbleCornerRadius = 4; | 19 static const int kBubbleCornerRadius = 4; |
19 | 20 |
20 // Padding between border of bubble and text. | 21 // Padding between border of bubble and text. |
21 static const int kTextPadding = 8; | 22 static const int kTextPadding = 8; |
22 | 23 |
23 // The bubble is partially transparent. | 24 // The bubble is partially transparent. |
24 static const double kBubbleOpacity = static_cast<double>(0xcc) / 0xff; | 25 static const double kBubbleOpacity = static_cast<double>(0xcc) / 0xff; |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 g_free(markup); | 100 g_free(markup); |
100 | 101 |
101 gtk_widget_modify_fg(label, GTK_STATE_NORMAL, &ui::kGdkWhite); | 102 gtk_widget_modify_fg(label, GTK_STATE_NORMAL, &ui::kGdkWhite); |
102 gtk_container_add(GTK_CONTAINER(widget_), label); | 103 gtk_container_add(GTK_CONTAINER(widget_), label); |
103 | 104 |
104 // We need to show the label so we'll know the widget's actual size when we | 105 // We need to show the label so we'll know the widget's actual size when we |
105 // call MoveWindow(). | 106 // call MoveWindow(). |
106 gtk_widget_show_all(label); | 107 gtk_widget_show_all(label); |
107 | 108 |
108 bool composited = false; | 109 bool composited = false; |
109 if (gtk_util::IsScreenComposited()) { | 110 if (ui::IsScreenComposited()) { |
110 composited = true; | 111 composited = true; |
111 GdkScreen* screen = gtk_widget_get_screen(widget_); | 112 GdkScreen* screen = gtk_widget_get_screen(widget_); |
112 GdkColormap* colormap = gdk_screen_get_rgba_colormap(screen); | 113 GdkColormap* colormap = gdk_screen_get_rgba_colormap(screen); |
113 | 114 |
114 if (colormap) | 115 if (colormap) |
115 gtk_widget_set_colormap(widget_, colormap); | 116 gtk_widget_set_colormap(widget_, colormap); |
116 else | 117 else |
117 composited = false; | 118 composited = false; |
118 } | 119 } |
119 | 120 |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 0, M_PI_2); | 182 0, M_PI_2); |
182 cairo_arc(cr, inner_rect.x(), inner_rect.bottom(), inset, | 183 cairo_arc(cr, inner_rect.x(), inner_rect.bottom(), inset, |
183 M_PI_2, M_PI); | 184 M_PI_2, M_PI); |
184 | 185 |
185 cairo_set_source_rgba(cr, 0.0, 0.0, 0.0, kBubbleOpacity); | 186 cairo_set_source_rgba(cr, 0.0, 0.0, 0.0, kBubbleOpacity); |
186 cairo_fill(cr); | 187 cairo_fill(cr); |
187 cairo_destroy(cr); | 188 cairo_destroy(cr); |
188 | 189 |
189 return FALSE; | 190 return FALSE; |
190 } | 191 } |
OLD | NEW |