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 <stddef.h> | 5 #include <stddef.h> |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 ExtensionWebUI::kExtensionURLOverrides); | 43 ExtensionWebUI::kExtensionURLOverrides); |
44 | 44 |
45 const base::ListValue* values = nullptr; | 45 const base::ListValue* values = nullptr; |
46 if (!overrides->GetList("history", &values)) | 46 if (!overrides->GetList("history", &values)) |
47 return false; | 47 return false; |
48 | 48 |
49 std::set<std::string> seen_overrides; | 49 std::set<std::string> seen_overrides; |
50 for (const auto& val : *values) { | 50 for (const auto& val : *values) { |
51 const base::DictionaryValue* dict = nullptr; | 51 const base::DictionaryValue* dict = nullptr; |
52 std::string entry; | 52 std::string entry; |
53 if (!val.GetAsDictionary(&dict) || !dict->GetString("entry", &entry) || | 53 if (!val->GetAsDictionary(&dict) || !dict->GetString("entry", &entry) || |
54 seen_overrides.count(entry) != 0) | 54 seen_overrides.count(entry) != 0) |
55 return false; | 55 return false; |
56 seen_overrides.insert(entry); | 56 seen_overrides.insert(entry); |
57 } | 57 } |
58 | 58 |
59 return true; | 59 return true; |
60 } | 60 } |
61 | 61 |
62 // Returns AssertionSuccess() if the given |web_contents| is being actively | 62 // Returns AssertionSuccess() if the given |web_contents| is being actively |
63 // controlled by the extension with |extension_id|. | 63 // controlled by the extension with |extension_id|. |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 } | 293 } |
294 | 294 |
295 ASSERT_FALSE(CheckHistoryOverridesContainsNoDupes()); | 295 ASSERT_FALSE(CheckHistoryOverridesContainsNoDupes()); |
296 | 296 |
297 ExtensionWebUI::InitializeChromeURLOverrides(profile()); | 297 ExtensionWebUI::InitializeChromeURLOverrides(profile()); |
298 | 298 |
299 ASSERT_TRUE(CheckHistoryOverridesContainsNoDupes()); | 299 ASSERT_TRUE(CheckHistoryOverridesContainsNoDupes()); |
300 } | 300 } |
301 | 301 |
302 } // namespace extensions | 302 } // namespace extensions |
OLD | NEW |