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

Side by Side Diff: chrome/browser/extensions/extension_web_ui.cc

Issue 2777063003: Stop passing raw pointers to base::Value API in c/b/chromeos and c/b/extensions (Closed)
Patch Set: Fix SupervisedUserWhitelistInstaller Created 3 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 #include "chrome/browser/extensions/extension_web_ui.h" 5 #include "chrome/browser/extensions/extension_web_ui.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <set> 9 #include <set>
10 #include <utility> 10 #include <utility>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/command_line.h" 13 #include "base/command_line.h"
14 #include "base/memory/ptr_util.h" 14 #include "base/memory/ptr_util.h"
15 #include "base/strings/string_util.h" 15 #include "base/strings/string_util.h"
16 #include "base/strings/utf_string_conversions.h" 16 #include "base/strings/utf_string_conversions.h"
17 #include "base/threading/thread_task_runner_handle.h" 17 #include "base/threading/thread_task_runner_handle.h"
jdoerrie 2017/04/06 14:25:51 #include "base/values.h"
vabr (Chromium) 2017/04/07 20:40:41 Done.
18 #include "chrome/browser/extensions/extension_tab_util.h" 18 #include "chrome/browser/extensions/extension_tab_util.h"
19 #include "chrome/browser/profiles/profile.h" 19 #include "chrome/browser/profiles/profile.h"
20 #include "chrome/common/chrome_switches.h" 20 #include "chrome/common/chrome_switches.h"
21 #include "chrome/common/extensions/extension_constants.h" 21 #include "chrome/common/extensions/extension_constants.h"
22 #include "chrome/common/url_constants.h" 22 #include "chrome/common/url_constants.h"
23 #include "components/favicon/core/favicon_service.h" 23 #include "components/favicon/core/favicon_service.h"
24 #include "components/favicon_base/favicon_util.h" 24 #include "components/favicon_base/favicon_util.h"
25 #include "components/pref_registry/pref_registry_syncable.h" 25 #include "components/pref_registry/pref_registry_syncable.h"
26 #include "components/prefs/pref_service.h" 26 #include "components/prefs/pref_service.h"
27 #include "components/prefs/scoped_user_pref_update.h" 27 #include "components/prefs/scoped_user_pref_update.h"
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after
463 // static 463 // static
464 void ExtensionWebUI::RegisterOrActivateChromeURLOverrides( 464 void ExtensionWebUI::RegisterOrActivateChromeURLOverrides(
465 Profile* profile, 465 Profile* profile,
466 const URLOverrides::URLOverrideMap& overrides) { 466 const URLOverrides::URLOverrideMap& overrides) {
467 if (overrides.empty()) 467 if (overrides.empty())
468 return; 468 return;
469 PrefService* prefs = profile->GetPrefs(); 469 PrefService* prefs = profile->GetPrefs();
470 DictionaryPrefUpdate update(prefs, kExtensionURLOverrides); 470 DictionaryPrefUpdate update(prefs, kExtensionURLOverrides);
471 base::DictionaryValue* all_overrides = update.Get(); 471 base::DictionaryValue* all_overrides = update.Get();
472 for (const auto& page_override_pair : overrides) { 472 for (const auto& page_override_pair : overrides) {
473 base::ListValue* page_overrides = nullptr; 473 base::ListValue* page_overrides_weak = nullptr;
474 if (!all_overrides->GetList(page_override_pair.first, &page_overrides)) { 474 if (!all_overrides->GetList(page_override_pair.first,
475 page_overrides = new base::ListValue(); 475 &page_overrides_weak)) {
476 all_overrides->Set(page_override_pair.first, page_overrides); 476 auto page_overrides = base::MakeUnique<base::ListValue>();
477 page_overrides_weak = page_overrides.get();
478 all_overrides->Set(page_override_pair.first, std::move(page_overrides));
477 } 479 }
478 AddOverridesToList(page_overrides, page_override_pair.second.spec()); 480 AddOverridesToList(page_overrides_weak, page_override_pair.second.spec());
479 } 481 }
480 } 482 }
481 483
482 // static 484 // static
483 void ExtensionWebUI::DeactivateChromeURLOverrides( 485 void ExtensionWebUI::DeactivateChromeURLOverrides(
484 Profile* profile, 486 Profile* profile,
485 const URLOverrides::URLOverrideMap& overrides) { 487 const URLOverrides::URLOverrideMap& overrides) {
486 UpdateOverridesLists(profile, overrides, UPDATE_DEACTIVATE); 488 UpdateOverridesLists(profile, overrides, UPDATE_DEACTIVATE);
487 } 489 }
488 490
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
525 extensions::ImageLoader::ImageRepresentation::ALWAYS_RESIZE, 527 extensions::ImageLoader::ImageRepresentation::ALWAYS_RESIZE,
526 gfx::Size(pixel_size, pixel_size), 528 gfx::Size(pixel_size, pixel_size),
527 resource_scale_factor)); 529 resource_scale_factor));
528 } 530 }
529 531
530 // LoadImagesAsync actually can run callback synchronously. We want to force 532 // LoadImagesAsync actually can run callback synchronously. We want to force
531 // async. 533 // async.
532 extensions::ImageLoader::Get(profile)->LoadImagesAsync( 534 extensions::ImageLoader::Get(profile)->LoadImagesAsync(
533 extension, info_list, base::Bind(&RunFaviconCallbackAsync, callback)); 535 extension, info_list, base::Bind(&RunFaviconCallbackAsync, callback));
534 } 536 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698