Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(124)

Side by Side Diff: chrome/browser/bookmarks/bookmark_codec.cc

Issue 9471: Adds import/export of bookmarks to bookmarks.html file.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 12 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 #include "chrome/browser/bookmarks/bookmark_codec.h" 5 #include "chrome/browser/bookmarks/bookmark_codec.h"
6 6
7 #include "base/string_util.h" 7 #include "base/string_util.h"
8 #include "base/values.h" 8 #include "base/values.h"
9 #include "chrome/browser/bookmarks/bookmark_model.h" 9 #include "chrome/browser/bookmarks/bookmark_model.h"
10 #include "chrome/common/l10n_util.h" 10 #include "chrome/common/l10n_util.h"
11 #include "googleurl/src/gurl.h" 11 #include "googleurl/src/gurl.h"
12 12
13 #include "generated_resources.h" 13 #include "generated_resources.h"
14 14
15 using base::Time; 15 using base::Time;
16 16
17 // Key names. 17 const wchar_t* BookmarkCodec::kRootsKey = L"roots";
18 static const wchar_t* kRootsKey = L"roots"; 18 const wchar_t* BookmarkCodec::kRootFolderNameKey = L"bookmark_bar";
19 static const wchar_t* kRootFolderNameKey = L"bookmark_bar"; 19 const wchar_t* BookmarkCodec::kOtherBookmarFolderNameKey = L"other";
20 static const wchar_t* kOtherBookmarFolderNameKey = L"other"; 20 const wchar_t* BookmarkCodec::kVersionKey = L"version";
21 static const wchar_t* kVersionKey = L"version"; 21 const wchar_t* BookmarkCodec::kTypeKey = L"type";
22 static const wchar_t* kTypeKey = L"type"; 22 const wchar_t* BookmarkCodec::kNameKey = L"name";
23 static const wchar_t* kNameKey = L"name"; 23 const wchar_t* BookmarkCodec::kDateAddedKey = L"date_added";
24 static const wchar_t* kDateAddedKey = L"date_added"; 24 const wchar_t* BookmarkCodec::kURLKey = L"url";
25 static const wchar_t* kURLKey = L"url"; 25 const wchar_t* BookmarkCodec::kDateModifiedKey = L"date_modified";
26 static const wchar_t* kDateModifiedKey = L"date_modified"; 26 const wchar_t* BookmarkCodec::kChildrenKey = L"children";
27 static const wchar_t* kChildrenKey = L"children"; 27 const wchar_t* BookmarkCodec::kTypeURL = L"url";
28 28 const wchar_t* BookmarkCodec::kTypeFolder = L"folder";
29 // Possible values for kTypeKey.
30 static const wchar_t* kTypeURL = L"url";
31 static const wchar_t* kTypeFolder = L"folder";
32 29
33 // Current version of the file. 30 // Current version of the file.
34 static const int kCurrentVersion = 1; 31 static const int kCurrentVersion = 1;
35 32
36 Value* BookmarkCodec::Encode(BookmarkModel* model) { 33 Value* BookmarkCodec::Encode(BookmarkModel* model) {
37 return Encode(model->GetBookmarkBarNode(), model->other_node()); 34 return Encode(model->GetBookmarkBarNode(), model->other_node());
38 } 35 }
39 36
40 Value* BookmarkCodec::Encode(BookmarkNode* bookmark_bar_node, 37 Value* BookmarkCodec::Encode(BookmarkNode* bookmark_bar_node,
41 BookmarkNode* other_folder_node) { 38 BookmarkNode* other_folder_node) {
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 185
189 if (!DecodeChildren(model, *static_cast<ListValue*>(child_values), node)) 186 if (!DecodeChildren(model, *static_cast<ListValue*>(child_values), node))
190 return false; 187 return false;
191 } 188 }
192 189
193 node->SetTitle(title); 190 node->SetTitle(title);
194 node->date_added_ = 191 node->date_added_ =
195 Time::FromInternalValue(StringToInt64(date_added_string)); 192 Time::FromInternalValue(StringToInt64(date_added_string));
196 return true; 193 return true;
197 } 194 }
OLDNEW
« no previous file with comments | « chrome/browser/bookmarks/bookmark_codec.h ('k') | chrome/browser/bookmarks/bookmark_context_menu.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698