| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #ifndef APP_TREE_NODE_MODEL_H_ | 5 #ifndef APP_TREE_NODE_MODEL_H_ |
| 6 #define APP_TREE_NODE_MODEL_H_ | 6 #define APP_TREE_NODE_MODEL_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 DCHECK(node); | 266 DCHECK(node); |
| 267 return AsNode(node)->GetParent(); | 267 return AsNode(node)->GetParent(); |
| 268 } | 268 } |
| 269 | 269 |
| 270 NodeType* AsNode(TreeModelNode* model_node) { | 270 NodeType* AsNode(TreeModelNode* model_node) { |
| 271 return static_cast<NodeType*>(model_node); | 271 return static_cast<NodeType*>(model_node); |
| 272 } | 272 } |
| 273 | 273 |
| 274 // Sets the title of the specified node. | 274 // Sets the title of the specified node. |
| 275 virtual void SetTitle(TreeModelNode* node, | 275 virtual void SetTitle(TreeModelNode* node, |
| 276 const std::wstring& title) { | 276 const string16& title) { |
| 277 DCHECK(node); | 277 DCHECK(node); |
| 278 AsNode(node)->SetTitle(WideToUTF16Hack(title)); | 278 AsNode(node)->SetTitle(title); |
| 279 NotifyObserverTreeNodeChanged(node); | 279 NotifyObserverTreeNodeChanged(node); |
| 280 } | 280 } |
| 281 | 281 |
| 282 void Add(NodeType* parent, int index, NodeType* child) { | 282 void Add(NodeType* parent, int index, NodeType* child) { |
| 283 DCHECK(parent && child); | 283 DCHECK(parent && child); |
| 284 parent->Add(index, child); | 284 parent->Add(index, child); |
| 285 NotifyObserverTreeNodesAdded(parent, index, 1); | 285 NotifyObserverTreeNodesAdded(parent, index, 1); |
| 286 } | 286 } |
| 287 | 287 |
| 288 NodeType* Remove(NodeType* parent, int index) { | 288 NodeType* Remove(NodeType* parent, int index) { |
| (...skipping 27 matching lines...) Expand all Loading... |
| 316 private: | 316 private: |
| 317 // The observers. | 317 // The observers. |
| 318 ObserverList<TreeModelObserver> observer_list_; | 318 ObserverList<TreeModelObserver> observer_list_; |
| 319 // The root. | 319 // The root. |
| 320 scoped_ptr<NodeType> root_; | 320 scoped_ptr<NodeType> root_; |
| 321 | 321 |
| 322 DISALLOW_COPY_AND_ASSIGN(TreeNodeModel); | 322 DISALLOW_COPY_AND_ASSIGN(TreeNodeModel); |
| 323 }; | 323 }; |
| 324 | 324 |
| 325 #endif // APP_TREE_NODE_MODEL_H_ | 325 #endif // APP_TREE_NODE_MODEL_H_ |
| OLD | NEW |