| 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 "chrome/browser/bookmarks/chrome_bookmark_client.h" | 5 #include "chrome/browser/bookmarks/chrome_bookmark_client.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 base::Passed(&managed), | 189 base::Passed(&managed), |
| 190 base::Passed(managed_bookmarks_tracker_->GetInitialManagedBookmarks()), | 190 base::Passed(managed_bookmarks_tracker_->GetInitialManagedBookmarks()), |
| 191 base::Passed(&supervised), | 191 base::Passed(&supervised), |
| 192 base::Passed( | 192 base::Passed( |
| 193 supervised_bookmarks_tracker_->GetInitialManagedBookmarks())); | 193 supervised_bookmarks_tracker_->GetInitialManagedBookmarks())); |
| 194 } | 194 } |
| 195 | 195 |
| 196 bool ChromeBookmarkClient::CanSetPermanentNodeTitle( | 196 bool ChromeBookmarkClient::CanSetPermanentNodeTitle( |
| 197 const BookmarkNode* permanent_node) { | 197 const BookmarkNode* permanent_node) { |
| 198 // The |managed_node_| can have its title updated if the user signs in or | 198 // The |managed_node_| can have its title updated if the user signs in or |
| 199 // out, since the name of the managed domain can appear in it. The | 199 // out, since the name of the managed domain can appear in it. |
| 200 // |supervised_node_| has a fixed title which can never be updated. | 200 // Also, both |managed_node_| and |supervised_node_| can have their title |
| 201 // updated on locale changes (crbug.com/459448). |
| 201 return (!bookmarks::IsDescendantOf(permanent_node, managed_node_) && | 202 return (!bookmarks::IsDescendantOf(permanent_node, managed_node_) && |
| 202 !bookmarks::IsDescendantOf(permanent_node, supervised_node_)) || | 203 !bookmarks::IsDescendantOf(permanent_node, supervised_node_)) || |
| 203 permanent_node == managed_node_; | 204 permanent_node == managed_node_ || |
| 205 permanent_node == supervised_node_; |
| 204 } | 206 } |
| 205 | 207 |
| 206 bool ChromeBookmarkClient::CanSyncNode(const BookmarkNode* node) { | 208 bool ChromeBookmarkClient::CanSyncNode(const BookmarkNode* node) { |
| 207 return !bookmarks::IsDescendantOf(node, managed_node_) && | 209 return !bookmarks::IsDescendantOf(node, managed_node_) && |
| 208 !bookmarks::IsDescendantOf(node, supervised_node_); | 210 !bookmarks::IsDescendantOf(node, supervised_node_); |
| 209 } | 211 } |
| 210 | 212 |
| 211 bool ChromeBookmarkClient::CanBeEditedByUser(const BookmarkNode* node) { | 213 bool ChromeBookmarkClient::CanBeEditedByUser(const BookmarkNode* node) { |
| 212 return !bookmarks::IsDescendantOf(node, managed_node_) && | 214 return !bookmarks::IsDescendantOf(node, managed_node_) && |
| 213 !bookmarks::IsDescendantOf(node, supervised_node_); | 215 !bookmarks::IsDescendantOf(node, supervised_node_); |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 return extra_nodes.Pass(); | 276 return extra_nodes.Pass(); |
| 275 } | 277 } |
| 276 | 278 |
| 277 std::string ChromeBookmarkClient::GetManagedBookmarksDomain() { | 279 std::string ChromeBookmarkClient::GetManagedBookmarksDomain() { |
| 278 policy::ProfilePolicyConnector* connector = | 280 policy::ProfilePolicyConnector* connector = |
| 279 policy::ProfilePolicyConnectorFactory::GetForBrowserContext(profile_); | 281 policy::ProfilePolicyConnectorFactory::GetForBrowserContext(profile_); |
| 280 if (connector->IsPolicyFromCloudPolicy(policy::key::kManagedBookmarks)) | 282 if (connector->IsPolicyFromCloudPolicy(policy::key::kManagedBookmarks)) |
| 281 return connector->GetManagementDomain(); | 283 return connector->GetManagementDomain(); |
| 282 return std::string(); | 284 return std::string(); |
| 283 } | 285 } |
| OLD | NEW |