OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 continue; | 325 continue; |
326 } | 326 } |
327 // Insert the override at the front of the list. Last registered override | 327 // Insert the override at the front of the list. Last registered override |
328 // wins. | 328 // wins. |
329 page_overrides->Insert(0, new StringValue(iter->second.spec())); | 329 page_overrides->Insert(0, new StringValue(iter->second.spec())); |
330 } | 330 } |
331 } | 331 } |
332 | 332 |
333 // static | 333 // static |
334 void ExtensionWebUI::UnregisterAndReplaceOverride(const std::string& page, | 334 void ExtensionWebUI::UnregisterAndReplaceOverride(const std::string& page, |
335 Profile* profile, ListValue* list, Value* override) { | 335 Profile* profile, |
336 int index = list->Remove(*override); | 336 ListValue* list, |
337 if (index == 0) { | 337 Value* override) { |
| 338 size_t index = 0; |
| 339 bool found = list->Remove(*override, &index); |
| 340 if (found && index == 0) { |
338 // This is the active override, so we need to find all existing | 341 // This is the active override, so we need to find all existing |
339 // tabs for this override and get them to reload the original URL. | 342 // tabs for this override and get them to reload the original URL. |
340 for (TabContentsIterator iterator; !iterator.done(); ++iterator) { | 343 for (TabContentsIterator iterator; !iterator.done(); ++iterator) { |
341 TabContents* tab = (*iterator)->tab_contents(); | 344 TabContents* tab = (*iterator)->tab_contents(); |
342 Profile* tab_profile = | 345 Profile* tab_profile = |
343 Profile::FromBrowserContext(tab->browser_context()); | 346 Profile::FromBrowserContext(tab->browser_context()); |
344 if (tab_profile != profile) | 347 if (tab_profile != profile) |
345 continue; | 348 continue; |
346 | 349 |
347 GURL url = tab->GetURL(); | 350 GURL url = tab->GetURL(); |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
398 } | 401 } |
399 | 402 |
400 // static | 403 // static |
401 void ExtensionWebUI::GetFaviconForURL(Profile* profile, | 404 void ExtensionWebUI::GetFaviconForURL(Profile* profile, |
402 FaviconService::GetFaviconRequest* request, const GURL& page_url) { | 405 FaviconService::GetFaviconRequest* request, const GURL& page_url) { |
403 // tracker deletes itself when done. | 406 // tracker deletes itself when done. |
404 ExtensionWebUIImageLoadingTracker* tracker = | 407 ExtensionWebUIImageLoadingTracker* tracker = |
405 new ExtensionWebUIImageLoadingTracker(profile, request, page_url); | 408 new ExtensionWebUIImageLoadingTracker(profile, request, page_url); |
406 tracker->Init(); | 409 tracker->Init(); |
407 } | 410 } |
OLD | NEW |