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

Side by Side Diff: ui/views/examples/vector_example.cc

Issue 2278743002: Disallow non-postive sizes in vector icon views example. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 3 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/examples/vector_example.h" 5 #include "ui/views/examples/vector_example.h"
6 6
7 #include "base/files/file_path.h" 7 #include "base/files/file_path.h"
8 #include "base/files/file_util.h" 8 #include "base/files/file_util.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 UpdateImage(); 90 UpdateImage();
91 return true; 91 return true;
92 } 92 }
93 return false; 93 return false;
94 } 94 }
95 95
96 // TextfieldController implementation. 96 // TextfieldController implementation.
97 void ContentsChanged(Textfield* sender, 97 void ContentsChanged(Textfield* sender,
98 const base::string16& new_contents) override { 98 const base::string16& new_contents) override {
99 if (sender == size_input_) { 99 if (sender == size_input_) {
100 if (base::StringToInt(new_contents, &size_)) 100 if (base::StringToInt(new_contents, &size_) && (size_ > 0))
101 UpdateImage(); 101 UpdateImage();
102 else 102 else
103 size_input_->SetText(base::string16()); 103 size_input_->SetText(base::string16());
104 104
105 return; 105 return;
106 } 106 }
107 107
108 DCHECK_EQ(color_input_, sender); 108 DCHECK_EQ(color_input_, sender);
109 if (new_contents.size() != 8u) 109 if (new_contents.size() != 8u)
110 return; 110 return;
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 163
164 VectorExample::~VectorExample() {} 164 VectorExample::~VectorExample() {}
165 165
166 void VectorExample::CreateExampleView(View* container) { 166 void VectorExample::CreateExampleView(View* container) {
167 container->SetLayoutManager(new FillLayout()); 167 container->SetLayoutManager(new FillLayout());
168 container->AddChildView(new VectorIconGallery()); 168 container->AddChildView(new VectorIconGallery());
169 } 169 }
170 170
171 } // namespace examples 171 } // namespace examples
172 } // namespace views 172 } // namespace views
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698