chore: use std::make_unique/base::MakeRefCounted when possible (#29510)
This commit is contained in:
parent
a4decffe9a
commit
79cb5144ae
38 changed files with 106 additions and 101 deletions
|
@ -72,7 +72,7 @@ ExecuteCodeFunction::InitResult ExecuteCodeInTabFunction::Init() {
|
|||
base::DictionaryValue* details_value = NULL;
|
||||
if (!args_->GetDictionary(1, &details_value))
|
||||
return set_init_result(VALIDATION_FAILURE);
|
||||
std::unique_ptr<InjectDetails> details(new InjectDetails());
|
||||
auto details = std::make_unique<InjectDetails>();
|
||||
if (!InjectDetails::Populate(*details_value, details.get()))
|
||||
return set_init_result(VALIDATION_FAILURE);
|
||||
|
||||
|
@ -180,7 +180,7 @@ ExtensionFunction::ResponseAction TabsGetFunction::Run() {
|
|||
|
||||
tabs::Tab tab;
|
||||
|
||||
tab.id.reset(new int(tab_id));
|
||||
tab.id = std::make_unique<int>(tab_id);
|
||||
// TODO(nornagon): in Chrome, the tab URL is only available to extensions
|
||||
// that have the "tabs" (or "activeTab") permission. We should do the same
|
||||
// permission check here.
|
||||
|
@ -249,9 +249,8 @@ ExtensionFunction::ResponseAction TabsGetZoomSettingsFunction::Run() {
|
|||
contents->GetZoomController()->zoom_mode();
|
||||
api::tabs::ZoomSettings zoom_settings;
|
||||
ZoomModeToZoomSettings(zoom_mode, &zoom_settings);
|
||||
zoom_settings.default_zoom_factor.reset(
|
||||
new double(blink::PageZoomLevelToZoomFactor(
|
||||
zoom_controller->GetDefaultZoomLevel())));
|
||||
zoom_settings.default_zoom_factor = std::make_unique<double>(
|
||||
blink::PageZoomLevelToZoomFactor(zoom_controller->GetDefaultZoomLevel()));
|
||||
|
||||
return RespondNow(
|
||||
ArgumentList(api::tabs::GetZoomSettings::Results::Create(zoom_settings)));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue