// Copyright 2020 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef UI_VIEWS_VIEW_UTILS_H_ #define UI_VIEWS_VIEW_UTILS_H_ #include #include "ui/views/metadata/metadata_types.h" #include "ui/views/view.h" namespace views { template bool IsViewClass(View* view) { static_assert(std::is_base_of::value, "Only View classes supported"); metadata::ClassMetaData* parent = V::MetaData(); metadata::ClassMetaData* child = view->GetClassMetaData(); while (child && child != parent) child = child->parent_class_meta_data(); return !!child; } } // namespace views #endif // UI_VIEWS_VIEW_UTILS_H_