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

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

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

Powered by Google App Engine
This is Rietveld 408576698