| OLD | NEW |
| 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/core/browser/bookmark_node_data.h" | 5 #include "components/bookmarks/browser/bookmark_node_data.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/pickle.h" | 10 #include "base/pickle.h" |
| 11 #include "base/strings/string_util.h" | 11 #include "base/strings/string_util.h" |
| 12 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
| 13 #include "components/bookmarks/core/browser/bookmark_utils.h" | 13 #include "components/bookmarks/browser/bookmark_utils.h" |
| 14 #include "ui/base/clipboard/scoped_clipboard_writer.h" | 14 #include "ui/base/clipboard/scoped_clipboard_writer.h" |
| 15 | 15 |
| 16 const char* BookmarkNodeData::kClipboardFormatString = | 16 const char* BookmarkNodeData::kClipboardFormatString = |
| 17 "chromium/x-bookmark-entries"; | 17 "chromium/x-bookmark-entries"; |
| 18 | 18 |
| 19 BookmarkNodeData::Element::Element() : is_url(false), id_(0) { | 19 BookmarkNodeData::Element::Element() : is_url(false), id_(0) { |
| 20 } | 20 } |
| 21 | 21 |
| 22 BookmarkNodeData::Element::Element(const BookmarkNode* node) | 22 BookmarkNodeData::Element::Element(const BookmarkNode* node) |
| 23 : is_url(node->is_url()), | 23 : is_url(node->is_url()), |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 | 127 |
| 128 if (nodes.empty()) | 128 if (nodes.empty()) |
| 129 return false; | 129 return false; |
| 130 | 130 |
| 131 for (size_t i = 0; i < nodes.size(); ++i) | 131 for (size_t i = 0; i < nodes.size(); ++i) |
| 132 elements.push_back(Element(nodes[i])); | 132 elements.push_back(Element(nodes[i])); |
| 133 | 133 |
| 134 return true; | 134 return true; |
| 135 } | 135 } |
| 136 | 136 |
| 137 bool BookmarkNodeData::ReadFromTuple(const GURL& url, const base::string16& titl
e) { | 137 bool BookmarkNodeData::ReadFromTuple(const GURL& url, |
| 138 const base::string16& title) { |
| 138 Clear(); | 139 Clear(); |
| 139 | 140 |
| 140 if (!url.is_valid()) | 141 if (!url.is_valid()) |
| 141 return false; | 142 return false; |
| 142 | 143 |
| 143 Element element; | 144 Element element; |
| 144 element.title = title; | 145 element.title = title; |
| 145 element.url = url; | 146 element.url = url; |
| 146 element.is_url = true; | 147 element.is_url = true; |
| 147 | 148 |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 const base::FilePath& profile_path) { | 277 const base::FilePath& profile_path) { |
| 277 DCHECK(profile_path_.empty()); | 278 DCHECK(profile_path_.empty()); |
| 278 profile_path_ = profile_path; | 279 profile_path_ = profile_path; |
| 279 } | 280 } |
| 280 | 281 |
| 281 bool BookmarkNodeData::IsFromProfilePath( | 282 bool BookmarkNodeData::IsFromProfilePath( |
| 282 const base::FilePath& profile_path) const { | 283 const base::FilePath& profile_path) const { |
| 283 // An empty path means the data is not associated with any profile. | 284 // An empty path means the data is not associated with any profile. |
| 284 return !profile_path_.empty() && profile_path_ == profile_path; | 285 return !profile_path_.empty() && profile_path_ == profile_path; |
| 285 } | 286 } |
| OLD | NEW |