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/about_chrome_dialog.h" | 5 #include "chrome/browser/ui/gtk/about_chrome_dialog.h" |
6 | 6 |
7 #include <gtk/gtk.h> | 7 #include <gtk/gtk.h> |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/utf_string_conversions.h" | 12 #include "base/utf_string_conversions.h" |
13 #include "chrome/browser/google/google_util.h" | 13 #include "chrome/browser/google/google_util.h" |
14 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
15 #include "chrome/browser/ui/browser_list.h" | 15 #include "chrome/browser/ui/browser_list.h" |
16 #include "chrome/browser/ui/gtk/cairo_cached_surface.h" | |
17 #include "chrome/browser/ui/gtk/gtk_chrome_link_button.h" | 16 #include "chrome/browser/ui/gtk/gtk_chrome_link_button.h" |
18 #include "chrome/browser/ui/gtk/gtk_theme_service.h" | |
19 #include "chrome/common/chrome_constants.h" | 17 #include "chrome/common/chrome_constants.h" |
20 #include "chrome/common/chrome_version_info.h" | 18 #include "chrome/common/chrome_version_info.h" |
21 #include "chrome/common/url_constants.h" | 19 #include "chrome/common/url_constants.h" |
22 #include "grit/chromium_strings.h" | 20 #include "grit/chromium_strings.h" |
23 #include "grit/generated_resources.h" | 21 #include "grit/generated_resources.h" |
24 #include "grit/locale_settings.h" | 22 #include "grit/locale_settings.h" |
25 #include "grit/theme_resources.h" | 23 #include "grit/theme_resources.h" |
26 #include "ui/base/gtk/gtk_hig_constants.h" | 24 #include "ui/base/gtk/gtk_hig_constants.h" |
27 #include "ui/base/l10n/l10n_util.h" | 25 #include "ui/base/l10n/l10n_util.h" |
28 #include "ui/base/resource/resource_bundle.h" | 26 #include "ui/base/resource/resource_bundle.h" |
| 27 #include "ui/gfx/image/cairo_cached_surface.h" |
29 #include "ui/gfx/image/image.h" | 28 #include "ui/gfx/image/image.h" |
30 #include "webkit/glue/webkit_glue.h" | 29 #include "webkit/glue/webkit_glue.h" |
31 | 30 |
32 namespace { | 31 namespace { |
33 | 32 |
34 // Left or right margin. | 33 // Left or right margin. |
35 const int kPanelHorizMargin = 13; | 34 const int kPanelHorizMargin = 13; |
36 | 35 |
37 // Top or bottom margin. | 36 // Top or bottom margin. |
38 const int kPanelVertMargin = 20; | 37 const int kPanelVertMargin = 20; |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 GURL(chrome::kChromiumProjectURL)))); | 76 GURL(chrome::kChromiumProjectURL)))); |
78 return url.spec().c_str(); | 77 return url.spec().c_str(); |
79 } | 78 } |
80 | 79 |
81 gboolean OnEventBoxExpose(GtkWidget* event_box, | 80 gboolean OnEventBoxExpose(GtkWidget* event_box, |
82 GdkEventExpose* expose, | 81 GdkEventExpose* expose, |
83 gboolean user_data) { | 82 gboolean user_data) { |
84 cairo_t* cr = gdk_cairo_create(GDK_DRAWABLE(event_box->window)); | 83 cairo_t* cr = gdk_cairo_create(GDK_DRAWABLE(event_box->window)); |
85 gdk_cairo_rectangle(cr, &expose->area); | 84 gdk_cairo_rectangle(cr, &expose->area); |
86 cairo_clip(cr); | 85 cairo_clip(cr); |
87 GtkThemeService* theme_provider = | |
88 GtkThemeService::GetFrom(BrowserList::GetLastActive()->profile()); | |
89 CairoCachedSurface* background = theme_provider->GetSurfaceNamed( | |
90 IDR_ABOUT_BACKGROUND_COLOR, event_box); | |
91 | 86 |
92 background->SetSource(cr, 0, 0); | 87 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
| 88 gfx::CairoCachedSurface* background = |
| 89 rb.GetNativeImageNamed(IDR_ABOUT_BACKGROUND).ToCairo(); |
| 90 background->SetSource(cr, event_box, 0, 0); |
| 91 |
93 cairo_pattern_set_extend(cairo_get_source(cr), CAIRO_EXTEND_REPEAT); | 92 cairo_pattern_set_extend(cairo_get_source(cr), CAIRO_EXTEND_REPEAT); |
94 gdk_cairo_rectangle(cr, &expose->area); | 93 gdk_cairo_rectangle(cr, &expose->area); |
95 cairo_fill(cr); | 94 cairo_fill(cr); |
96 cairo_destroy(cr); | 95 cairo_destroy(cr); |
97 return FALSE; | 96 return FALSE; |
98 } | 97 } |
99 | 98 |
100 } // namespace | 99 } // namespace |
101 | 100 |
102 void ShowAboutDialogForProfile(GtkWindow* parent, Profile* profile) { | 101 void ShowAboutDialogForProfile(GtkWindow* parent, Profile* profile) { |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 ui::kContentAreaBorder, 0, | 269 ui::kContentAreaBorder, 0, |
271 ui::kContentAreaBorder, ui::kContentAreaBorder); | 270 ui::kContentAreaBorder, ui::kContentAreaBorder); |
272 gtk_container_add(GTK_CONTAINER(alignment), vbox); | 271 gtk_container_add(GTK_CONTAINER(alignment), vbox); |
273 gtk_box_pack_start(GTK_BOX(content_area), alignment, FALSE, FALSE, 0); | 272 gtk_box_pack_start(GTK_BOX(content_area), alignment, FALSE, FALSE, 0); |
274 | 273 |
275 g_signal_connect(dialog, "response", G_CALLBACK(OnResponse), NULL); | 274 g_signal_connect(dialog, "response", G_CALLBACK(OnResponse), NULL); |
276 gtk_window_set_resizable(GTK_WINDOW(dialog), FALSE); | 275 gtk_window_set_resizable(GTK_WINDOW(dialog), FALSE); |
277 gtk_widget_show_all(dialog); | 276 gtk_widget_show_all(dialog); |
278 gtk_widget_grab_focus(close_button); | 277 gtk_widget_grab_focus(close_button); |
279 } | 278 } |
OLD | NEW |