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/background/background_contents_service.h" | 5 #include "chrome/browser/background/background_contents_service.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
347 DCHECK(extensions_service); | 347 DCHECK(extensions_service); |
348 for (DictionaryValue::key_iterator it = contents->begin_keys(); | 348 for (DictionaryValue::key_iterator it = contents->begin_keys(); |
349 it != contents->end_keys(); ++it) { | 349 it != contents->end_keys(); ++it) { |
350 // Check to make sure that the parent extension is still enabled. | 350 // Check to make sure that the parent extension is still enabled. |
351 const Extension* extension = extensions_service->GetExtensionById( | 351 const Extension* extension = extensions_service->GetExtensionById( |
352 *it, false); | 352 *it, false); |
353 if (!extension) { | 353 if (!extension) { |
354 // We should never reach here - it should not be possible for an app | 354 // We should never reach here - it should not be possible for an app |
355 // to become uninstalled without the associated BackgroundContents being | 355 // to become uninstalled without the associated BackgroundContents being |
356 // unregistered via the EXTENSIONS_UNLOADED notification, unless there's a | 356 // unregistered via the EXTENSIONS_UNLOADED notification, unless there's a |
357 // crash before we could save our prefs. | 357 // crash before we could save our prefs, or if the user deletes the |
| 358 // extension files manually rather than uninstalling it. |
358 NOTREACHED() << "No extension found for BackgroundContents - id = " | 359 NOTREACHED() << "No extension found for BackgroundContents - id = " |
359 << *it; | 360 << *it; |
360 return; | 361 // Don't cancel out of our loop, just ignore this BackgroundContents and |
| 362 // load the next one. |
| 363 continue; |
361 } | 364 } |
362 LoadBackgroundContentsFromDictionary(profile, *it, contents); | 365 LoadBackgroundContentsFromDictionary(profile, *it, contents); |
363 } | 366 } |
364 } | 367 } |
365 | 368 |
366 void BackgroundContentsService::LoadBackgroundContentsForExtension( | 369 void BackgroundContentsService::LoadBackgroundContentsForExtension( |
367 Profile* profile, | 370 Profile* profile, |
368 const std::string& extension_id) { | 371 const std::string& extension_id) { |
369 // First look if the manifest specifies a background page. | 372 // First look if the manifest specifies a background page. |
370 const Extension* extension = | 373 const Extension* extension = |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
573 TabContents* new_contents, | 576 TabContents* new_contents, |
574 WindowOpenDisposition disposition, | 577 WindowOpenDisposition disposition, |
575 const gfx::Rect& initial_pos, | 578 const gfx::Rect& initial_pos, |
576 bool user_gesture) { | 579 bool user_gesture) { |
577 Browser* browser = BrowserList::GetLastActiveWithProfile( | 580 Browser* browser = BrowserList::GetLastActiveWithProfile( |
578 Profile::FromBrowserContext(new_contents->browser_context())); | 581 Profile::FromBrowserContext(new_contents->browser_context())); |
579 if (!browser) | 582 if (!browser) |
580 return; | 583 return; |
581 browser->AddTabContents(new_contents, disposition, initial_pos, user_gesture); | 584 browser->AddTabContents(new_contents, disposition, initial_pos, user_gesture); |
582 } | 585 } |
OLD | NEW |