Remove wstrings from bookmarks, part 9.

This actually converts TreeNodeModel::SetTitle(node, title); this is used by
bookmarks.

BUG=23581
TEST=builds nad passes tests

Review URL: http://codereview.chromium.org/3111024

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@57007 0039d316-1c4b-4281-b951-d872f2087c98
parent 824e9f50
// Copyright (c) 2009 The Chromium Authors. All rights reserved. // Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include <vector> #include <vector>
#include "base/logging.h" #include "base/logging.h"
#include "base/string16.h"
class SkBitmap; class SkBitmap;
...@@ -21,7 +22,9 @@ class TreeModel; ...@@ -21,7 +22,9 @@ class TreeModel;
class TreeModelNode { class TreeModelNode {
public: public:
// Returns the title for the node. // Returns the title for the node.
// TODO(viettrungluu): remove wstring version and rename string16 version.
virtual std::wstring GetTitle() const = 0; virtual std::wstring GetTitle() const = 0;
virtual const string16& GetTitleAsString16() const = 0;
protected: protected:
virtual ~TreeModelNode() {} virtual ~TreeModelNode() {}
...@@ -79,7 +82,7 @@ class TreeModel { ...@@ -79,7 +82,7 @@ class TreeModel {
// Sets the title of the specified node. // Sets the title of the specified node.
// This is only invoked if the node is editable and the user edits a node. // This is only invoked if the node is editable and the user edits a node.
virtual void SetTitle(TreeModelNode* node, virtual void SetTitle(TreeModelNode* node,
const std::wstring& title) { const string16& title) {
NOTREACHED(); NOTREACHED();
} }
......
...@@ -273,9 +273,9 @@ class TreeNodeModel : public TreeModel { ...@@ -273,9 +273,9 @@ class TreeNodeModel : public TreeModel {
// Sets the title of the specified node. // Sets the title of the specified node.
virtual void SetTitle(TreeModelNode* node, virtual void SetTitle(TreeModelNode* node,
const std::wstring& title) { const string16& title) {
DCHECK(node); DCHECK(node);
AsNode(node)->SetTitle(WideToUTF16Hack(title)); AsNode(node)->SetTitle(title);
NotifyObserverTreeNodeChanged(node); NotifyObserverTreeNodeChanged(node);
} }
......
...@@ -281,7 +281,7 @@ TEST_F(TreeNodeModelTest, SetTitle) { ...@@ -281,7 +281,7 @@ TEST_F(TreeNodeModelTest, SetTitle) {
ClearCounts(); ClearCounts();
const string16 title(ASCIIToUTF16("root2")); const string16 title(ASCIIToUTF16("root2"));
model.SetTitle(root, UTF16ToWideHack(title)); model.SetTitle(root, title);
AssertObserverCount(0, 0, 1); AssertObserverCount(0, 0, 1);
EXPECT_EQ(title, root->GetTitleAsString16()); EXPECT_EQ(title, root->GetTitleAsString16());
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment