OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_util.h" | 5 #include "chrome/browser/extensions/extension_util.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/values.h" | 9 #include "base/values.h" |
10 #include "chrome/browser/extensions/extension_service.h" | 10 #include "chrome/browser/extensions/extension_service.h" |
11 #include "chrome/browser/extensions/extension_sync_service.h" | 11 #include "chrome/browser/extensions/extension_sync_service.h" |
12 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
13 #include "chrome/browser/ui/webui/extensions/extension_icon_source.h" | 13 #include "chrome/browser/ui/webui/extensions/extension_icon_source.h" |
14 #include "chrome/common/chrome_switches.h" | 14 #include "chrome/common/chrome_switches.h" |
15 #include "chrome/common/extensions/manifest_handlers/app_isolation_info.h" | 15 #include "chrome/common/extensions/manifest_handlers/app_isolation_info.h" |
16 #include "chrome/common/extensions/sync_helper.h" | 16 #include "chrome/common/extensions/sync_helper.h" |
17 #include "content/public/browser/site_instance.h" | 17 #include "content/public/browser/site_instance.h" |
18 #include "extensions/browser/extension_prefs.h" | 18 #include "extensions/browser/extension_prefs.h" |
19 #include "extensions/browser/extension_registry.h" | 19 #include "extensions/browser/extension_registry.h" |
20 #include "extensions/browser/extension_system.h" | 20 #include "extensions/browser/extension_system.h" |
| 21 #include "extensions/browser/extension_util.h" |
21 #include "extensions/common/extension.h" | 22 #include "extensions/common/extension.h" |
22 #include "extensions/common/extension_icon_set.h" | 23 #include "extensions/common/extension_icon_set.h" |
23 #include "extensions/common/manifest.h" | 24 #include "extensions/common/manifest.h" |
24 #include "extensions/common/manifest_handlers/incognito_info.h" | 25 #include "extensions/common/manifest_handlers/incognito_info.h" |
25 #include "grit/theme_resources.h" | 26 #include "grit/theme_resources.h" |
26 #include "ui/base/resource/resource_bundle.h" | 27 #include "ui/base/resource/resource_bundle.h" |
27 | 28 |
28 namespace extensions { | 29 namespace extensions { |
29 namespace util { | 30 namespace util { |
30 | 31 |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 return !(ExtensionPrefs::Get(context)->GetDisableReasons(extension_id) & | 147 return !(ExtensionPrefs::Get(context)->GetDisableReasons(extension_id) & |
147 Extension::DISABLE_UNSUPPORTED_REQUIREMENT); | 148 Extension::DISABLE_UNSUPPORTED_REQUIREMENT); |
148 } | 149 } |
149 | 150 |
150 bool IsAppLaunchableWithoutEnabling(const std::string& extension_id, | 151 bool IsAppLaunchableWithoutEnabling(const std::string& extension_id, |
151 content::BrowserContext* context) { | 152 content::BrowserContext* context) { |
152 return ExtensionRegistry::Get(context)->GetExtensionById( | 153 return ExtensionRegistry::Get(context)->GetExtensionById( |
153 extension_id, ExtensionRegistry::ENABLED) != NULL; | 154 extension_id, ExtensionRegistry::ENABLED) != NULL; |
154 } | 155 } |
155 | 156 |
| 157 bool ShouldSyncApp(const Extension* app, content::BrowserContext* context) { |
| 158 return sync_helper::IsSyncableApp(app) && |
| 159 !util::IsEphemeralApp(app->id(), context); |
| 160 } |
| 161 |
156 bool IsExtensionIdle(const std::string& extension_id, | 162 bool IsExtensionIdle(const std::string& extension_id, |
157 content::BrowserContext* context) { | 163 content::BrowserContext* context) { |
158 ProcessManager* process_manager = | 164 ProcessManager* process_manager = |
159 ExtensionSystem::Get(context)->process_manager(); | 165 ExtensionSystem::Get(context)->process_manager(); |
160 DCHECK(process_manager); | 166 DCHECK(process_manager); |
161 ExtensionHost* host = | 167 ExtensionHost* host = |
162 process_manager->GetBackgroundHostForExtension(extension_id); | 168 process_manager->GetBackgroundHostForExtension(extension_id); |
163 if (host) | 169 if (host) |
164 return false; | 170 return false; |
165 | 171 |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 IDR_APP_DEFAULT_ICON); | 246 IDR_APP_DEFAULT_ICON); |
241 } | 247 } |
242 | 248 |
243 const gfx::ImageSkia& GetDefaultExtensionIcon() { | 249 const gfx::ImageSkia& GetDefaultExtensionIcon() { |
244 return *ResourceBundle::GetSharedInstance().GetImageSkiaNamed( | 250 return *ResourceBundle::GetSharedInstance().GetImageSkiaNamed( |
245 IDR_EXTENSION_DEFAULT_ICON); | 251 IDR_EXTENSION_DEFAULT_ICON); |
246 } | 252 } |
247 | 253 |
248 } // namespace util | 254 } // namespace util |
249 } // namespace extensions | 255 } // namespace extensions |
OLD | NEW |