| 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 #include "chrome/browser/extensions/extension_web_ui.h" | 5 #include "chrome/browser/extensions/extension_web_ui.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 // static | 217 // static |
| 218 bool ExtensionWebUI::HandleChromeURLOverride( | 218 bool ExtensionWebUI::HandleChromeURLOverride( |
| 219 GURL* url, content::BrowserContext* browser_context) { | 219 GURL* url, content::BrowserContext* browser_context) { |
| 220 if (!url->SchemeIs(chrome::kChromeUIScheme)) | 220 if (!url->SchemeIs(chrome::kChromeUIScheme)) |
| 221 return false; | 221 return false; |
| 222 | 222 |
| 223 Profile* profile = Profile::FromBrowserContext(browser_context); | 223 Profile* profile = Profile::FromBrowserContext(browser_context); |
| 224 const DictionaryValue* overrides = | 224 const DictionaryValue* overrides = |
| 225 profile->GetPrefs()->GetDictionary(kExtensionURLOverrides); | 225 profile->GetPrefs()->GetDictionary(kExtensionURLOverrides); |
| 226 std::string page = url->host(); | 226 std::string page = url->host(); |
| 227 ListValue* url_list; | 227 const ListValue* url_list; |
| 228 if (!overrides || !overrides->GetList(page, &url_list)) | 228 if (!overrides || !overrides->GetList(page, &url_list)) |
| 229 return false; | 229 return false; |
| 230 | 230 |
| 231 ExtensionService* service = profile->GetExtensionService(); | 231 ExtensionService* service = profile->GetExtensionService(); |
| 232 | 232 |
| 233 size_t i = 0; | 233 size_t i = 0; |
| 234 while (i < url_list->GetSize()) { | 234 while (i < url_list->GetSize()) { |
| 235 Value* val = NULL; | 235 Value* val = NULL; |
| 236 url_list->Get(i, &val); | 236 url_list->Get(i, &val); |
| 237 | 237 |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 const DictionaryValue* overrides = | 290 const DictionaryValue* overrides = |
| 291 profile->GetPrefs()->GetDictionary(kExtensionURLOverrides); | 291 profile->GetPrefs()->GetDictionary(kExtensionURLOverrides); |
| 292 if (!overrides) | 292 if (!overrides) |
| 293 return false; | 293 return false; |
| 294 | 294 |
| 295 // Find the reverse mapping based on the given URL. For example this maps the | 295 // Find the reverse mapping based on the given URL. For example this maps the |
| 296 // internal URL chrome-extension://eemcgdkndhakfknomggombfjeno/main.html#1 to | 296 // internal URL chrome-extension://eemcgdkndhakfknomggombfjeno/main.html#1 to |
| 297 // chrome://bookmarks/#1 for display in the omnibox. | 297 // chrome://bookmarks/#1 for display in the omnibox. |
| 298 for (DictionaryValue::key_iterator it = overrides->begin_keys(), | 298 for (DictionaryValue::key_iterator it = overrides->begin_keys(), |
| 299 end = overrides->end_keys(); it != end; ++it) { | 299 end = overrides->end_keys(); it != end; ++it) { |
| 300 ListValue* url_list; | 300 const ListValue* url_list; |
| 301 if (!overrides->GetList(*it, &url_list)) | 301 if (!overrides->GetList(*it, &url_list)) |
| 302 continue; | 302 continue; |
| 303 | 303 |
| 304 for (ListValue::const_iterator it2 = url_list->begin(), | 304 for (ListValue::const_iterator it2 = url_list->begin(), |
| 305 end2 = url_list->end(); it2 != end2; ++it2) { | 305 end2 = url_list->end(); it2 != end2; ++it2) { |
| 306 std::string override; | 306 std::string override; |
| 307 if (!(*it2)->GetAsString(&override)) | 307 if (!(*it2)->GetAsString(&override)) |
| 308 continue; | 308 continue; |
| 309 if (StartsWithASCII(url->spec(), override, true)) { | 309 if (StartsWithASCII(url->spec(), override, true)) { |
| 310 GURL original_url(chrome::kChromeUIScheme + std::string("://") + *it + | 310 GURL original_url(chrome::kChromeUIScheme + std::string("://") + *it + |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 420 } | 420 } |
| 421 | 421 |
| 422 // static | 422 // static |
| 423 void ExtensionWebUI::GetFaviconForURL(Profile* profile, | 423 void ExtensionWebUI::GetFaviconForURL(Profile* profile, |
| 424 FaviconService::GetFaviconRequest* request, const GURL& page_url) { | 424 FaviconService::GetFaviconRequest* request, const GURL& page_url) { |
| 425 // tracker deletes itself when done. | 425 // tracker deletes itself when done. |
| 426 ExtensionWebUIImageLoadingTracker* tracker = | 426 ExtensionWebUIImageLoadingTracker* tracker = |
| 427 new ExtensionWebUIImageLoadingTracker(profile, request, page_url); | 427 new ExtensionWebUIImageLoadingTracker(profile, request, page_url); |
| 428 tracker->Init(); | 428 tracker->Init(); |
| 429 } | 429 } |
| OLD | NEW |