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/constrained_window_gtk.h" | 5 #include "chrome/browser/ui/gtk/constrained_window_gtk.h" |
6 | 6 |
7 #include <gdk/gdkkeysyms.h> | 7 #include <gdk/gdkkeysyms.h> |
8 | 8 |
9 #include "chrome/browser/ui/browser_list.h" | 9 #include "chrome/browser/ui/browser_list.h" |
10 #include "chrome/browser/ui/gtk/gtk_util.h" | 10 #include "chrome/browser/ui/gtk/gtk_util.h" |
11 #include "content/browser/browser_thread.h" | 11 #include "content/browser/browser_thread.h" |
12 #include "content/browser/tab_contents/tab_contents.h" | 12 #include "content/browser/tab_contents/tab_contents.h" |
| 13 #include "ui/base/gtk/gtk_hig_constants.h" |
13 | 14 |
14 #if defined(TOUCH_UI) | 15 #if defined(TOUCH_UI) |
15 #include "chrome/browser/ui/views/tab_contents/tab_contents_view_touch.h" | 16 #include "chrome/browser/ui/views/tab_contents/tab_contents_view_touch.h" |
16 #elif defined(TOOLKIT_VIEWS) | 17 #elif defined(TOOLKIT_VIEWS) |
17 #include "chrome/browser/ui/views/tab_contents/native_tab_contents_view_gtk.h" | 18 #include "chrome/browser/ui/views/tab_contents/native_tab_contents_view_gtk.h" |
18 #include "chrome/browser/ui/views/tab_contents/tab_contents_view_views.h" | 19 #include "chrome/browser/ui/views/tab_contents/tab_contents_view_views.h" |
19 #else | 20 #else |
20 #include "chrome/browser/tab_contents/tab_contents_view_gtk.h" | 21 #include "chrome/browser/tab_contents/tab_contents_view_gtk.h" |
21 #endif | 22 #endif |
22 | 23 |
(...skipping 20 matching lines...) Expand all Loading... |
43 | 44 |
44 // Unlike other users of CreateBorderBin, we need a dedicated frame around | 45 // Unlike other users of CreateBorderBin, we need a dedicated frame around |
45 // our "window". | 46 // our "window". |
46 GtkWidget* ebox = gtk_event_box_new(); | 47 GtkWidget* ebox = gtk_event_box_new(); |
47 GtkWidget* frame = gtk_frame_new(NULL); | 48 GtkWidget* frame = gtk_frame_new(NULL); |
48 gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_OUT); | 49 gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_OUT); |
49 | 50 |
50 GtkWidget* alignment = gtk_alignment_new(0.0, 0.0, 1.0, 1.0); | 51 GtkWidget* alignment = gtk_alignment_new(0.0, 0.0, 1.0, 1.0); |
51 if (delegate->ShouldHaveBorderPadding()) { | 52 if (delegate->ShouldHaveBorderPadding()) { |
52 gtk_alignment_set_padding(GTK_ALIGNMENT(alignment), | 53 gtk_alignment_set_padding(GTK_ALIGNMENT(alignment), |
53 gtk_util::kContentAreaBorder, gtk_util::kContentAreaBorder, | 54 ui::kContentAreaBorder, ui::kContentAreaBorder, |
54 gtk_util::kContentAreaBorder, gtk_util::kContentAreaBorder); | 55 ui::kContentAreaBorder, ui::kContentAreaBorder); |
55 } | 56 } |
56 | 57 |
57 GdkColor background; | 58 GdkColor background; |
58 if (delegate->GetBackgroundColor(&background)) { | 59 if (delegate->GetBackgroundColor(&background)) { |
59 gtk_widget_modify_base(ebox, GTK_STATE_NORMAL, &background); | 60 gtk_widget_modify_base(ebox, GTK_STATE_NORMAL, &background); |
60 gtk_widget_modify_fg(ebox, GTK_STATE_NORMAL, &background); | 61 gtk_widget_modify_fg(ebox, GTK_STATE_NORMAL, &background); |
61 gtk_widget_modify_bg(ebox, GTK_STATE_NORMAL, &background); | 62 gtk_widget_modify_bg(ebox, GTK_STATE_NORMAL, &background); |
62 } | 63 } |
63 | 64 |
64 if (gtk_widget_get_parent(dialog)) | 65 if (gtk_widget_get_parent(dialog)) |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 } | 150 } |
150 | 151 |
151 void ConstrainedWindowGtk::OnHierarchyChanged(GtkWidget* sender, | 152 void ConstrainedWindowGtk::OnHierarchyChanged(GtkWidget* sender, |
152 GtkWidget* previous_toplevel) { | 153 GtkWidget* previous_toplevel) { |
153 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 154 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
154 if (!GTK_WIDGET_TOPLEVEL(gtk_widget_get_toplevel(widget()))) | 155 if (!GTK_WIDGET_TOPLEVEL(gtk_widget_get_toplevel(widget()))) |
155 return; | 156 return; |
156 | 157 |
157 FocusConstrainedWindow(); | 158 FocusConstrainedWindow(); |
158 } | 159 } |
OLD | NEW |