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