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

Side by Side Diff: chrome/browser/history/starred_url_database.cc

Issue 18805: Correct sqlite wrapper behavior on systems where wchar_t is UTF-32, (Closed)
Patch Set: minor fixes Created 11 years, 10 months 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
« no previous file with comments | « chrome/browser/history/download_database.cc ('k') | chrome/browser/history/url_database.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/history/starred_url_database.h" 5 #include "chrome/browser/history/starred_url_database.h"
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/json_writer.h" 9 #include "base/json_writer.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 "starred.visual_order, starred.parent_id, urls.url, urls.id, " \ 51 "starred.visual_order, starred.parent_id, urls.url, urls.id, " \
52 "starred.group_id, starred.date_modified " 52 "starred.group_id, starred.date_modified "
53 const char kHistoryStarFields[] = STAR_FIELDS; 53 const char kHistoryStarFields[] = STAR_FIELDS;
54 54
55 void FillInStarredEntry(SQLStatement* s, StarredEntry* entry) { 55 void FillInStarredEntry(SQLStatement* s, StarredEntry* entry) {
56 DCHECK(entry); 56 DCHECK(entry);
57 entry->id = s->column_int64(0); 57 entry->id = s->column_int64(0);
58 switch (s->column_int(1)) { 58 switch (s->column_int(1)) {
59 case 0: 59 case 0:
60 entry->type = history::StarredEntry::URL; 60 entry->type = history::StarredEntry::URL;
61 entry->url = GURL(WideToUTF8(s->column_string16(6))); 61 entry->url = GURL(WideToUTF8(s->column_wstring(6)));
62 break; 62 break;
63 case 1: 63 case 1:
64 entry->type = history::StarredEntry::BOOKMARK_BAR; 64 entry->type = history::StarredEntry::BOOKMARK_BAR;
65 break; 65 break;
66 case 2: 66 case 2:
67 entry->type = history::StarredEntry::USER_GROUP; 67 entry->type = history::StarredEntry::USER_GROUP;
68 break; 68 break;
69 case 3: 69 case 3:
70 entry->type = history::StarredEntry::OTHER; 70 entry->type = history::StarredEntry::OTHER;
71 break; 71 break;
72 default: 72 default:
73 NOTREACHED(); 73 NOTREACHED();
74 break; 74 break;
75 } 75 }
76 entry->title = s->column_string16(2); 76 entry->title = s->column_wstring(2);
77 entry->date_added = Time::FromInternalValue(s->column_int64(3)); 77 entry->date_added = Time::FromInternalValue(s->column_int64(3));
78 entry->visual_order = s->column_int(4); 78 entry->visual_order = s->column_int(4);
79 entry->parent_group_id = s->column_int64(5); 79 entry->parent_group_id = s->column_int64(5);
80 entry->url_id = s->column_int64(7); 80 entry->url_id = s->column_int64(7);
81 entry->group_id = s->column_int64(8); 81 entry->group_id = s->column_int64(8);
82 entry->date_group_modified = Time::FromInternalValue(s->column_int64(9)); 82 entry->date_group_modified = Time::FromInternalValue(s->column_int64(9));
83 } 83 }
84 84
85 } // namespace 85 } // namespace
86 86
(...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after
622 scoped_ptr<Value> encoded_bookmarks( 622 scoped_ptr<Value> encoded_bookmarks(
623 encoder.Encode(&bookmark_bar_node, &other_node)); 623 encoder.Encode(&bookmark_bar_node, &other_node));
624 std::string content; 624 std::string content;
625 JSONWriter::Write(encoded_bookmarks.get(), true, &content); 625 JSONWriter::Write(encoded_bookmarks.get(), true, &content);
626 626
627 return (file_util::WriteFile(path, content.c_str(), 627 return (file_util::WriteFile(path, content.c_str(),
628 static_cast<int>(content.length())) != -1); 628 static_cast<int>(content.length())) != -1);
629 } 629 }
630 630
631 } // namespace history 631 } // namespace history
OLDNEW
« no previous file with comments | « chrome/browser/history/download_database.cc ('k') | chrome/browser/history/url_database.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698