| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/options/settings_page_view.h" | 5 #include "chrome/browser/chromeos/options/settings_page_view.h" |
| 6 | 6 |
| 7 #include "skia/ext/skia_utils_gtk.h" | 7 #include "app/gfx/skia_utils_gtk.h" |
| 8 #include "views/controls/label.h" | 8 #include "views/controls/label.h" |
| 9 #include "views/fill_layout.h" | 9 #include "views/fill_layout.h" |
| 10 #include "views/widget/widget_gtk.h" | 10 #include "views/widget/widget_gtk.h" |
| 11 | 11 |
| 12 namespace chromeos { | 12 namespace chromeos { |
| 13 | 13 |
| 14 SettingsPageView::SettingsPageView(Profile* profile) | 14 SettingsPageView::SettingsPageView(Profile* profile) |
| 15 : OptionsPageView(profile) { | 15 : OptionsPageView(profile) { |
| 16 SetLayoutManager(new views::FillLayout()); | 16 SetLayoutManager(new views::FillLayout()); |
| 17 } | 17 } |
| 18 | 18 |
| 19 GtkWidget* SettingsPageView::WrapInGtkWidget() { | 19 GtkWidget* SettingsPageView::WrapInGtkWidget() { |
| 20 views::WidgetGtk* widget = | 20 views::WidgetGtk* widget = |
| 21 new views::WidgetGtk(views::WidgetGtk::TYPE_CHILD); | 21 new views::WidgetGtk(views::WidgetGtk::TYPE_CHILD); |
| 22 widget->Init(NULL, gfx::Rect()); | 22 widget->Init(NULL, gfx::Rect()); |
| 23 widget->SetContentsView(this); | 23 widget->SetContentsView(this); |
| 24 // Set to a solid background with the same color as the widget's bg color. | 24 // Set to a solid background with the same color as the widget's bg color. |
| 25 GtkStyle* window_style = gtk_widget_get_style(widget->GetNativeView()); | 25 GtkStyle* window_style = gtk_widget_get_style(widget->GetNativeView()); |
| 26 set_background(views::Background::CreateSolidBackground( | 26 set_background(views::Background::CreateSolidBackground( |
| 27 skia::GdkColorToSkColor(window_style->bg[GTK_STATE_NORMAL]))); | 27 gfx::GdkColorToSkColor(window_style->bg[GTK_STATE_NORMAL]))); |
| 28 widget->Show(); | 28 widget->Show(); |
| 29 // Removing the widget from the container results in unref'ing the widget. We | 29 // Removing the widget from the container results in unref'ing the widget. We |
| 30 // need to ref here otherwise the removal deletes the widget. The caller ends | 30 // need to ref here otherwise the removal deletes the widget. The caller ends |
| 31 // up taking ownership. | 31 // up taking ownership. |
| 32 g_object_ref(widget->GetNativeView()); | 32 g_object_ref(widget->GetNativeView()); |
| 33 GtkWidget* parent = gtk_widget_get_parent(widget->GetNativeView()); | 33 GtkWidget* parent = gtk_widget_get_parent(widget->GetNativeView()); |
| 34 gtk_container_remove(GTK_CONTAINER(parent), widget->GetNativeView()); | 34 gtk_container_remove(GTK_CONTAINER(parent), widget->GetNativeView()); |
| 35 return widget->GetNativeView(); | 35 return widget->GetNativeView(); |
| 36 } | 36 } |
| 37 | 37 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 GridLayout::USE_PREF, 0, 0); | 85 GridLayout::USE_PREF, 0, 0); |
| 86 column_set->AddPaddingColumn(0, kRelatedControlHorizontalSpacing); | 86 column_set->AddPaddingColumn(0, kRelatedControlHorizontalSpacing); |
| 87 column_set->AddColumn(GridLayout::FILL, GridLayout::CENTER, 1, | 87 column_set->AddColumn(GridLayout::FILL, GridLayout::CENTER, 1, |
| 88 GridLayout::USE_PREF, 0, 0); | 88 GridLayout::USE_PREF, 0, 0); |
| 89 | 89 |
| 90 InitContents(child_layout); | 90 InitContents(child_layout); |
| 91 layout->AddView(contents); | 91 layout->AddView(contents); |
| 92 } | 92 } |
| 93 | 93 |
| 94 } // namespace chromeos | 94 } // namespace chromeos |
| OLD | NEW |