| 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/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/stringprintf.h" | 10 #include "base/stringprintf.h" |
| 11 #include "ui/views/view.h" | 11 #include "ui/views/view.h" |
| 12 | 12 |
| 13 namespace views { | 13 namespace views { |
| 14 namespace examples { | 14 namespace examples { |
| 15 | 15 |
| 16 // Logs the specified string to the status area of the examples window. | 16 // Logs the specified string to the status area of the examples window. |
| 17 // This function can only be called if there is a visible examples window. | 17 // This function can only be called if there is a visible examples window. |
| 18 void LogStatus(const std::string& status); | 18 void LogStatus(const std::string& status); |
| 19 | 19 |
| 20 namespace { | 20 namespace { |
| 21 | 21 |
| 22 // Some of GTK based view classes require NativeWidgetGtk in the view | 22 // TODO(oshima): Check if this special container is still necessary. |
| 23 // parent chain. This class is used to defer the creation of such | |
| 24 // views until a NativeWidgetGtk is added to the view hierarchy. | |
| 25 class ContainerView : public View { | 23 class ContainerView : public View { |
| 26 public: | 24 public: |
| 27 explicit ContainerView(ExampleBase* base) | 25 explicit ContainerView(ExampleBase* base) |
| 28 : example_view_created_(false), | 26 : example_view_created_(false), |
| 29 example_base_(base) { | 27 example_base_(base) { |
| 30 } | 28 } |
| 31 | 29 |
| 32 private: | 30 private: |
| 33 // Overridden from View: | 31 // Overridden from View: |
| 34 virtual void ViewHierarchyChanged(bool is_add, | 32 virtual void ViewHierarchyChanged(bool is_add, |
| (...skipping 28 matching lines...) Expand all Loading... |
| 63 void ExampleBase::PrintStatus(const char* format, ...) { | 61 void ExampleBase::PrintStatus(const char* format, ...) { |
| 64 va_list ap; | 62 va_list ap; |
| 65 va_start(ap, format); | 63 va_start(ap, format); |
| 66 std::string msg; | 64 std::string msg; |
| 67 base::StringAppendV(&msg, format, ap); | 65 base::StringAppendV(&msg, format, ap); |
| 68 LogStatus(msg); | 66 LogStatus(msg); |
| 69 } | 67 } |
| 70 | 68 |
| 71 } // namespace examples | 69 } // namespace examples |
| 72 } // namespace views | 70 } // namespace views |
| OLD | NEW |