Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(103)

Side by Side Diff: chrome/browser/views/options/options_window_view.cc

Issue 2812026: Auto-size the views version of the options dialog. (Closed)
Patch Set: Fix autosizing issue with gtk pref pages in chromeos options dialog. Created 10 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2010 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/options_window.h" 5 #include "chrome/browser/options_window.h"
6 6
7 #include "app/l10n_util.h" 7 #include "app/l10n_util.h"
8 #include "app/resource_bundle.h" 8 #include "app/resource_bundle.h"
9 #include "chrome/browser/browser_list.h" 9 #include "chrome/browser/browser_list.h"
10 #include "chrome/browser/browser_process.h" 10 #include "chrome/browser/browser_process.h"
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 return true; 176 return true;
177 } 177 }
178 178
179 void OptionsWindowView::Layout() { 179 void OptionsWindowView::Layout() {
180 tabs_->SetBounds(kDialogPadding, kDialogPadding, 180 tabs_->SetBounds(kDialogPadding, kDialogPadding,
181 width() - (2 * kDialogPadding), 181 width() - (2 * kDialogPadding),
182 height() - (2 * kDialogPadding)); 182 height() - (2 * kDialogPadding));
183 } 183 }
184 184
185 gfx::Size OptionsWindowView::GetPreferredSize() { 185 gfx::Size OptionsWindowView::GetPreferredSize() {
186 return gfx::Size(views::Window::GetLocalizedContentsSize( 186 gfx::Size size(tabs_->GetPreferredSize());
187 IDS_OPTIONS_DIALOG_WIDTH_CHARS, 187 size.Enlarge(2 * kDialogPadding, 2 * kDialogPadding);
188 IDS_OPTIONS_DIALOG_HEIGHT_LINES)); 188 return size;
189 } 189 }
190 190
191 void OptionsWindowView::ViewHierarchyChanged(bool is_add, 191 void OptionsWindowView::ViewHierarchyChanged(bool is_add,
192 views::View* parent, 192 views::View* parent,
193 views::View* child) { 193 views::View* child) {
194 // Can't init before we're inserted into a Container, because we require a 194 // Can't init before we're inserted into a Container, because we require a
195 // HWND to parent native child controls to. 195 // HWND to parent native child controls to.
196 if (is_add && child == this) 196 if (is_add && child == this)
197 Init(); 197 Init();
198 } 198 }
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 // If there's already an existing options window, activate it and switch to 240 // If there's already an existing options window, activate it and switch to
241 // the specified page. 241 // the specified page.
242 // TODO(beng): note this is not multi-simultaneous-profile-safe. When we care 242 // TODO(beng): note this is not multi-simultaneous-profile-safe. When we care
243 // about this case this will have to be fixed. 243 // about this case this will have to be fixed.
244 if (!instance_) { 244 if (!instance_) {
245 instance_ = new OptionsWindowView(profile); 245 instance_ = new OptionsWindowView(profile);
246 views::Window::CreateChromeWindow(NULL, gfx::Rect(), instance_); 246 views::Window::CreateChromeWindow(NULL, gfx::Rect(), instance_);
247 } 247 }
248 instance_->ShowOptionsPage(page, highlight_group); 248 instance_->ShowOptionsPage(page, highlight_group);
249 } 249 }
OLDNEW
« no previous file with comments | « chrome/browser/views/options/general_page_view.cc ('k') | chrome/browser/views/tab_contents/tab_contents_view_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698