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

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

Issue 2166693002: [MD Settings] PROOF OF CONCEPT - DO NOT LAND - URL rewrite (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use existing hooks Created 4 years, 4 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
« no previous file with comments | « no previous file | chrome/browser/ui/webui/md_history_ui.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <vector> 10 #include <vector>
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 registry->RegisterDictionaryPref(kExtensionURLOverrides); 370 registry->RegisterDictionaryPref(kExtensionURLOverrides);
371 } 371 }
372 372
373 // static 373 // static
374 bool ExtensionWebUI::HandleChromeURLOverride( 374 bool ExtensionWebUI::HandleChromeURLOverride(
375 GURL* url, 375 GURL* url,
376 content::BrowserContext* browser_context) { 376 content::BrowserContext* browser_context) {
377 if (!url->SchemeIs(content::kChromeUIScheme)) 377 if (!url->SchemeIs(content::kChromeUIScheme))
378 return false; 378 return false;
379 379
380 if (!browser_context)
381 return false;
382
380 Profile* profile = Profile::FromBrowserContext(browser_context); 383 Profile* profile = Profile::FromBrowserContext(browser_context);
381 const base::DictionaryValue* overrides = 384 const base::DictionaryValue* overrides =
382 profile->GetPrefs()->GetDictionary(kExtensionURLOverrides); 385 profile->GetPrefs()->GetDictionary(kExtensionURLOverrides);
383 386
384 std::string url_host = url->host(); 387 std::string url_host = url->host();
385 const base::ListValue* url_list = NULL; 388 const base::ListValue* url_list = NULL;
386 if (!overrides || !overrides->GetList(url_host, &url_list)) 389 if (!overrides || !overrides->GetList(url_host, &url_list))
387 return false; 390 return false;
388 391
389 extensions::ExtensionRegistry* registry = 392 extensions::ExtensionRegistry* registry =
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
433 *url = component_url; 436 *url = component_url;
434 return true; 437 return true;
435 } 438 }
436 439
437 return false; 440 return false;
438 } 441 }
439 442
440 // static 443 // static
441 bool ExtensionWebUI::HandleChromeURLOverrideReverse( 444 bool ExtensionWebUI::HandleChromeURLOverrideReverse(
442 GURL* url, content::BrowserContext* browser_context) { 445 GURL* url, content::BrowserContext* browser_context) {
446 if (!browser_context)
447 return false;
448
443 Profile* profile = Profile::FromBrowserContext(browser_context); 449 Profile* profile = Profile::FromBrowserContext(browser_context);
444 const base::DictionaryValue* overrides = 450 const base::DictionaryValue* overrides =
445 profile->GetPrefs()->GetDictionary(kExtensionURLOverrides); 451 profile->GetPrefs()->GetDictionary(kExtensionURLOverrides);
446 if (!overrides) 452 if (!overrides)
447 return false; 453 return false;
448 454
449 // Find the reverse mapping based on the given URL. For example this maps the 455 // Find the reverse mapping based on the given URL. For example this maps the
450 // internal URL 456 // internal URL
451 // chrome-extension://eemcgdkfndhakfknompkggombfjjjeno/main.html#1 to 457 // chrome-extension://eemcgdkfndhakfknompkggombfjjjeno/main.html#1 to
452 // chrome://bookmarks/#1 for display in the omnibox. 458 // chrome://bookmarks/#1 for display in the omnibox.
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
558 extensions::ImageLoader::ImageRepresentation::ALWAYS_RESIZE, 564 extensions::ImageLoader::ImageRepresentation::ALWAYS_RESIZE,
559 gfx::Size(pixel_size, pixel_size), 565 gfx::Size(pixel_size, pixel_size),
560 resource_scale_factor)); 566 resource_scale_factor));
561 } 567 }
562 568
563 // LoadImagesAsync actually can run callback synchronously. We want to force 569 // LoadImagesAsync actually can run callback synchronously. We want to force
564 // async. 570 // async.
565 extensions::ImageLoader::Get(profile)->LoadImagesAsync( 571 extensions::ImageLoader::Get(profile)->LoadImagesAsync(
566 extension, info_list, base::Bind(&RunFaviconCallbackAsync, callback)); 572 extension, info_list, base::Bind(&RunFaviconCallbackAsync, callback));
567 } 573 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/webui/md_history_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698