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 "base/basictypes.h" | 8 #include "base/basictypes.h" |
8 #include "base/bind.h" | 9 #include "base/bind.h" |
9 #include "base/command_line.h" | 10 #include "base/command_line.h" |
10 #include "base/message_loop.h" | 11 #include "base/message_loop.h" |
11 #include "base/prefs/pref_service.h" | 12 #include "base/prefs/pref_service.h" |
12 #include "base/string_util.h" | 13 #include "base/string_util.h" |
13 #include "base/utf_string_conversions.h" | 14 #include "base/utf_string_conversions.h" |
14 #include "base/values.h" | 15 #include "base/values.h" |
15 #include "chrome/browser/background/background_contents_service_factory.h" | 16 #include "chrome/browser/background/background_contents_service_factory.h" |
16 #include "chrome/browser/browser_process.h" | 17 #include "chrome/browser/browser_process.h" |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 virtual void Click() OVERRIDE { | 86 virtual void Click() OVERRIDE { |
86 if (is_hosted_app_) { | 87 if (is_hosted_app_) { |
87 // There can be a race here: user clicks the balloon, and simultaneously | 88 // There can be a race here: user clicks the balloon, and simultaneously |
88 // reloads the sad tab for the app. So we check here to be safe before | 89 // reloads the sad tab for the app. So we check here to be safe before |
89 // loading the background page. | 90 // loading the background page. |
90 BackgroundContentsService* service = | 91 BackgroundContentsService* service = |
91 BackgroundContentsServiceFactory::GetForProfile(profile_); | 92 BackgroundContentsServiceFactory::GetForProfile(profile_); |
92 if (!service->GetAppBackgroundContents(ASCIIToUTF16(extension_id_))) | 93 if (!service->GetAppBackgroundContents(ASCIIToUTF16(extension_id_))) |
93 service->LoadBackgroundContentsForExtension(profile_, extension_id_); | 94 service->LoadBackgroundContentsForExtension(profile_, extension_id_); |
94 } else if (is_platform_app_) { | 95 } else if (is_platform_app_) { |
95 extensions::ExtensionSystem::Get(profile_)->extension_service()-> | 96 apps::AppLoadService::Get(profile_)->RestartApplication(extension_id_); |
96 RestartExtension(extension_id_); | |
97 } else { | 97 } else { |
98 extensions::ExtensionSystem::Get(profile_)->extension_service()-> | 98 extensions::ExtensionSystem::Get(profile_)->extension_service()-> |
99 ReloadExtension(extension_id_); | 99 ReloadExtension(extension_id_); |
100 } | 100 } |
101 | 101 |
102 // Closing the balloon here should be OK, but it causes a crash on Mac | 102 // Closing the balloon here should be OK, but it causes a crash on Mac |
103 // http://crbug.com/78167 | 103 // http://crbug.com/78167 |
104 ScheduleCloseBalloon(extension_id_); | 104 ScheduleCloseBalloon(extension_id_); |
105 } | 105 } |
106 | 106 |
(...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
680 bool user_gesture, | 680 bool user_gesture, |
681 bool* was_blocked) { | 681 bool* was_blocked) { |
682 Browser* browser = chrome::FindLastActiveWithProfile( | 682 Browser* browser = chrome::FindLastActiveWithProfile( |
683 Profile::FromBrowserContext(new_contents->GetBrowserContext()), | 683 Profile::FromBrowserContext(new_contents->GetBrowserContext()), |
684 chrome::GetActiveDesktop()); | 684 chrome::GetActiveDesktop()); |
685 if (browser) { | 685 if (browser) { |
686 chrome::AddWebContents(browser, NULL, new_contents, disposition, | 686 chrome::AddWebContents(browser, NULL, new_contents, disposition, |
687 initial_pos, user_gesture, was_blocked); | 687 initial_pos, user_gesture, was_blocked); |
688 } | 688 } |
689 } | 689 } |
OLD | NEW |