| 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 #include "chrome/browser/permissions/chooser_context_base.h" | 5 #include "chrome/browser/permissions/chooser_context_base.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 "chrome/browser/content_settings/host_content_settings_map_factory.h" | 10 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 const GURL& embedding_origin, | 106 const GURL& embedding_origin, |
| 107 std::unique_ptr<base::DictionaryValue> object) { | 107 std::unique_ptr<base::DictionaryValue> object) { |
| 108 DCHECK_EQ(requesting_origin, requesting_origin.GetOrigin()); | 108 DCHECK_EQ(requesting_origin, requesting_origin.GetOrigin()); |
| 109 DCHECK_EQ(embedding_origin, embedding_origin.GetOrigin()); | 109 DCHECK_EQ(embedding_origin, embedding_origin.GetOrigin()); |
| 110 DCHECK(object); | 110 DCHECK(object); |
| 111 DCHECK(IsValidObject(*object)); | 111 DCHECK(IsValidObject(*object)); |
| 112 std::unique_ptr<base::DictionaryValue> setting = | 112 std::unique_ptr<base::DictionaryValue> setting = |
| 113 GetWebsiteSetting(requesting_origin, embedding_origin); | 113 GetWebsiteSetting(requesting_origin, embedding_origin); |
| 114 base::ListValue* object_list; | 114 base::ListValue* object_list; |
| 115 if (!setting->GetList(kObjectListKey, &object_list)) { | 115 if (!setting->GetList(kObjectListKey, &object_list)) { |
| 116 object_list = new base::ListValue(); | 116 object_list = |
| 117 setting->Set(kObjectListKey, object_list); | 117 setting->SetList(kObjectListKey, base::MakeUnique<base::ListValue>()); |
| 118 } | 118 } |
| 119 object_list->AppendIfNotPresent(std::move(object)); | 119 object_list->AppendIfNotPresent(std::move(object)); |
| 120 SetWebsiteSetting(requesting_origin, embedding_origin, std::move(setting)); | 120 SetWebsiteSetting(requesting_origin, embedding_origin, std::move(setting)); |
| 121 } | 121 } |
| 122 | 122 |
| 123 void ChooserContextBase::RevokeObjectPermission( | 123 void ChooserContextBase::RevokeObjectPermission( |
| 124 const GURL& requesting_origin, | 124 const GURL& requesting_origin, |
| 125 const GURL& embedding_origin, | 125 const GURL& embedding_origin, |
| 126 const base::DictionaryValue& object) { | 126 const base::DictionaryValue& object) { |
| 127 DCHECK_EQ(requesting_origin, requesting_origin.GetOrigin()); | 127 DCHECK_EQ(requesting_origin, requesting_origin.GetOrigin()); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 149 return value; | 149 return value; |
| 150 } | 150 } |
| 151 | 151 |
| 152 void ChooserContextBase::SetWebsiteSetting(const GURL& requesting_origin, | 152 void ChooserContextBase::SetWebsiteSetting(const GURL& requesting_origin, |
| 153 const GURL& embedding_origin, | 153 const GURL& embedding_origin, |
| 154 std::unique_ptr<base::Value> value) { | 154 std::unique_ptr<base::Value> value) { |
| 155 host_content_settings_map_->SetWebsiteSettingDefaultScope( | 155 host_content_settings_map_->SetWebsiteSettingDefaultScope( |
| 156 requesting_origin, embedding_origin, data_content_settings_type_, | 156 requesting_origin, embedding_origin, data_content_settings_type_, |
| 157 std::string(), std::move(value)); | 157 std::string(), std::move(value)); |
| 158 } | 158 } |
| OLD | NEW |