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

Side by Side Diff: chrome/browser/views/options/content_page_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 <windows.h> 5 #include <windows.h>
6 #include <shlobj.h> 6 #include <shlobj.h>
7 #include <vsstyle.h> 7 #include <vsstyle.h>
8 #include <vssym32.h> 8 #include <vssym32.h>
9 9
10 #include "chrome/browser/views/options/content_page_view.h" 10 #include "chrome/browser/views/options/content_page_view.h"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 class FileDisplayArea : public ChromeViews::View { 49 class FileDisplayArea : public ChromeViews::View {
50 public: 50 public:
51 FileDisplayArea(); 51 FileDisplayArea();
52 virtual ~FileDisplayArea(); 52 virtual ~FileDisplayArea();
53 53
54 void SetFile(const std::wstring& file_path); 54 void SetFile(const std::wstring& file_path);
55 55
56 // ChromeViews::View overrides: 56 // ChromeViews::View overrides:
57 virtual void Paint(ChromeCanvas* canvas); 57 virtual void Paint(ChromeCanvas* canvas);
58 virtual void Layout(); 58 virtual void Layout();
59 virtual void GetPreferredSize(CSize* out); 59 virtual gfx::Size GetPreferredSize();
60 60
61 protected: 61 protected:
62 // ChromeViews::View overrides: 62 // ChromeViews::View overrides:
63 virtual void ViewHierarchyChanged(bool is_add, 63 virtual void ViewHierarchyChanged(bool is_add,
64 ChromeViews::View* parent, 64 ChromeViews::View* parent,
65 ChromeViews::View* child); 65 ChromeViews::View* child);
66 66
67 private: 67 private:
68 void Init(); 68 void Init();
69 69
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 dc, EP_EDITTEXT, ETS_READONLY, 0, &rect, 104 dc, EP_EDITTEXT, ETS_READONLY, 0, &rect,
105 gfx::SkColorToCOLORREF(text_field_background_color_), true, true); 105 gfx::SkColorToCOLORREF(text_field_background_color_), true, true);
106 canvas->endPlatformPaint(); 106 canvas->endPlatformPaint();
107 canvas->DrawBitmapInt(default_folder_icon_, icon_bounds_.x(), 107 canvas->DrawBitmapInt(default_folder_icon_, icon_bounds_.x(),
108 icon_bounds_.y()); 108 icon_bounds_.y());
109 } 109 }
110 110
111 void FileDisplayArea::Layout() { 111 void FileDisplayArea::Layout() {
112 icon_bounds_.SetRect(kFileIconHorizontalSpacing, kFileIconVerticalSpacing, 112 icon_bounds_.SetRect(kFileIconHorizontalSpacing, kFileIconVerticalSpacing,
113 kFileIconSize, kFileIconSize); 113 kFileIconSize, kFileIconSize);
114 CSize ps; 114 gfx::Size ps = text_field_->GetPreferredSize();
115 text_field_->GetPreferredSize(&ps);
116 text_field_->SetBounds(icon_bounds_.right() + kFileIconTextFieldSpacing, 115 text_field_->SetBounds(icon_bounds_.right() + kFileIconTextFieldSpacing,
117 (height() - ps.cy) / 2, 116 (height() - ps.height()) / 2,
118 width() - icon_bounds_.right() - 117 width() - icon_bounds_.right() -
119 kFileIconHorizontalSpacing - 118 kFileIconHorizontalSpacing -
120 kFileIconTextFieldSpacing, ps.cy); 119 kFileIconTextFieldSpacing, ps.height());
121 } 120 }
122 121
123 void FileDisplayArea::GetPreferredSize(CSize* out) { 122 gfx::Size FileDisplayArea::GetPreferredSize() {
124 DCHECK(out); 123 return gfx::Size(kFileIconSize + 2 * kFileIconVerticalSpacing,
125 out->cx = kFileIconSize + 2 * kFileIconVerticalSpacing; 124 kFileIconSize + 2 * kFileIconHorizontalSpacing);
126 out->cy = kFileIconSize + 2 * kFileIconHorizontalSpacing;
127 } 125 }
128 126
129 void FileDisplayArea::ViewHierarchyChanged(bool is_add, 127 void FileDisplayArea::ViewHierarchyChanged(bool is_add,
130 ChromeViews::View* parent, 128 ChromeViews::View* parent,
131 ChromeViews::View* child) { 129 ChromeViews::View* child) {
132 if (!initialized_ && is_add && GetViewContainer()) 130 if (!initialized_ && is_add && GetViewContainer())
133 Init(); 131 Init();
134 } 132 }
135 133
136 void FileDisplayArea::Init() { 134 void FileDisplayArea::Init() {
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
433 contents, 431 contents,
434 l10n_util::GetString(IDS_OPTIONS_FONTSANDLANGUAGES_GROUP_NAME), 432 l10n_util::GetString(IDS_OPTIONS_FONTSANDLANGUAGES_GROUP_NAME),
435 L"", false); 433 L"", false);
436 } 434 }
437 435
438 void ContentPageView::UpdateDownloadDirectoryDisplay() { 436 void ContentPageView::UpdateDownloadDirectoryDisplay() {
439 download_default_download_location_display_->SetFile( 437 download_default_download_location_display_->SetFile(
440 default_download_location_.GetValue()); 438 default_download_location_.GetValue());
441 } 439 }
442 440
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698