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

Side by Side Diff: ui/views/test/child_modal_window.cc

Issue 273223002: views: Make view::Views::GetPreferredSize() const. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: More compile fix for ToT Created 6 years, 7 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
« no previous file with comments | « ui/views/layout/layout_manager.cc ('k') | ui/views/test/test_views.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "ui/views/test/child_modal_window.h" 5 #include "ui/views/test/child_modal_window.h"
6 6
7 #include "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "ui/aura/window.h" 8 #include "ui/aura/window.h"
9 #include "ui/gfx/canvas.h" 9 #include "ui/gfx/canvas.h"
10 #include "ui/views/background.h" 10 #include "ui/views/background.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 54
55 55
56 class ChildModalWindow : public WidgetDelegateView { 56 class ChildModalWindow : public WidgetDelegateView {
57 public: 57 public:
58 ChildModalWindow(); 58 ChildModalWindow();
59 virtual ~ChildModalWindow(); 59 virtual ~ChildModalWindow();
60 60
61 private: 61 private:
62 // Overridden from View: 62 // Overridden from View:
63 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; 63 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE;
64 virtual gfx::Size GetPreferredSize() OVERRIDE; 64 virtual gfx::Size GetPreferredSize() const OVERRIDE;
65 65
66 // Overridden from WidgetDelegate: 66 // Overridden from WidgetDelegate:
67 virtual View* GetContentsView() OVERRIDE; 67 virtual View* GetContentsView() OVERRIDE;
68 virtual base::string16 GetWindowTitle() const OVERRIDE; 68 virtual base::string16 GetWindowTitle() const OVERRIDE;
69 virtual bool CanResize() const OVERRIDE; 69 virtual bool CanResize() const OVERRIDE;
70 virtual ui::ModalType GetModalType() const OVERRIDE; 70 virtual ui::ModalType GetModalType() const OVERRIDE;
71 71
72 DISALLOW_COPY_AND_ASSIGN(ChildModalWindow); 72 DISALLOW_COPY_AND_ASSIGN(ChildModalWindow);
73 }; 73 };
74 74
75 ChildModalWindow::ChildModalWindow() { 75 ChildModalWindow::ChildModalWindow() {
76 Textfield* textfield = new Textfield; 76 Textfield* textfield = new Textfield;
77 AddChildView(textfield); 77 AddChildView(textfield);
78 textfield->SetBounds( 78 textfield->SetBounds(
79 kChildTextfieldLeft, kChildTextfieldTop, 79 kChildTextfieldLeft, kChildTextfieldTop,
80 kChildTextfieldWidth, kChildTextfieldHeight); 80 kChildTextfieldWidth, kChildTextfieldHeight);
81 } 81 }
82 82
83 ChildModalWindow::~ChildModalWindow() { 83 ChildModalWindow::~ChildModalWindow() {
84 } 84 }
85 85
86 void ChildModalWindow::OnPaint(gfx::Canvas* canvas) { 86 void ChildModalWindow::OnPaint(gfx::Canvas* canvas) {
87 canvas->FillRect(GetLocalBounds(), kChildColor); 87 canvas->FillRect(GetLocalBounds(), kChildColor);
88 } 88 }
89 89
90 gfx::Size ChildModalWindow::GetPreferredSize() { 90 gfx::Size ChildModalWindow::GetPreferredSize() const {
91 return gfx::Size(kChildWindowWidth, kChildWindowHeight); 91 return gfx::Size(kChildWindowWidth, kChildWindowHeight);
92 } 92 }
93 93
94 View* ChildModalWindow::GetContentsView() { 94 View* ChildModalWindow::GetContentsView() {
95 return this; 95 return this;
96 } 96 }
97 97
98 base::string16 ChildModalWindow::GetWindowTitle() const { 98 base::string16 ChildModalWindow::GetWindowTitle() const {
99 return base::ASCIIToUTF16("Examples: Child Modal Window"); 99 return base::ASCIIToUTF16("Examples: Child Modal Window");
100 } 100 }
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 209
210 void ChildModalParent::OnWidgetDestroying(Widget* widget) { 210 void ChildModalParent::OnWidgetDestroying(Widget* widget) {
211 if (child_) { 211 if (child_) {
212 DCHECK_EQ(child_, widget); 212 DCHECK_EQ(child_, widget);
213 child_ = NULL; 213 child_ = NULL;
214 } 214 }
215 } 215 }
216 216
217 } // namespace test 217 } // namespace test
218 } // namespace views 218 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/layout/layout_manager.cc ('k') | ui/views/test/test_views.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698