Chromium Code Reviews| 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 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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. |
| 358 NOTREACHED() << "No extension found for BackgroundContents - id = " | 358 NOTREACHED() << "No extension found for BackgroundContents - id = " |
| 359 << *it; | 359 << *it; |
| 360 return; | 360 // Don't cancel out of our loop, just ignore this BackgroundContents and |
| 361 // load the next one. | |
| 362 continue; | |
|
rafaelw
2011/10/04 20:10:28
It seems wrong to leave the NOTREACHED() here. Als
Andrew T Wilson (Slow)
2011/10/04 21:12:05
Updated the comment. Let me know if you want this
| |
| 361 } | 363 } |
| 362 LoadBackgroundContentsFromDictionary(profile, *it, contents); | 364 LoadBackgroundContentsFromDictionary(profile, *it, contents); |
| 363 } | 365 } |
| 364 } | 366 } |
| 365 | 367 |
| 366 void BackgroundContentsService::LoadBackgroundContentsForExtension( | 368 void BackgroundContentsService::LoadBackgroundContentsForExtension( |
| 367 Profile* profile, | 369 Profile* profile, |
| 368 const std::string& extension_id) { | 370 const std::string& extension_id) { |
| 369 // First look if the manifest specifies a background page. | 371 // First look if the manifest specifies a background page. |
| 370 const Extension* extension = | 372 const Extension* extension = |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 573 TabContents* new_contents, | 575 TabContents* new_contents, |
| 574 WindowOpenDisposition disposition, | 576 WindowOpenDisposition disposition, |
| 575 const gfx::Rect& initial_pos, | 577 const gfx::Rect& initial_pos, |
| 576 bool user_gesture) { | 578 bool user_gesture) { |
| 577 Browser* browser = BrowserList::GetLastActiveWithProfile( | 579 Browser* browser = BrowserList::GetLastActiveWithProfile( |
| 578 Profile::FromBrowserContext(new_contents->browser_context())); | 580 Profile::FromBrowserContext(new_contents->browser_context())); |
| 579 if (!browser) | 581 if (!browser) |
| 580 return; | 582 return; |
| 581 browser->AddTabContents(new_contents, disposition, initial_pos, user_gesture); | 583 browser->AddTabContents(new_contents, disposition, initial_pos, user_gesture); |
| 582 } | 584 } |
| OLD | NEW |