OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/managed_mode/managed_mode_site_list.h" | 5 #include "chrome/browser/managed_mode/managed_mode_site_list.h" |
6 | 6 |
7 #include "base/json/json_file_value_serializer.h" | 7 #include "base/json/json_file_value_serializer.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 | 135 |
136 ManagedModeSiteList::ManagedModeSiteList(const std::string& extension_id, | 136 ManagedModeSiteList::ManagedModeSiteList(const std::string& extension_id, |
137 const ExtensionResource& path) | 137 const ExtensionResource& path) |
138 : extension_id_(extension_id), | 138 : extension_id_(extension_id), |
139 path_(path) { | 139 path_(path) { |
140 } | 140 } |
141 | 141 |
142 ManagedModeSiteList::~ManagedModeSiteList() { | 142 ManagedModeSiteList::~ManagedModeSiteList() { |
143 } | 143 } |
144 | 144 |
| 145 ManagedModeSiteList* ManagedModeSiteList::Clone() { |
| 146 return new ManagedModeSiteList(extension_id_, path_); |
| 147 } |
| 148 |
145 // static | 149 // static |
146 void ManagedModeSiteList::GetCategoryNames(std::vector<string16>* categories) { | 150 void ManagedModeSiteList::GetCategoryNames(std::vector<string16>* categories) { |
147 // TODO(bauerb): Collect custom categories from extensions. | 151 // TODO(bauerb): Collect custom categories from extensions. |
148 for (size_t i = 0; i < arraysize(g_categories); ++i) { | 152 for (size_t i = 0; i < arraysize(g_categories); ++i) { |
149 categories->push_back(ASCIIToUTF16(g_categories[i].name)); | 153 categories->push_back(ASCIIToUTF16(g_categories[i].name)); |
150 } | 154 } |
151 } | 155 } |
152 | 156 |
153 void ManagedModeSiteList::GetSites(std::vector<Site>* sites) { | 157 void ManagedModeSiteList::GetSites(std::vector<Site>* sites) { |
154 if (!LazyLoad()) | 158 if (!LazyLoad()) |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 GURL base_url = | 246 GURL base_url = |
243 extensions::Extension::GetBaseURLFromExtensionId(extension_id_); | 247 extensions::Extension::GetBaseURLFromExtensionId(extension_id_); |
244 GURL thumbnail_url = base_url.Resolve(thumbnail); | 248 GURL thumbnail_url = base_url.Resolve(thumbnail); |
245 if (!thumbnail_url.is_valid()) { | 249 if (!thumbnail_url.is_valid()) { |
246 LOG(ERROR) << "Invalid thumbnail"; | 250 LOG(ERROR) << "Invalid thumbnail"; |
247 return; | 251 return; |
248 } | 252 } |
249 | 253 |
250 dest->SetString(kThumbnailUrlKey, thumbnail_url.spec()); | 254 dest->SetString(kThumbnailUrlKey, thumbnail_url.spec()); |
251 } | 255 } |
OLD | NEW |