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

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: Just rebased 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"
18 #include "base/values.h"
18 #include "chrome/browser/extensions/extension_tab_util.h" 19 #include "chrome/browser/extensions/extension_tab_util.h"
19 #include "chrome/browser/profiles/profile.h" 20 #include "chrome/browser/profiles/profile.h"
20 #include "chrome/common/chrome_switches.h" 21 #include "chrome/common/chrome_switches.h"
21 #include "chrome/common/extensions/extension_constants.h" 22 #include "chrome/common/extensions/extension_constants.h"
22 #include "chrome/common/url_constants.h" 23 #include "chrome/common/url_constants.h"
23 #include "components/favicon/core/favicon_service.h" 24 #include "components/favicon/core/favicon_service.h"
24 #include "components/favicon_base/favicon_util.h" 25 #include "components/favicon_base/favicon_util.h"
25 #include "components/pref_registry/pref_registry_syncable.h" 26 #include "components/pref_registry/pref_registry_syncable.h"
26 #include "components/prefs/pref_service.h" 27 #include "components/prefs/pref_service.h"
27 #include "components/prefs/scoped_user_pref_update.h" 28 #include "components/prefs/scoped_user_pref_update.h"
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after
464 // static 465 // static
465 void ExtensionWebUI::RegisterOrActivateChromeURLOverrides( 466 void ExtensionWebUI::RegisterOrActivateChromeURLOverrides(
466 Profile* profile, 467 Profile* profile,
467 const URLOverrides::URLOverrideMap& overrides) { 468 const URLOverrides::URLOverrideMap& overrides) {
468 if (overrides.empty()) 469 if (overrides.empty())
469 return; 470 return;
470 PrefService* prefs = profile->GetPrefs(); 471 PrefService* prefs = profile->GetPrefs();
471 DictionaryPrefUpdate update(prefs, kExtensionURLOverrides); 472 DictionaryPrefUpdate update(prefs, kExtensionURLOverrides);
472 base::DictionaryValue* all_overrides = update.Get(); 473 base::DictionaryValue* all_overrides = update.Get();
473 for (const auto& page_override_pair : overrides) { 474 for (const auto& page_override_pair : overrides) {
474 base::ListValue* page_overrides = nullptr; 475 base::ListValue* page_overrides_weak = nullptr;
475 if (!all_overrides->GetList(page_override_pair.first, &page_overrides)) { 476 if (!all_overrides->GetList(page_override_pair.first,
476 page_overrides = new base::ListValue(); 477 &page_overrides_weak)) {
477 all_overrides->Set(page_override_pair.first, page_overrides); 478 auto page_overrides = base::MakeUnique<base::ListValue>();
479 page_overrides_weak = page_overrides.get();
480 all_overrides->Set(page_override_pair.first, std::move(page_overrides));
478 } 481 }
479 AddOverridesToList(page_overrides, page_override_pair.second.spec()); 482 AddOverridesToList(page_overrides_weak, page_override_pair.second.spec());
480 } 483 }
481 } 484 }
482 485
483 // static 486 // static
484 void ExtensionWebUI::DeactivateChromeURLOverrides( 487 void ExtensionWebUI::DeactivateChromeURLOverrides(
485 Profile* profile, 488 Profile* profile,
486 const URLOverrides::URLOverrideMap& overrides) { 489 const URLOverrides::URLOverrideMap& overrides) {
487 UpdateOverridesLists(profile, overrides, UPDATE_DEACTIVATE); 490 UpdateOverridesLists(profile, overrides, UPDATE_DEACTIVATE);
488 } 491 }
489 492
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
526 extensions::ImageLoader::ImageRepresentation::ALWAYS_RESIZE, 529 extensions::ImageLoader::ImageRepresentation::ALWAYS_RESIZE,
527 gfx::Size(pixel_size, pixel_size), 530 gfx::Size(pixel_size, pixel_size),
528 resource_scale_factor)); 531 resource_scale_factor));
529 } 532 }
530 533
531 // LoadImagesAsync actually can run callback synchronously. We want to force 534 // LoadImagesAsync actually can run callback synchronously. We want to force
532 // async. 535 // async.
533 extensions::ImageLoader::Get(profile)->LoadImagesAsync( 536 extensions::ImageLoader::Get(profile)->LoadImagesAsync(
534 extension, info_list, base::Bind(&RunFaviconCallbackAsync, callback)); 537 extension, info_list, base::Bind(&RunFaviconCallbackAsync, callback));
535 } 538 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698