<commit_before>// Copyright (c) 2012 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.

#include "ui/views/examples/tree_view_example.h"

#include "base/utf_string_conversions.h"
#include "ui/views/controls/menu/menu_model_adapter.h"
#include "ui/views/controls/menu/menu_runner.h"
#include "ui/views/controls/tree/tree_view.h"
#include "ui/views/controls/tree/tree_view.h"
#include "ui/views/layout/grid_layout.h"

namespace views {
namespace examples {

TreeViewExample::TreeViewExample()
    : ExampleBase("Tree View"),
      model_(new NodeType(ASCIIToUTF16("root"), 1)) {
}

TreeViewExample::~TreeViewExample() {
  // Delete the view before the model.
  delete tree_view_;
  tree_view_ = NULL;
}

void TreeViewExample::CreateExampleView(View* container) {
  // Add some sample data.<commit_msg>views/examples: Fix crash when closing views examples window.<commit_after>// Copyright (c) 2012 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.

#include "ui/views/examples/tree_view_example.h"

#include "base/utf_string_conversions.h"
#include "ui/views/controls/menu/menu_model_adapter.h"
#include "ui/views/controls/menu/menu_runner.h"
#include "ui/views/controls/tree/tree_view.h"
#include "ui/views/controls/tree/tree_view.h"
#include "ui/views/layout/grid_layout.h"

namespace views {
namespace examples {

TreeViewExample::TreeViewExample()
    : ExampleBase("Tree View"),
      tree_view_(NULL),
      model_(new NodeType(ASCIIToUTF16("root"), 1)) {
}

TreeViewExample::~TreeViewExample() {
  // Delete the view before the model.
  delete tree_view_;
  tree_view_ = NULL;
}

void TreeViewExample::CreateExampleView(View* container) {
  // Add some sample data.
{'fraction_non_alphanumeric': 0.1223175965665236, 'fraction_numerical': 0.0075107296137339056, 'mean_word_length': 4.773993808049536, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6187208', 'n_tokens_mistral': 609, 'n_tokens_neox': 593, 'n_words': 149}