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