OLD | NEW |
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 // Font Settings Extension API implementation. | 5 // Font Settings Extension API implementation. |
6 | 6 |
7 #include "chrome/browser/extensions/api/font_settings/font_settings_api.h" | 7 #include "chrome/browser/extensions/api/font_settings/font_settings_api.h" |
8 | 8 |
9 #include <stddef.h> | 9 #include <stddef.h> |
10 | 10 |
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 NOTREACHED(); | 333 NOTREACHED(); |
334 return false; | 334 return false; |
335 } | 335 } |
336 | 336 |
337 std::string localized_name; | 337 std::string localized_name; |
338 if (!font_list_value->GetString(1, &localized_name)) { | 338 if (!font_list_value->GetString(1, &localized_name)) { |
339 NOTREACHED(); | 339 NOTREACHED(); |
340 return false; | 340 return false; |
341 } | 341 } |
342 | 342 |
343 base::DictionaryValue* font_name = new base::DictionaryValue(); | 343 std::unique_ptr<base::DictionaryValue> font_name( |
| 344 new base::DictionaryValue()); |
344 font_name->Set(kFontIdKey, new base::StringValue(name)); | 345 font_name->Set(kFontIdKey, new base::StringValue(name)); |
345 font_name->Set(kDisplayNameKey, new base::StringValue(localized_name)); | 346 font_name->Set(kDisplayNameKey, new base::StringValue(localized_name)); |
346 result->Append(font_name); | 347 result->Append(std::move(font_name)); |
347 } | 348 } |
348 | 349 |
349 SetResult(std::move(result)); | 350 SetResult(std::move(result)); |
350 return true; | 351 return true; |
351 } | 352 } |
352 | 353 |
353 bool ClearFontPrefExtensionFunction::RunSync() { | 354 bool ClearFontPrefExtensionFunction::RunSync() { |
354 if (GetProfile()->IsOffTheRecord()) { | 355 if (GetProfile()->IsOffTheRecord()) { |
355 error_ = kSetFromIncognitoError; | 356 error_ = kSetFromIncognitoError; |
356 return false; | 357 return false; |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
455 | 456 |
456 const char* FontSettingsSetMinimumFontSizeFunction::GetPrefName() { | 457 const char* FontSettingsSetMinimumFontSizeFunction::GetPrefName() { |
457 return prefs::kWebKitMinimumFontSize; | 458 return prefs::kWebKitMinimumFontSize; |
458 } | 459 } |
459 | 460 |
460 const char* FontSettingsSetMinimumFontSizeFunction::GetKey() { | 461 const char* FontSettingsSetMinimumFontSizeFunction::GetKey() { |
461 return kPixelSizeKey; | 462 return kPixelSizeKey; |
462 } | 463 } |
463 | 464 |
464 } // namespace extensions | 465 } // namespace extensions |
OLD | NEW |