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/public/browser/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/gtk/gtk_screen_utils.h" |
16 #include "ui/base/l10n/l10n_util.h" | 16 #include "ui/base/l10n/l10n_util.h" |
17 | 17 |
18 // Roundedness of bubble. | 18 // Roundedness of bubble. |
19 static const int kBubbleCornerRadius = 4; | 19 static const int kBubbleCornerRadius = 4; |
20 | 20 |
21 // Padding between border of bubble and text. | 21 // Padding between border of bubble and text. |
22 static const int kTextPadding = 8; | 22 static const int kTextPadding = 8; |
(...skipping 30 matching lines...) Expand all Loading... |
53 InitWidgets(); | 53 InitWidgets(); |
54 | 54 |
55 // Close when theme has been installed. | 55 // Close when theme has been installed. |
56 // | 56 // |
57 // TODO(erg): At least for version 1 of multiprofiles, we're still going to | 57 // TODO(erg): At least for version 1 of multiprofiles, we're still going to |
58 // listen to AllSources(). Installing a theme blocks the entire UI thread so | 58 // listen to AllSources(). Installing a theme blocks the entire UI thread so |
59 // we won't have another profile trying to install a theme. | 59 // we won't have another profile trying to install a theme. |
60 registrar_.Add( | 60 registrar_.Add( |
61 this, | 61 this, |
62 chrome::NOTIFICATION_BROWSER_THEME_CHANGED, | 62 chrome::NOTIFICATION_BROWSER_THEME_CHANGED, |
63 NotificationService::AllBrowserContextsAndSources()); | 63 content::NotificationService::AllBrowserContextsAndSources()); |
64 | 64 |
65 // Close when we are installing an extension, not a theme. | 65 // Close when we are installing an extension, not a theme. |
66 registrar_.Add( | 66 registrar_.Add( |
67 this, | 67 this, |
68 chrome::NOTIFICATION_NO_THEME_DETECTED, | 68 chrome::NOTIFICATION_NO_THEME_DETECTED, |
69 NotificationService::AllSources()); | 69 content::NotificationService::AllSources()); |
70 registrar_.Add( | 70 registrar_.Add( |
71 this, | 71 this, |
72 chrome::NOTIFICATION_EXTENSION_INSTALLED, | 72 chrome::NOTIFICATION_EXTENSION_INSTALLED, |
73 NotificationService::AllSources()); | 73 content::NotificationService::AllSources()); |
74 registrar_.Add( | 74 registrar_.Add( |
75 this, | 75 this, |
76 chrome::NOTIFICATION_EXTENSION_INSTALL_ERROR, | 76 chrome::NOTIFICATION_EXTENSION_INSTALL_ERROR, |
77 NotificationService::AllSources()); | 77 content::NotificationService::AllSources()); |
78 | 78 |
79 // Don't let the bubble overlap the confirm dialog. | 79 // Don't let the bubble overlap the confirm dialog. |
80 registrar_.Add( | 80 registrar_.Add( |
81 this, | 81 this, |
82 chrome::NOTIFICATION_EXTENSION_WILL_SHOW_CONFIRM_DIALOG, | 82 chrome::NOTIFICATION_EXTENSION_WILL_SHOW_CONFIRM_DIALOG, |
83 NotificationService::AllSources()); | 83 content::NotificationService::AllSources()); |
84 } | 84 } |
85 | 85 |
86 ThemeInstallBubbleViewGtk::~ThemeInstallBubbleViewGtk() { | 86 ThemeInstallBubbleViewGtk::~ThemeInstallBubbleViewGtk() { |
87 gtk_widget_destroy(widget_); | 87 gtk_widget_destroy(widget_); |
88 instance_ = NULL; | 88 instance_ = NULL; |
89 } | 89 } |
90 | 90 |
91 void ThemeInstallBubbleViewGtk::InitWidgets() { | 91 void ThemeInstallBubbleViewGtk::InitWidgets() { |
92 // Widgematically, the bubble is just a label in a popup window. | 92 // Widgematically, the bubble is just a label in a popup window. |
93 widget_ = gtk_window_new(GTK_WINDOW_POPUP); | 93 widget_ = gtk_window_new(GTK_WINDOW_POPUP); |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 0, M_PI_2); | 183 0, M_PI_2); |
184 cairo_arc(cr, inner_rect.x(), inner_rect.bottom(), inset, | 184 cairo_arc(cr, inner_rect.x(), inner_rect.bottom(), inset, |
185 M_PI_2, M_PI); | 185 M_PI_2, M_PI); |
186 | 186 |
187 cairo_set_source_rgba(cr, 0.0, 0.0, 0.0, kBubbleOpacity); | 187 cairo_set_source_rgba(cr, 0.0, 0.0, 0.0, kBubbleOpacity); |
188 cairo_fill(cr); | 188 cairo_fill(cr); |
189 cairo_destroy(cr); | 189 cairo_destroy(cr); |
190 | 190 |
191 return FALSE; | 191 return FALSE; |
192 } | 192 } |
OLD | NEW |