OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "apps/app_load_service.h" | 7 #include "apps/app_load_service.h" |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 24 matching lines...) Expand all Loading... |
35 #include "chrome/browser/ui/host_desktop.h" | 35 #include "chrome/browser/ui/host_desktop.h" |
36 #include "chrome/common/chrome_switches.h" | 36 #include "chrome/common/chrome_switches.h" |
37 #include "chrome/common/extensions/extension_constants.h" | 37 #include "chrome/common/extensions/extension_constants.h" |
38 #include "chrome/common/extensions/extension_icon_set.h" | 38 #include "chrome/common/extensions/extension_icon_set.h" |
39 #include "chrome/common/extensions/manifest_handlers/icons_handler.h" | 39 #include "chrome/common/extensions/manifest_handlers/icons_handler.h" |
40 #include "chrome/common/pref_names.h" | 40 #include "chrome/common/pref_names.h" |
41 #include "content/public/browser/notification_service.h" | 41 #include "content/public/browser/notification_service.h" |
42 #include "content/public/browser/site_instance.h" | 42 #include "content/public/browser/site_instance.h" |
43 #include "content/public/browser/web_contents.h" | 43 #include "content/public/browser/web_contents.h" |
44 #include "extensions/common/extension.h" | 44 #include "extensions/common/extension.h" |
| 45 #include "extensions/common/extension_set.h" |
45 #include "extensions/common/manifest_handlers/background_info.h" | 46 #include "extensions/common/manifest_handlers/background_info.h" |
46 #include "grit/generated_resources.h" | 47 #include "grit/generated_resources.h" |
47 #include "grit/theme_resources.h" | 48 #include "grit/theme_resources.h" |
48 #include "ipc/ipc_message.h" | 49 #include "ipc/ipc_message.h" |
49 #include "ui/base/l10n/l10n_util.h" | 50 #include "ui/base/l10n/l10n_util.h" |
50 #include "ui/base/resource/resource_bundle.h" | 51 #include "ui/base/resource/resource_bundle.h" |
51 #include "ui/gfx/image/image.h" | 52 #include "ui/gfx/image/image.h" |
52 | 53 |
53 #if defined(ENABLE_NOTIFICATIONS) | 54 #if defined(ENABLE_NOTIFICATIONS) |
54 #include "ui/message_center/message_center.h" | 55 #include "ui/message_center/message_center.h" |
(...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
575 dict->GetString(kUrlKey, &url); | 576 dict->GetString(kUrlKey, &url); |
576 dict->GetString(kFrameNameKey, &frame_name); | 577 dict->GetString(kFrameNameKey, &frame_name); |
577 LoadBackgroundContents(profile, | 578 LoadBackgroundContents(profile, |
578 GURL(url), | 579 GURL(url), |
579 frame_name, | 580 frame_name, |
580 UTF8ToUTF16(extension_id)); | 581 UTF8ToUTF16(extension_id)); |
581 } | 582 } |
582 | 583 |
583 void BackgroundContentsService::LoadBackgroundContentsFromManifests( | 584 void BackgroundContentsService::LoadBackgroundContentsFromManifests( |
584 Profile* profile) { | 585 Profile* profile) { |
585 const ExtensionSet* extensions = extensions::ExtensionSystem::Get(profile)-> | 586 const extensions::ExtensionSet* extensions = |
586 extension_service()->extensions(); | 587 extensions::ExtensionSystem::Get(profile)-> |
587 ExtensionSet::const_iterator iter = extensions->begin(); | 588 extension_service()->extensions(); |
588 for (; iter != extensions->end(); ++iter) { | 589 for (extensions::ExtensionSet::const_iterator iter = extensions->begin(); |
| 590 iter != extensions->end(); ++iter) { |
589 const Extension* extension = iter->get(); | 591 const Extension* extension = iter->get(); |
590 if (extension->is_hosted_app() && | 592 if (extension->is_hosted_app() && |
591 BackgroundInfo::HasBackgroundPage(extension)) { | 593 BackgroundInfo::HasBackgroundPage(extension)) { |
592 LoadBackgroundContents(profile, | 594 LoadBackgroundContents(profile, |
593 BackgroundInfo::GetBackgroundURL(extension), | 595 BackgroundInfo::GetBackgroundURL(extension), |
594 ASCIIToUTF16("background"), | 596 ASCIIToUTF16("background"), |
595 UTF8ToUTF16(extension->id())); | 597 UTF8ToUTF16(extension->id())); |
596 } | 598 } |
597 } | 599 } |
598 } | 600 } |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
755 bool user_gesture, | 757 bool user_gesture, |
756 bool* was_blocked) { | 758 bool* was_blocked) { |
757 Browser* browser = chrome::FindLastActiveWithProfile( | 759 Browser* browser = chrome::FindLastActiveWithProfile( |
758 Profile::FromBrowserContext(new_contents->GetBrowserContext()), | 760 Profile::FromBrowserContext(new_contents->GetBrowserContext()), |
759 chrome::GetActiveDesktop()); | 761 chrome::GetActiveDesktop()); |
760 if (browser) { | 762 if (browser) { |
761 chrome::AddWebContents(browser, NULL, new_contents, disposition, | 763 chrome::AddWebContents(browser, NULL, new_contents, disposition, |
762 initial_pos, user_gesture, was_blocked); | 764 initial_pos, user_gesture, was_blocked); |
763 } | 765 } |
764 } | 766 } |
OLD | NEW |