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

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

Issue 7344: Convert GetPreferredSize from:... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 12 years, 2 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 "chrome/app/locales/locale_settings.h" 7 #include "chrome/app/locales/locale_settings.h"
8 #include "chrome/browser/browser_process.h" 8 #include "chrome/browser/browser_process.h"
9 #include "chrome/browser/profile.h" 9 #include "chrome/browser/profile.h"
10 #include "chrome/browser/views/options/advanced_page_view.h" 10 #include "chrome/browser/views/options/advanced_page_view.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 virtual std::wstring GetWindowTitle() const; 46 virtual std::wstring GetWindowTitle() const;
47 virtual void WindowClosing(); 47 virtual void WindowClosing();
48 virtual bool Cancel(); 48 virtual bool Cancel();
49 virtual ChromeViews::View* GetContentsView(); 49 virtual ChromeViews::View* GetContentsView();
50 50
51 // ChromeViews::TabbedPane::Listener implementation: 51 // ChromeViews::TabbedPane::Listener implementation:
52 virtual void TabSelectedAt(int index); 52 virtual void TabSelectedAt(int index);
53 53
54 // ChromeViews::View overrides: 54 // ChromeViews::View overrides:
55 virtual void Layout(); 55 virtual void Layout();
56 virtual void GetPreferredSize(CSize* out); 56 virtual gfx::Size GetPreferredSize();
57 57
58 protected: 58 protected:
59 // ChromeViews::View overrides: 59 // ChromeViews::View overrides:
60 virtual void ViewHierarchyChanged(bool is_add, 60 virtual void ViewHierarchyChanged(bool is_add,
61 ChromeViews::View* parent, 61 ChromeViews::View* parent,
62 ChromeViews::View* child); 62 ChromeViews::View* child);
63 private: 63 private:
64 // Init the assorted Tabbed pages 64 // Init the assorted Tabbed pages
65 void Init(); 65 void Init();
66 66
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 156
157 /////////////////////////////////////////////////////////////////////////////// 157 ///////////////////////////////////////////////////////////////////////////////
158 // OptionsWindowView, ChromeViews::View overrides: 158 // OptionsWindowView, ChromeViews::View overrides:
159 159
160 void OptionsWindowView::Layout() { 160 void OptionsWindowView::Layout() {
161 tabs_->SetBounds(kDialogPadding, kDialogPadding, 161 tabs_->SetBounds(kDialogPadding, kDialogPadding,
162 width() - (2 * kDialogPadding), 162 width() - (2 * kDialogPadding),
163 height() - (2 * kDialogPadding)); 163 height() - (2 * kDialogPadding));
164 } 164 }
165 165
166 void OptionsWindowView::GetPreferredSize(CSize* out) { 166 gfx::Size OptionsWindowView::GetPreferredSize() {
167 DCHECK(out); 167 return gfx::Size(ChromeViews::Window::GetLocalizedContentsSize(
168 *out = ChromeViews::Window::GetLocalizedContentsSize(
169 IDS_OPTIONS_DIALOG_WIDTH_CHARS, 168 IDS_OPTIONS_DIALOG_WIDTH_CHARS,
170 IDS_OPTIONS_DIALOG_HEIGHT_LINES).ToSIZE(); 169 IDS_OPTIONS_DIALOG_HEIGHT_LINES));
171 } 170 }
172 171
173 void OptionsWindowView::ViewHierarchyChanged(bool is_add, 172 void OptionsWindowView::ViewHierarchyChanged(bool is_add,
174 ChromeViews::View* parent, 173 ChromeViews::View* parent,
175 ChromeViews::View* child) { 174 ChromeViews::View* child) {
176 // Can't init before we're inserted into a ViewContainer, because we require 175 // Can't init before we're inserted into a ViewContainer, because we require
177 // a HWND to parent native child controls to. 176 // a HWND to parent native child controls to.
178 if (is_add && child == this) 177 if (is_add && child == this)
179 Init(); 178 Init();
180 } 179 }
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 // TODO(beng): note this is not multi-simultaneous-profile-safe. When we care 219 // TODO(beng): note this is not multi-simultaneous-profile-safe. When we care
221 // about this case this will have to be fixed. 220 // about this case this will have to be fixed.
222 if (!instance_) { 221 if (!instance_) {
223 instance_ = new OptionsWindowView(profile); 222 instance_ = new OptionsWindowView(profile);
224 ChromeViews::Window::CreateChromeWindow(NULL, gfx::Rect(), instance_); 223 ChromeViews::Window::CreateChromeWindow(NULL, gfx::Rect(), instance_);
225 // The window is alive by itself now... 224 // The window is alive by itself now...
226 } 225 }
227 instance_->ShowOptionsPage(page, highlight_group); 226 instance_->ShowOptionsPage(page, highlight_group);
228 } 227 }
229 228
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698