| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_dom_ui.h" | 5 #include "chrome/browser/extensions/extension_dom_ui.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 | 8 |
| 9 #include "net/base/file_stream.h" | 9 #include "net/base/file_stream.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 return false; | 236 return false; |
| 237 | 237 |
| 238 const DictionaryValue* overrides = | 238 const DictionaryValue* overrides = |
| 239 profile->GetPrefs()->GetDictionary(kExtensionURLOverrides); | 239 profile->GetPrefs()->GetDictionary(kExtensionURLOverrides); |
| 240 std::string page = url->host(); | 240 std::string page = url->host(); |
| 241 ListValue* url_list; | 241 ListValue* url_list; |
| 242 if (!overrides || !overrides->GetList(page, &url_list)) | 242 if (!overrides || !overrides->GetList(page, &url_list)) |
| 243 return false; | 243 return false; |
| 244 | 244 |
| 245 ExtensionsService* service = profile->GetExtensionsService(); | 245 ExtensionsService* service = profile->GetExtensionsService(); |
| 246 if (!service->is_ready()) { |
| 247 // TODO(erikkay) So far, it looks like extensions load before the new tab |
| 248 // page. I don't know if we have anything that enforces this, so add this |
| 249 // check for safety. |
| 250 NOTREACHED() << "Chrome URL override requested before extensions loaded"; |
| 251 return false; |
| 252 } |
| 246 | 253 |
| 247 size_t i = 0; | 254 size_t i = 0; |
| 248 while (i < url_list->GetSize()) { | 255 while (i < url_list->GetSize()) { |
| 249 Value* val = NULL; | 256 Value* val = NULL; |
| 250 url_list->Get(i, &val); | 257 url_list->Get(i, &val); |
| 251 | 258 |
| 252 // Verify that the override value is good. If not, unregister it and find | 259 // Verify that the override value is good. If not, unregister it and find |
| 253 // the next one. | 260 // the next one. |
| 254 std::string override; | 261 std::string override; |
| 255 if (!val->GetAsString(&override)) { | 262 if (!val->GetAsString(&override)) { |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 400 } | 407 } |
| 401 | 408 |
| 402 // static | 409 // static |
| 403 void ExtensionDOMUI::GetFaviconForURL(Profile* profile, | 410 void ExtensionDOMUI::GetFaviconForURL(Profile* profile, |
| 404 FaviconService::GetFaviconRequest* request, const GURL& page_url) { | 411 FaviconService::GetFaviconRequest* request, const GURL& page_url) { |
| 405 // tracker deletes itself when done. | 412 // tracker deletes itself when done. |
| 406 ExtensionDOMUIImageLoadingTracker* tracker = | 413 ExtensionDOMUIImageLoadingTracker* tracker = |
| 407 new ExtensionDOMUIImageLoadingTracker(profile, request, page_url); | 414 new ExtensionDOMUIImageLoadingTracker(profile, request, page_url); |
| 408 tracker->Init(); | 415 tracker->Init(); |
| 409 } | 416 } |
| OLD | NEW |