| 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 } | |
| 253 | 246 |
| 254 size_t i = 0; | 247 size_t i = 0; |
| 255 while (i < url_list->GetSize()) { | 248 while (i < url_list->GetSize()) { |
| 256 Value* val = NULL; | 249 Value* val = NULL; |
| 257 url_list->Get(i, &val); | 250 url_list->Get(i, &val); |
| 258 | 251 |
| 259 // Verify that the override value is good. If not, unregister it and find | 252 // Verify that the override value is good. If not, unregister it and find |
| 260 // the next one. | 253 // the next one. |
| 261 std::string override; | 254 std::string override; |
| 262 if (!val->GetAsString(&override)) { | 255 if (!val->GetAsString(&override)) { |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 407 } | 400 } |
| 408 | 401 |
| 409 // static | 402 // static |
| 410 void ExtensionDOMUI::GetFaviconForURL(Profile* profile, | 403 void ExtensionDOMUI::GetFaviconForURL(Profile* profile, |
| 411 FaviconService::GetFaviconRequest* request, const GURL& page_url) { | 404 FaviconService::GetFaviconRequest* request, const GURL& page_url) { |
| 412 // tracker deletes itself when done. | 405 // tracker deletes itself when done. |
| 413 ExtensionDOMUIImageLoadingTracker* tracker = | 406 ExtensionDOMUIImageLoadingTracker* tracker = |
| 414 new ExtensionDOMUIImageLoadingTracker(profile, request, page_url); | 407 new ExtensionDOMUIImageLoadingTracker(profile, request, page_url); |
| 415 tracker->Init(); | 408 tracker->Init(); |
| 416 } | 409 } |
| OLD | NEW |