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 "views/controls/label.h" | 8 #include "views/controls/label.h" |
8 #include "views/fill_layout.h" | 9 #include "views/fill_layout.h" |
9 #include "views/widget/widget_gtk.h" | 10 #include "views/widget/widget_gtk.h" |
10 | 11 |
11 SettingsPageView::SettingsPageView(Profile* profile) | 12 SettingsPageView::SettingsPageView(Profile* profile) |
12 : OptionsPageView(profile) { | 13 : OptionsPageView(profile) { |
13 SetLayoutManager(new views::FillLayout()); | 14 SetLayoutManager(new views::FillLayout()); |
14 } | 15 } |
15 | 16 |
16 GtkWidget* SettingsPageView::WrapInGtkWidget() { | 17 GtkWidget* SettingsPageView::WrapInGtkWidget() { |
17 views::WidgetGtk* widget = | 18 views::WidgetGtk* widget = |
18 new views::WidgetGtk(views::WidgetGtk::TYPE_CHILD); | 19 new views::WidgetGtk(views::WidgetGtk::TYPE_CHILD); |
19 widget->Init(NULL, gfx::Rect()); | 20 widget->Init(NULL, gfx::Rect()); |
20 widget->SetContentsView(this); | 21 widget->SetContentsView(this); |
21 widget->Show(); | 22 widget->Show(); |
22 // Removing the widget from the container results in unref'ing the widget. We | 23 // Removing the widget from the container results in unref'ing the widget. We |
23 // need to ref here otherwise the removal deletes the widget. The caller ends | 24 // need to ref here otherwise the removal deletes the widget. The caller ends |
24 // up taking ownership. | 25 // up taking ownership. |
25 g_object_ref(widget->GetNativeView()); | 26 g_object_ref(widget->GetNativeView()); |
26 GtkWidget* parent = gtk_widget_get_parent(widget->GetNativeView()); | 27 GtkWidget* parent = gtk_widget_get_parent(widget->GetNativeView()); |
27 gtk_container_remove(GTK_CONTAINER(parent), widget->GetNativeView()); | 28 gtk_container_remove(GTK_CONTAINER(parent), widget->GetNativeView()); |
28 return widget->GetNativeView(); | 29 return widget->GetNativeView(); |
29 } | 30 } |
30 | 31 |
31 void SettingsPageView::InitControlLayout() { | 32 void SettingsPageView::InitControlLayout() { |
32 // Remove this and add the real views we want. We'll likely need to make this | 33 // We'll likely need to make this scrollable |
33 // scrollable as well. | 34 settings_contents_view_ = new SettingsContentsView(profile()); |
34 AddChildView(new views::Label(L"Implement me")); | 35 AddChildView(settings_contents_view_); |
35 } | 36 } |
OLD | NEW |