| OLD | NEW |
| 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/examples/example_base.h" | 5 #include "ui/views/examples/example_base.h" |
| 6 | 6 |
| 7 #include <stdarg.h> | 7 #include <stdarg.h> |
| 8 | 8 |
| 9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
| 10 #include "ui/views/view.h" | 10 #include "ui/views/view.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 class ContainerView : public View { | 22 class ContainerView : public View { |
| 23 public: | 23 public: |
| 24 explicit ContainerView(ExampleBase* base) | 24 explicit ContainerView(ExampleBase* base) |
| 25 : example_view_created_(false), | 25 : example_view_created_(false), |
| 26 example_base_(base) { | 26 example_base_(base) { |
| 27 } | 27 } |
| 28 | 28 |
| 29 private: | 29 private: |
| 30 // View: | 30 // View: |
| 31 virtual void ViewHierarchyChanged( | 31 virtual void ViewHierarchyChanged( |
| 32 const ViewHierarchyChangedDetails& details) OVERRIDE { | 32 const ViewHierarchyChangedDetails& details) override { |
| 33 View::ViewHierarchyChanged(details); | 33 View::ViewHierarchyChanged(details); |
| 34 // We're not using child == this because a Widget may not be | 34 // We're not using child == this because a Widget may not be |
| 35 // available when this is added to the hierarchy. | 35 // available when this is added to the hierarchy. |
| 36 if (details.is_add && GetWidget() && !example_view_created_) { | 36 if (details.is_add && GetWidget() && !example_view_created_) { |
| 37 example_view_created_ = true; | 37 example_view_created_ = true; |
| 38 example_base_->CreateExampleView(this); | 38 example_base_->CreateExampleView(this); |
| 39 } | 39 } |
| 40 } | 40 } |
| 41 | 41 |
| 42 // True if the example view has already been created, or false otherwise. | 42 // True if the example view has already been created, or false otherwise. |
| (...skipping 16 matching lines...) Expand all Loading... |
| 59 void ExampleBase::PrintStatus(const char* format, ...) { | 59 void ExampleBase::PrintStatus(const char* format, ...) { |
| 60 va_list ap; | 60 va_list ap; |
| 61 va_start(ap, format); | 61 va_start(ap, format); |
| 62 std::string msg; | 62 std::string msg; |
| 63 base::StringAppendV(&msg, format, ap); | 63 base::StringAppendV(&msg, format, ap); |
| 64 LogStatus(msg); | 64 LogStatus(msg); |
| 65 } | 65 } |
| 66 | 66 |
| 67 } // namespace examples | 67 } // namespace examples |
| 68 } // namespace views | 68 } // namespace views |
| OLD | NEW |