summaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authormunjal@chromium.org <munjal@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-11 23:10:55 +0000
committermunjal@chromium.org <munjal@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-11 23:10:55 +0000
commite64e90172572f90ffb4633b90b1f5045a13a5aef (patch)
tree138d5db7c418369a87c70339439ae99e28192ebc /app
parentf5f241605193ceb9efad351d502814e3e3d33626 (diff)
downloadchromium_src-e64e90172572f90ffb4633b90b1f5045a13a5aef.zip
chromium_src-e64e90172572f90ffb4633b90b1f5045a13a5aef.tar.gz
chromium_src-e64e90172572f90ffb4633b90b1f5045a13a5aef.tar.bz2
Use string16 instead of wstring in bookmark data model.
Add overloads to bookmark model for string16. Wrap wstring versions in #if !defined since string16 is just a typedef of wstring on windows. TEST=exist BUG=32013 Review URL: http://codereview.chromium.org/536013 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@35964 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'app')
-rw-r--r--app/tree_model.h2
-rw-r--r--app/tree_node_model.h23
2 files changed, 22 insertions, 3 deletions
diff --git a/app/tree_model.h b/app/tree_model.h
index 86d6424..9ce6cb1 100644
--- a/app/tree_model.h
+++ b/app/tree_model.h
@@ -20,7 +20,7 @@ class TreeModel;
class TreeModelNode {
public:
// Returns the title for the node.
- virtual const std::wstring& GetTitle() const = 0;
+ virtual std::wstring GetTitle() const = 0;
protected:
virtual ~TreeModelNode() {}
diff --git a/app/tree_node_model.h b/app/tree_node_model.h
index 04aa997..b47fe03 100644
--- a/app/tree_node_model.h
+++ b/app/tree_node_model.h
@@ -6,6 +6,7 @@
#define APP_TREE_NODE_MODEL_H_
#include <algorithm>
+#include <string>
#include <vector>
#include "app/tree_model.h"
@@ -13,6 +14,8 @@
#include "base/scoped_ptr.h"
#include "base/scoped_vector.h"
#include "base/stl_util-inl.h"
+#include "base/string16.h"
+#include "base/utf_string_conversions.h"
// TreeNodeModel and TreeNodes provide an implementation of TreeModel around
// TreeNodes. TreeNodes form a directed acyclic graph.
@@ -65,7 +68,12 @@ class TreeNode : public TreeModelNode {
public:
TreeNode() : parent_(NULL) { }
+ // TODO(munjal): Remove wstring overload once all code is moved to string16.
+#if !defined(WCHAR_T_IS_UTF16)
explicit TreeNode(const std::wstring& title)
+ : title_(WideToUTF16(title)), parent_(NULL) {}
+#endif
+ explicit TreeNode(const string16& title)
: title_(title), parent_(NULL) {}
virtual ~TreeNode() {
@@ -144,12 +152,23 @@ class TreeNode : public TreeModelNode {
}
// Sets the title of the node.
+ // TODO(munjal): Remove wstring overload once all code is moved to string16.
+#if !defined(WCHAR_T_IS_UTF16)
void SetTitle(const std::wstring& string) {
+ title_ = WideToUTF16(string);
+ }
+#endif
+ void SetTitle(const string16& string) {
title_ = string;
}
+ // TODO(munjal): Remove wstring version and rename GetTitleAsString16 to
+ // GetTitle once all code is moved to string16.
// Returns the title of the node.
- virtual const std::wstring& GetTitle() const {
+ virtual std::wstring GetTitle() const {
+ return UTF16ToWide(title_);
+ }
+ virtual const string16& GetTitleAsString16() const {
return title_;
}
@@ -171,7 +190,7 @@ class TreeNode : public TreeModelNode {
private:
// Title displayed in the tree.
- std::wstring title_;
+ string16 title_;
NodeType* parent_;