| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |