Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #import "ios/chrome/browser/ui/settings/block_popups_collection_view_controller. h" | 5 #import "ios/chrome/browser/ui/settings/block_popups_collection_view_controller. h" |
| 6 | 6 |
| 7 #import "base/ios/weak_nsobject.h" | 7 #import "base/ios/weak_nsobject.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #import "base/mac/foundation_util.h" | 9 #import "base/mac/foundation_util.h" |
| 10 #import "base/mac/scoped_nsobject.h" | 10 #import "base/mac/scoped_nsobject.h" |
| 11 #include "base/memory/ptr_util.h" | |
| 11 #include "base/strings/sys_string_conversions.h" | 12 #include "base/strings/sys_string_conversions.h" |
| 12 #include "base/values.h" | 13 #include "base/values.h" |
| 13 #include "components/content_settings/core/browser/host_content_settings_map.h" | 14 #include "components/content_settings/core/browser/host_content_settings_map.h" |
| 14 #include "components/content_settings/core/common/content_settings_pattern.h" | 15 #include "components/content_settings/core/common/content_settings_pattern.h" |
| 15 #include "ios/chrome/browser/browser_state/chrome_browser_state.h" | 16 #include "ios/chrome/browser/browser_state/chrome_browser_state.h" |
| 16 #include "ios/chrome/browser/content_settings/host_content_settings_map_factory. h" | 17 #include "ios/chrome/browser/content_settings/host_content_settings_map_factory. h" |
| 17 #import "ios/chrome/browser/ui/collection_view/cells/collection_view_switch_item .h" | 18 #import "ios/chrome/browser/ui/collection_view/cells/collection_view_switch_item .h" |
| 18 #import "ios/chrome/browser/ui/collection_view/cells/collection_view_text_item.h " | 19 #import "ios/chrome/browser/ui/collection_view/cells/collection_view_text_item.h " |
| 19 #import "ios/chrome/browser/ui/collection_view/collection_view_model.h" | 20 #import "ios/chrome/browser/ui/collection_view/collection_view_model.h" |
| 20 #import "ios/chrome/browser/ui/settings/settings_navigation_controller.h" | 21 #import "ios/chrome/browser/ui/settings/settings_navigation_controller.h" |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 275 continue; | 276 continue; |
| 276 } | 277 } |
| 277 // The content settings UI does not support secondary content settings | 278 // The content settings UI does not support secondary content settings |
| 278 // pattern yet. For content settings set through the content settings UI the | 279 // pattern yet. For content settings set through the content settings UI the |
| 279 // secondary pattern is by default a wildcard pattern. Hence users are not | 280 // secondary pattern is by default a wildcard pattern. Hence users are not |
| 280 // able to modify content settings with a secondary pattern other than the | 281 // able to modify content settings with a secondary pattern other than the |
| 281 // wildcard pattern. So only show settings that the user is able to modify. | 282 // wildcard pattern. So only show settings that the user is able to modify. |
| 282 if (entries[i].secondary_pattern == ContentSettingsPattern::Wildcard() && | 283 if (entries[i].secondary_pattern == ContentSettingsPattern::Wildcard() && |
| 283 entries[i].setting == CONTENT_SETTING_ALLOW) { | 284 entries[i].setting == CONTENT_SETTING_ALLOW) { |
| 284 _exceptions.Append( | 285 _exceptions.Append( |
| 285 new base::Value(entries[i].primary_pattern.ToString())); | 286 base::MakeUnique<base::Value>(entries[i].primary_pattern.ToString())); |
|
jdoerrie
2017/04/12 12:37:46
Consider using AppendString and removing the added
vabr (Chromium)
2017/04/12 12:55:04
Done.
| |
| 286 } else { | 287 } else { |
| 287 LOG(ERROR) << "Secondary content settings patterns are not " | 288 LOG(ERROR) << "Secondary content settings patterns are not " |
| 288 << "supported by the content settings UI"; | 289 << "supported by the content settings UI"; |
| 289 } | 290 } |
| 290 } | 291 } |
| 291 } | 292 } |
| 292 | 293 |
| 293 - (void)populateExceptionsItems { | 294 - (void)populateExceptionsItems { |
| 294 CollectionViewModel* model = self.collectionViewModel; | 295 CollectionViewModel* model = self.collectionViewModel; |
| 295 [model addSectionWithIdentifier:SectionIdentifierExceptions]; | 296 [model addSectionWithIdentifier:SectionIdentifierExceptions]; |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 344 [[strongSelf collectionViewModel] | 345 [[strongSelf collectionViewModel] |
| 345 removeSectionWithIdentifier:SectionIdentifierExceptions]; | 346 removeSectionWithIdentifier:SectionIdentifierExceptions]; |
| 346 [[strongSelf collectionView] | 347 [[strongSelf collectionView] |
| 347 deleteSections:[NSIndexSet indexSetWithIndex:index]]; | 348 deleteSections:[NSIndexSet indexSetWithIndex:index]]; |
| 348 } | 349 } |
| 349 completion:nil]; | 350 completion:nil]; |
| 350 } | 351 } |
| 351 } | 352 } |
| 352 | 353 |
| 353 @end | 354 @end |
| OLD | NEW |