| 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/views/options/content_settings_window_view.h" | 5 #include "chrome/browser/ui/views/options/content_settings_window_view.h" |
| 6 | 6 |
| 7 #include "base/stl_util-inl.h" | 7 #include "base/stl_util-inl.h" |
| 8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
| 9 #include "chrome/browser/prefs/pref_service.h" | 9 #include "chrome/browser/prefs/pref_service.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 label_->SetBounds(kDialogPadding, | 122 label_->SetBounds(kDialogPadding, |
| 123 kDialogPadding, | 123 kDialogPadding, |
| 124 listbox_width, | 124 listbox_width, |
| 125 label_->GetPreferredSize().height()); | 125 label_->GetPreferredSize().height()); |
| 126 | 126 |
| 127 listbox_->SetBounds(kDialogPadding, | 127 listbox_->SetBounds(kDialogPadding, |
| 128 2 * kDialogPadding + label_->height(), | 128 2 * kDialogPadding + label_->height(), |
| 129 listbox_width, | 129 listbox_width, |
| 130 height() - (3 * kDialogPadding) - label_->height()); | 130 height() - (3 * kDialogPadding) - label_->height()); |
| 131 | 131 |
| 132 if (pages_[current_page_]->GetParent()) { | 132 if (pages_[current_page_]->parent()) { |
| 133 pages_[current_page_]->SetBounds( | 133 pages_[current_page_]->SetBounds( |
| 134 2 * kDialogPadding + listbox_width, | 134 2 * kDialogPadding + listbox_width, |
| 135 2 * kDialogPadding + label_->height(), | 135 2 * kDialogPadding + label_->height(), |
| 136 width() - (3 * kDialogPadding) - listbox_width, | 136 width() - (3 * kDialogPadding) - listbox_width, |
| 137 height() - (2 * kDialogPadding)); | 137 height() - (2 * kDialogPadding)); |
| 138 } | 138 } |
| 139 } | 139 } |
| 140 | 140 |
| 141 gfx::Size ContentSettingsWindowView::GetPreferredSize() { | 141 gfx::Size ContentSettingsWindowView::GetPreferredSize() { |
| 142 return gfx::Size(views::Window::GetLocalizedContentsSize( | 142 return gfx::Size(views::Window::GetLocalizedContentsSize( |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 strings.push_back(l10n_util::GetStringUTF16(IDS_PLUGIN_TAB_LABEL)); | 189 strings.push_back(l10n_util::GetStringUTF16(IDS_PLUGIN_TAB_LABEL)); |
| 190 strings.push_back(l10n_util::GetStringUTF16(IDS_POPUP_TAB_LABEL)); | 190 strings.push_back(l10n_util::GetStringUTF16(IDS_POPUP_TAB_LABEL)); |
| 191 strings.push_back(l10n_util::GetStringUTF16(IDS_GEOLOCATION_TAB_LABEL)); | 191 strings.push_back(l10n_util::GetStringUTF16(IDS_GEOLOCATION_TAB_LABEL)); |
| 192 strings.push_back(l10n_util::GetStringUTF16(IDS_NOTIFICATIONS_TAB_LABEL)); | 192 strings.push_back(l10n_util::GetStringUTF16(IDS_NOTIFICATIONS_TAB_LABEL)); |
| 193 listbox_ = new views::Listbox(strings, this); | 193 listbox_ = new views::Listbox(strings, this); |
| 194 AddChildView(listbox_); | 194 AddChildView(listbox_); |
| 195 CHECK_EQ(strings.size(), pages_.size()); | 195 CHECK_EQ(strings.size(), pages_.size()); |
| 196 } | 196 } |
| 197 | 197 |
| 198 void ContentSettingsWindowView::ShowSettingsPage(int page) { | 198 void ContentSettingsWindowView::ShowSettingsPage(int page) { |
| 199 if (pages_[current_page_]->GetParent()) | 199 if (pages_[current_page_]->parent()) |
| 200 RemoveChildView(pages_[current_page_]); | 200 RemoveChildView(pages_[current_page_]); |
| 201 current_page_ = page; | 201 current_page_ = page; |
| 202 AddChildView(pages_[current_page_]); | 202 AddChildView(pages_[current_page_]); |
| 203 Layout(); | 203 Layout(); |
| 204 SchedulePaint(); | 204 SchedulePaint(); |
| 205 } | 205 } |
| 206 | 206 |
| 207 const OptionsPageView* | 207 const OptionsPageView* |
| 208 ContentSettingsWindowView::GetCurrentContentSettingsTabView() const { | 208 ContentSettingsWindowView::GetCurrentContentSettingsTabView() const { |
| 209 return static_cast<OptionsPageView*>(pages_[current_page_]); | 209 return static_cast<OptionsPageView*>(pages_[current_page_]); |
| 210 } | 210 } |
| OLD | NEW |