| 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/policy/managed_bookmarks_policy_handler.h" | 5 #include "chrome/browser/policy/managed_bookmarks_policy_handler.h" |
| 6 | 6 |
| 7 #include "base/prefs/pref_value_map.h" | 7 #include "base/prefs/pref_value_map.h" |
| 8 #include "base/values.h" | 8 #include "base/values.h" |
| 9 #include "components/bookmarks/common/bookmark_pref_names.h" | 9 #include "components/bookmarks/common/bookmark_pref_names.h" |
| 10 #include "components/bookmarks/managed/managed_bookmarks_tracker.h" | 10 #include "components/bookmarks/managed/managed_bookmarks_tracker.h" |
| 11 #include "components/policy/core/browser/policy_error_map.h" | 11 #include "components/policy/core/browser/policy_error_map.h" |
| 12 #include "components/policy/core/common/policy_map.h" | 12 #include "components/policy/core/common/policy_map.h" |
| 13 #include "components/url_fixer/url_fixer.h" | 13 #include "components/url_formatter/url_fixer.h" |
| 14 #include "policy/policy_constants.h" | 14 #include "policy/policy_constants.h" |
| 15 #include "url/gurl.h" | 15 #include "url/gurl.h" |
| 16 | 16 |
| 17 using bookmarks::ManagedBookmarksTracker; | 17 using bookmarks::ManagedBookmarksTracker; |
| 18 | 18 |
| 19 namespace policy { | 19 namespace policy { |
| 20 | 20 |
| 21 ManagedBookmarksPolicyHandler::ManagedBookmarksPolicyHandler( | 21 ManagedBookmarksPolicyHandler::ManagedBookmarksPolicyHandler( |
| 22 Schema chrome_schema) | 22 Schema chrome_schema) |
| 23 : SchemaValidatingPolicyHandler( | 23 : SchemaValidatingPolicyHandler( |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 continue; | 64 continue; |
| 65 } | 65 } |
| 66 | 66 |
| 67 if (children) { | 67 if (children) { |
| 68 // Ignore the URL if this bookmark has child nodes. | 68 // Ignore the URL if this bookmark has child nodes. |
| 69 dict->Remove(ManagedBookmarksTracker::kUrl, NULL); | 69 dict->Remove(ManagedBookmarksTracker::kUrl, NULL); |
| 70 FilterBookmarks(children); | 70 FilterBookmarks(children); |
| 71 } else { | 71 } else { |
| 72 // Make sure the URL is valid before passing a bookmark to the pref. | 72 // Make sure the URL is valid before passing a bookmark to the pref. |
| 73 dict->Remove(ManagedBookmarksTracker::kChildren, NULL); | 73 dict->Remove(ManagedBookmarksTracker::kChildren, NULL); |
| 74 GURL gurl = url_fixer::FixupURL(url, ""); | 74 GURL gurl = url_formatter::FixupURL(url, std::string()); |
| 75 if (!gurl.is_valid()) { | 75 if (!gurl.is_valid()) { |
| 76 it = list->Erase(it, NULL); | 76 it = list->Erase(it, NULL); |
| 77 continue; | 77 continue; |
| 78 } | 78 } |
| 79 dict->SetString(ManagedBookmarksTracker::kUrl, gurl.spec()); | 79 dict->SetString(ManagedBookmarksTracker::kUrl, gurl.spec()); |
| 80 } | 80 } |
| 81 | 81 |
| 82 ++it; | 82 ++it; |
| 83 } | 83 } |
| 84 } | 84 } |
| 85 | 85 |
| 86 } // namespace policy | 86 } // namespace policy |
| OLD | NEW |