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

Side by Side Diff: chrome/browser/ui/webui/options/content_settings_handler.cc

Issue 2051663003: base::ListValue::Append cleanup: pass unique_ptr instead of the released pointer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 6 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 #include "chrome/browser/ui/webui/options/content_settings_handler.h" 5 #include "chrome/browser/ui/webui/options/content_settings_handler.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <utility> 10 #include <utility>
(...skipping 1122 matching lines...) Expand 10 before | Expand all | Expand 10 after
1133 exception->SetString(site_settings::kSetting, setting_string); 1133 exception->SetString(site_settings::kSetting, setting_string);
1134 1134
1135 // Calculate the zoom percent from the factor. Round up to the nearest whole 1135 // Calculate the zoom percent from the factor. Round up to the nearest whole
1136 // number. 1136 // number.
1137 int zoom_percent = static_cast<int>( 1137 int zoom_percent = static_cast<int>(
1138 content::ZoomLevelToZoomFactor(i->zoom_level) * 100 + 0.5); 1138 content::ZoomLevelToZoomFactor(i->zoom_level) * 100 + 0.5);
1139 exception->SetString(kZoom, base::FormatPercent(zoom_percent)); 1139 exception->SetString(kZoom, base::FormatPercent(zoom_percent));
1140 exception->SetString( 1140 exception->SetString(
1141 site_settings::kSource, site_settings::kPreferencesSource); 1141 site_settings::kSource, site_settings::kPreferencesSource);
1142 // Append the new entry to the list and map. 1142 // Append the new entry to the list and map.
1143 zoom_levels_exceptions.Append(exception.release()); 1143 zoom_levels_exceptions.Append(std::move(exception));
1144 } 1144 }
1145 1145
1146 base::StringValue type_string(kZoomContentType); 1146 base::StringValue type_string(kZoomContentType);
1147 web_ui()->CallJavascriptFunctionUnsafe("ContentSettings.setExceptions", 1147 web_ui()->CallJavascriptFunctionUnsafe("ContentSettings.setExceptions",
1148 type_string, zoom_levels_exceptions); 1148 type_string, zoom_levels_exceptions);
1149 } 1149 }
1150 1150
1151 void ContentSettingsHandler::UpdateExceptionsViewFromHostContentSettingsMap( 1151 void ContentSettingsHandler::UpdateExceptionsViewFromHostContentSettingsMap(
1152 ContentSettingsType type) { 1152 ContentSettingsType type) {
1153 base::ListValue exceptions; 1153 base::ListValue exceptions;
(...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after
1645 1645
1646 // Exceptions apply only when the feature is enabled. 1646 // Exceptions apply only when the feature is enabled.
1647 PrefService* prefs = user_prefs::UserPrefs::Get(GetBrowserContext(web_ui())); 1647 PrefService* prefs = user_prefs::UserPrefs::Get(GetBrowserContext(web_ui()));
1648 bool enable_exceptions = prefs->GetBoolean(prefs::kEnableDRM); 1648 bool enable_exceptions = prefs->GetBoolean(prefs::kEnableDRM);
1649 web_ui()->CallJavascriptFunctionUnsafe( 1649 web_ui()->CallJavascriptFunctionUnsafe(
1650 "ContentSettings.enableProtectedContentExceptions", 1650 "ContentSettings.enableProtectedContentExceptions",
1651 base::FundamentalValue(enable_exceptions)); 1651 base::FundamentalValue(enable_exceptions));
1652 } 1652 }
1653 1653
1654 } // namespace options 1654 } // namespace options
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698