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

Side by Side Diff: components/bookmarks/browser/bookmark_node.cc

Issue 1546143002: Switch to standard integer types in components/, part 1 of 4. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 12 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "components/bookmarks/browser/bookmark_node.h" 5 #include "components/bookmarks/browser/bookmark_node.h"
6 6
7 #include <map> 7 #include <map>
8 #include <string> 8 #include <string>
9 9
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
11 #include "base/strings/utf_string_conversions.h" 11 #include "base/strings/utf_string_conversions.h"
12 12
13 namespace bookmarks { 13 namespace bookmarks {
14 14
15 namespace { 15 namespace {
16 16
17 // Whitespace characters to strip from bookmark titles. 17 // Whitespace characters to strip from bookmark titles.
18 const base::char16 kInvalidChars[] = { 18 const base::char16 kInvalidChars[] = {
19 '\n', '\r', '\t', 19 '\n', '\r', '\t',
20 0x2028, // Line separator 20 0x2028, // Line separator
21 0x2029, // Paragraph separator 21 0x2029, // Paragraph separator
22 0 22 0
23 }; 23 };
24 24
25 } // namespace 25 } // namespace
26 26
27 // BookmarkNode --------------------------------------------------------------- 27 // BookmarkNode ---------------------------------------------------------------
28 28
29 const int64 BookmarkNode::kInvalidSyncTransactionVersion = -1; 29 const int64_t BookmarkNode::kInvalidSyncTransactionVersion = -1;
30 30
31 BookmarkNode::BookmarkNode(const GURL& url) 31 BookmarkNode::BookmarkNode(const GURL& url)
32 : url_(url) { 32 : url_(url) {
33 Initialize(0); 33 Initialize(0);
34 } 34 }
35 35
36 BookmarkNode::BookmarkNode(int64 id, const GURL& url) 36 BookmarkNode::BookmarkNode(int64_t id, const GURL& url) : url_(url) {
37 : url_(url) {
38 Initialize(id); 37 Initialize(id);
39 } 38 }
40 39
41 BookmarkNode::~BookmarkNode() { 40 BookmarkNode::~BookmarkNode() {
42 } 41 }
43 42
44 void BookmarkNode::SetTitle(const base::string16& title) { 43 void BookmarkNode::SetTitle(const base::string16& title) {
45 // Replace newlines and other problematic whitespace characters in 44 // Replace newlines and other problematic whitespace characters in
46 // folder/bookmark names with spaces. 45 // folder/bookmark names with spaces.
47 base::string16 trimmed_title; 46 base::string16 trimmed_title;
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 if (meta_info_map.empty()) 96 if (meta_info_map.empty())
98 meta_info_map_.reset(); 97 meta_info_map_.reset();
99 else 98 else
100 meta_info_map_.reset(new MetaInfoMap(meta_info_map)); 99 meta_info_map_.reset(new MetaInfoMap(meta_info_map));
101 } 100 }
102 101
103 const BookmarkNode::MetaInfoMap* BookmarkNode::GetMetaInfoMap() const { 102 const BookmarkNode::MetaInfoMap* BookmarkNode::GetMetaInfoMap() const {
104 return meta_info_map_.get(); 103 return meta_info_map_.get();
105 } 104 }
106 105
107 void BookmarkNode::Initialize(int64 id) { 106 void BookmarkNode::Initialize(int64_t id) {
108 id_ = id; 107 id_ = id;
109 type_ = url_.is_empty() ? FOLDER : URL; 108 type_ = url_.is_empty() ? FOLDER : URL;
110 date_added_ = base::Time::Now(); 109 date_added_ = base::Time::Now();
111 favicon_type_ = favicon_base::INVALID_ICON; 110 favicon_type_ = favicon_base::INVALID_ICON;
112 favicon_state_ = INVALID_FAVICON; 111 favicon_state_ = INVALID_FAVICON;
113 favicon_load_task_id_ = base::CancelableTaskTracker::kBadTaskId; 112 favicon_load_task_id_ = base::CancelableTaskTracker::kBadTaskId;
114 meta_info_map_.reset(); 113 meta_info_map_.reset();
115 sync_transaction_version_ = kInvalidSyncTransactionVersion; 114 sync_transaction_version_ = kInvalidSyncTransactionVersion;
116 } 115 }
117 116
118 void BookmarkNode::InvalidateFavicon() { 117 void BookmarkNode::InvalidateFavicon() {
119 icon_url_ = GURL(); 118 icon_url_ = GURL();
120 favicon_ = gfx::Image(); 119 favicon_ = gfx::Image();
121 favicon_type_ = favicon_base::INVALID_ICON; 120 favicon_type_ = favicon_base::INVALID_ICON;
122 favicon_state_ = INVALID_FAVICON; 121 favicon_state_ = INVALID_FAVICON;
123 } 122 }
124 123
125 // BookmarkPermanentNode ------------------------------------------------------- 124 // BookmarkPermanentNode -------------------------------------------------------
126 125
127 BookmarkPermanentNode::BookmarkPermanentNode(int64 id) 126 BookmarkPermanentNode::BookmarkPermanentNode(int64_t id)
128 : BookmarkNode(id, GURL()), 127 : BookmarkNode(id, GURL()), visible_(true) {}
129 visible_(true) {
130 }
131 128
132 BookmarkPermanentNode::~BookmarkPermanentNode() { 129 BookmarkPermanentNode::~BookmarkPermanentNode() {
133 } 130 }
134 131
135 bool BookmarkPermanentNode::IsVisible() const { 132 bool BookmarkPermanentNode::IsVisible() const {
136 return visible_ || !empty(); 133 return visible_ || !empty();
137 } 134 }
138 135
139 } // namespace bookmarks 136 } // namespace bookmarks
OLDNEW
« no previous file with comments | « components/bookmarks/browser/bookmark_node.h ('k') | components/bookmarks/browser/bookmark_node_data.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698