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

Side by Side Diff: chrome/browser/extensions/api/browsing_data/browsing_data_api.cc

Issue 1871713002: Convert //chrome/browser/extensions from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase and fix header Created 4 years, 8 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 (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 // Defines the Chrome Extensions BrowsingData API functions, which entail 5 // Defines the Chrome Extensions BrowsingData API functions, which entail
6 // clearing browsing data, and clearing the browser's cache (which, let's be 6 // clearing browsing data, and clearing the browser's cache (which, let's be
7 // honest, are the same thing), as specified in the extension API JSON. 7 // honest, are the same thing), as specified in the extension API JSON.
8 8
9 #include "chrome/browser/extensions/api/browsing_data/browsing_data_api.h" 9 #include "chrome/browser/extensions/api/browsing_data/browsing_data_api.h"
10 10
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 } // namespace 123 } // namespace
124 124
125 bool BrowsingDataSettingsFunction::RunSync() { 125 bool BrowsingDataSettingsFunction::RunSync() {
126 PrefService* prefs = GetProfile()->GetPrefs(); 126 PrefService* prefs = GetProfile()->GetPrefs();
127 127
128 // Fill origin types. 128 // Fill origin types.
129 // The "cookies" and "hosted apps" UI checkboxes both map to 129 // The "cookies" and "hosted apps" UI checkboxes both map to
130 // REMOVE_SITE_DATA in browsing_data_remover.h, the former for the unprotected 130 // REMOVE_SITE_DATA in browsing_data_remover.h, the former for the unprotected
131 // web, the latter for protected web data. There is no UI control for 131 // web, the latter for protected web data. There is no UI control for
132 // extension data. 132 // extension data.
133 scoped_ptr<base::DictionaryValue> origin_types(new base::DictionaryValue); 133 std::unique_ptr<base::DictionaryValue> origin_types(
134 new base::DictionaryValue);
134 origin_types->SetBoolean( 135 origin_types->SetBoolean(
135 extension_browsing_data_api_constants::kUnprotectedWebKey, 136 extension_browsing_data_api_constants::kUnprotectedWebKey,
136 prefs->GetBoolean(prefs::kDeleteCookies)); 137 prefs->GetBoolean(prefs::kDeleteCookies));
137 origin_types->SetBoolean( 138 origin_types->SetBoolean(
138 extension_browsing_data_api_constants::kProtectedWebKey, 139 extension_browsing_data_api_constants::kProtectedWebKey,
139 prefs->GetBoolean(prefs::kDeleteHostedAppsData)); 140 prefs->GetBoolean(prefs::kDeleteHostedAppsData));
140 origin_types->SetBoolean( 141 origin_types->SetBoolean(
141 extension_browsing_data_api_constants::kExtensionsKey, false); 142 extension_browsing_data_api_constants::kExtensionsKey, false);
142 143
143 // Fill deletion time period. 144 // Fill deletion time period.
144 int period_pref = prefs->GetInteger(prefs::kDeleteTimePeriod); 145 int period_pref = prefs->GetInteger(prefs::kDeleteTimePeriod);
145 BrowsingDataRemover::TimePeriod period = 146 BrowsingDataRemover::TimePeriod period =
146 static_cast<BrowsingDataRemover::TimePeriod>(period_pref); 147 static_cast<BrowsingDataRemover::TimePeriod>(period_pref);
147 double since = 0; 148 double since = 0;
148 if (period != BrowsingDataRemover::EVERYTHING) { 149 if (period != BrowsingDataRemover::EVERYTHING) {
149 base::Time time = BrowsingDataRemover::CalculateBeginDeleteTime(period); 150 base::Time time = BrowsingDataRemover::CalculateBeginDeleteTime(period);
150 since = time.ToJsTime(); 151 since = time.ToJsTime();
151 } 152 }
152 153
153 scoped_ptr<base::DictionaryValue> options(new base::DictionaryValue); 154 std::unique_ptr<base::DictionaryValue> options(new base::DictionaryValue);
154 options->Set(extension_browsing_data_api_constants::kOriginTypesKey, 155 options->Set(extension_browsing_data_api_constants::kOriginTypesKey,
155 origin_types.release()); 156 origin_types.release());
156 options->SetDouble(extension_browsing_data_api_constants::kSinceKey, since); 157 options->SetDouble(extension_browsing_data_api_constants::kSinceKey, since);
157 158
158 // Fill dataToRemove and dataRemovalPermitted. 159 // Fill dataToRemove and dataRemovalPermitted.
159 scoped_ptr<base::DictionaryValue> selected(new base::DictionaryValue); 160 std::unique_ptr<base::DictionaryValue> selected(new base::DictionaryValue);
160 scoped_ptr<base::DictionaryValue> permitted(new base::DictionaryValue); 161 std::unique_ptr<base::DictionaryValue> permitted(new base::DictionaryValue);
161 162
162 bool delete_site_data = prefs->GetBoolean(prefs::kDeleteCookies) || 163 bool delete_site_data = prefs->GetBoolean(prefs::kDeleteCookies) ||
163 prefs->GetBoolean(prefs::kDeleteHostedAppsData); 164 prefs->GetBoolean(prefs::kDeleteHostedAppsData);
164 165
165 SetDetails(selected.get(), permitted.get(), 166 SetDetails(selected.get(), permitted.get(),
166 extension_browsing_data_api_constants::kAppCacheKey, 167 extension_browsing_data_api_constants::kAppCacheKey,
167 delete_site_data); 168 delete_site_data);
168 SetDetails(selected.get(), permitted.get(), 169 SetDetails(selected.get(), permitted.get(),
169 extension_browsing_data_api_constants::kCookiesKey, 170 extension_browsing_data_api_constants::kCookiesKey,
170 delete_site_data); 171 delete_site_data);
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 SetDetails(selected.get(), permitted.get(), 204 SetDetails(selected.get(), permitted.get(),
204 extension_browsing_data_api_constants::kCacheKey, 205 extension_browsing_data_api_constants::kCacheKey,
205 prefs->GetBoolean(prefs::kDeleteCache)); 206 prefs->GetBoolean(prefs::kDeleteCache));
206 SetDetails(selected.get(), permitted.get(), 207 SetDetails(selected.get(), permitted.get(),
207 extension_browsing_data_api_constants::kFormDataKey, 208 extension_browsing_data_api_constants::kFormDataKey,
208 prefs->GetBoolean(prefs::kDeleteFormData)); 209 prefs->GetBoolean(prefs::kDeleteFormData));
209 SetDetails(selected.get(), permitted.get(), 210 SetDetails(selected.get(), permitted.get(),
210 extension_browsing_data_api_constants::kPasswordsKey, 211 extension_browsing_data_api_constants::kPasswordsKey,
211 prefs->GetBoolean(prefs::kDeletePasswords)); 212 prefs->GetBoolean(prefs::kDeletePasswords));
212 213
213 scoped_ptr<base::DictionaryValue> result(new base::DictionaryValue); 214 std::unique_ptr<base::DictionaryValue> result(new base::DictionaryValue);
214 result->Set(extension_browsing_data_api_constants::kOptionsKey, 215 result->Set(extension_browsing_data_api_constants::kOptionsKey,
215 options.release()); 216 options.release());
216 result->Set(extension_browsing_data_api_constants::kDataToRemoveKey, 217 result->Set(extension_browsing_data_api_constants::kDataToRemoveKey,
217 selected.release()); 218 selected.release());
218 result->Set(extension_browsing_data_api_constants::kDataRemovalPermittedKey, 219 result->Set(extension_browsing_data_api_constants::kDataRemovalPermittedKey,
219 permitted.release()); 220 permitted.release());
220 SetResult(result.release()); 221 SetResult(result.release());
221 return true; 222 return true;
222 } 223 }
223 224
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
449 return BrowsingDataRemover::REMOVE_SERVICE_WORKERS; 450 return BrowsingDataRemover::REMOVE_SERVICE_WORKERS;
450 } 451 }
451 452
452 int BrowsingDataRemoveCacheStorageFunction::GetRemovalMask() { 453 int BrowsingDataRemoveCacheStorageFunction::GetRemovalMask() {
453 return BrowsingDataRemover::REMOVE_CACHE_STORAGE; 454 return BrowsingDataRemover::REMOVE_CACHE_STORAGE;
454 } 455 }
455 456
456 int BrowsingDataRemoveWebSQLFunction::GetRemovalMask() { 457 int BrowsingDataRemoveWebSQLFunction::GetRemovalMask() {
457 return BrowsingDataRemover::REMOVE_WEBSQL; 458 return BrowsingDataRemover::REMOVE_WEBSQL;
458 } 459 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698