OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/chromeos/settings_page_view.h" | 5 #include "chrome/browser/chromeos/settings_page_view.h" |
6 | 6 |
7 #include "chrome/browser/chromeos/settings_contents_view.h" | 7 #include "chrome/browser/chromeos/settings_contents_view.h" |
8 #include "skia/ext/skia_utils_gtk.h" | 8 #include "skia/ext/skia_utils_gtk.h" |
9 #include "views/controls/label.h" | 9 #include "views/controls/label.h" |
10 #include "views/fill_layout.h" | 10 #include "views/fill_layout.h" |
11 #include "views/widget/widget_gtk.h" | 11 #include "views/widget/widget_gtk.h" |
12 | 12 |
| 13 namespace chromeos { |
| 14 |
13 SettingsPageView::SettingsPageView(Profile* profile) | 15 SettingsPageView::SettingsPageView(Profile* profile) |
14 : OptionsPageView(profile) { | 16 : OptionsPageView(profile) { |
15 SetLayoutManager(new views::FillLayout()); | 17 SetLayoutManager(new views::FillLayout()); |
16 } | 18 } |
17 | 19 |
18 GtkWidget* SettingsPageView::WrapInGtkWidget() { | 20 GtkWidget* SettingsPageView::WrapInGtkWidget() { |
19 views::WidgetGtk* widget = | 21 views::WidgetGtk* widget = |
20 new views::WidgetGtk(views::WidgetGtk::TYPE_CHILD); | 22 new views::WidgetGtk(views::WidgetGtk::TYPE_CHILD); |
21 widget->Init(NULL, gfx::Rect()); | 23 widget->Init(NULL, gfx::Rect()); |
22 widget->SetContentsView(this); | 24 widget->SetContentsView(this); |
23 // Set to a solid background with the same color as the widget's bg color. | 25 // Set to a solid background with the same color as the widget's bg color. |
24 GtkStyle* window_style = gtk_widget_get_style(widget->GetNativeView()); | 26 GtkStyle* window_style = gtk_widget_get_style(widget->GetNativeView()); |
25 set_background(views::Background::CreateSolidBackground( | 27 set_background(views::Background::CreateSolidBackground( |
26 skia::GdkColorToSkColor(window_style->bg[GTK_STATE_NORMAL]))); | 28 skia::GdkColorToSkColor(window_style->bg[GTK_STATE_NORMAL]))); |
27 widget->Show(); | 29 widget->Show(); |
28 // Removing the widget from the container results in unref'ing the widget. We | 30 // Removing the widget from the container results in unref'ing the widget. We |
29 // need to ref here otherwise the removal deletes the widget. The caller ends | 31 // need to ref here otherwise the removal deletes the widget. The caller ends |
30 // up taking ownership. | 32 // up taking ownership. |
31 g_object_ref(widget->GetNativeView()); | 33 g_object_ref(widget->GetNativeView()); |
32 GtkWidget* parent = gtk_widget_get_parent(widget->GetNativeView()); | 34 GtkWidget* parent = gtk_widget_get_parent(widget->GetNativeView()); |
33 gtk_container_remove(GTK_CONTAINER(parent), widget->GetNativeView()); | 35 gtk_container_remove(GTK_CONTAINER(parent), widget->GetNativeView()); |
34 return widget->GetNativeView(); | 36 return widget->GetNativeView(); |
35 } | 37 } |
36 | 38 |
37 void SettingsPageView::InitControlLayout() { | 39 void SettingsPageView::InitControlLayout() { |
38 // We'll likely need to make this scrollable | 40 // We'll likely need to make this scrollable |
39 settings_contents_view_ = new SettingsContentsView(profile()); | 41 settings_contents_view_ = new SettingsContentsView(profile()); |
40 AddChildView(settings_contents_view_); | 42 AddChildView(settings_contents_view_); |
41 } | 43 } |
| 44 |
| 45 } // namespace chromeos |
OLD | NEW |