Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(291)

Side by Side Diff: chrome/browser/permissions/chooser_context_base.cc

Issue 2336863003: Change more base::ListValue methods to use std::unique_ptr. (Closed)
Patch Set: . Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 DCHECK_EQ(embedding_origin, embedding_origin.GetOrigin()); 108 DCHECK_EQ(embedding_origin, embedding_origin.GetOrigin());
109 DCHECK(object); 109 DCHECK(object);
110 DCHECK(IsValidObject(*object)); 110 DCHECK(IsValidObject(*object));
111 std::unique_ptr<base::DictionaryValue> setting = 111 std::unique_ptr<base::DictionaryValue> setting =
112 GetWebsiteSetting(requesting_origin, embedding_origin); 112 GetWebsiteSetting(requesting_origin, embedding_origin);
113 base::ListValue* object_list; 113 base::ListValue* object_list;
114 if (!setting->GetList(kObjectListKey, &object_list)) { 114 if (!setting->GetList(kObjectListKey, &object_list)) {
115 object_list = new base::ListValue(); 115 object_list = new base::ListValue();
116 setting->Set(kObjectListKey, object_list); 116 setting->Set(kObjectListKey, object_list);
117 } 117 }
118 object_list->AppendIfNotPresent(object.release()); 118 object_list->AppendIfNotPresent(std::move(object));
119 SetWebsiteSetting(requesting_origin, embedding_origin, std::move(setting)); 119 SetWebsiteSetting(requesting_origin, embedding_origin, std::move(setting));
120 } 120 }
121 121
122 void ChooserContextBase::RevokeObjectPermission( 122 void ChooserContextBase::RevokeObjectPermission(
123 const GURL& requesting_origin, 123 const GURL& requesting_origin,
124 const GURL& embedding_origin, 124 const GURL& embedding_origin,
125 const base::DictionaryValue& object) { 125 const base::DictionaryValue& object) {
126 DCHECK_EQ(requesting_origin, requesting_origin.GetOrigin()); 126 DCHECK_EQ(requesting_origin, requesting_origin.GetOrigin());
127 DCHECK_EQ(embedding_origin, embedding_origin.GetOrigin()); 127 DCHECK_EQ(embedding_origin, embedding_origin.GetOrigin());
128 DCHECK(IsValidObject(object)); 128 DCHECK(IsValidObject(object));
(...skipping 19 matching lines...) Expand all
148 return value; 148 return value;
149 } 149 }
150 150
151 void ChooserContextBase::SetWebsiteSetting(const GURL& requesting_origin, 151 void ChooserContextBase::SetWebsiteSetting(const GURL& requesting_origin,
152 const GURL& embedding_origin, 152 const GURL& embedding_origin,
153 std::unique_ptr<base::Value> value) { 153 std::unique_ptr<base::Value> value) {
154 host_content_settings_map_->SetWebsiteSettingDefaultScope( 154 host_content_settings_map_->SetWebsiteSettingDefaultScope(
155 requesting_origin, embedding_origin, data_content_settings_type_, 155 requesting_origin, embedding_origin, data_content_settings_type_,
156 std::string(), std::move(value)); 156 std::string(), std::move(value));
157 } 157 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698