| 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" |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 if (!extension.get()) | 242 if (!extension.get()) |
| 243 return false; | 243 return false; |
| 244 | 244 |
| 245 return AppIsolationInfo::HasIsolatedStorage(extension.get()); | 245 return AppIsolationInfo::HasIsolatedStorage(extension.get()); |
| 246 } | 246 } |
| 247 | 247 |
| 248 bool SiteHasIsolatedStorage(const GURL& extension_site_url, | 248 bool SiteHasIsolatedStorage(const GURL& extension_site_url, |
| 249 content::BrowserContext* context) { | 249 content::BrowserContext* context) { |
| 250 const Extension* extension = ExtensionRegistry::Get(context)-> | 250 const Extension* extension = ExtensionRegistry::Get(context)-> |
| 251 enabled_extensions().GetExtensionOrAppByURL(extension_site_url); | 251 enabled_extensions().GetExtensionOrAppByURL(extension_site_url); |
| 252 if (extension) | 252 if (!extension) |
| 253 return AppIsolationInfo::HasIsolatedStorage(extension); | 253 return false; |
| 254 | 254 |
| 255 if (extension_site_url.SchemeIs(kExtensionScheme)) { | 255 return AppIsolationInfo::HasIsolatedStorage(extension); |
| 256 // The site URL may also be from an evicted ephemeral app. We do not | |
| 257 // immediately delete their data when they are removed from extension | |
| 258 // system. | |
| 259 ExtensionPrefs* prefs = ExtensionPrefs::Get(context); | |
| 260 DCHECK(prefs); | |
| 261 scoped_ptr<ExtensionInfo> info = prefs->GetEvictedEphemeralAppInfo( | |
| 262 extension_site_url.host()); | |
| 263 if (info.get()) | |
| 264 return HasIsolatedStorage(*info); | |
| 265 } | |
| 266 | |
| 267 return false; | |
| 268 } | 256 } |
| 269 | 257 |
| 270 const gfx::ImageSkia& GetDefaultAppIcon() { | 258 const gfx::ImageSkia& GetDefaultAppIcon() { |
| 271 return *ResourceBundle::GetSharedInstance().GetImageSkiaNamed( | 259 return *ResourceBundle::GetSharedInstance().GetImageSkiaNamed( |
| 272 IDR_APP_DEFAULT_ICON); | 260 IDR_APP_DEFAULT_ICON); |
| 273 } | 261 } |
| 274 | 262 |
| 275 const gfx::ImageSkia& GetDefaultExtensionIcon() { | 263 const gfx::ImageSkia& GetDefaultExtensionIcon() { |
| 276 return *ResourceBundle::GetSharedInstance().GetImageSkiaNamed( | 264 return *ResourceBundle::GetSharedInstance().GetImageSkiaNamed( |
| 277 IDR_EXTENSION_DEFAULT_ICON); | 265 IDR_EXTENSION_DEFAULT_ICON); |
| 278 } | 266 } |
| 279 | 267 |
| 280 } // namespace util | 268 } // namespace util |
| 281 } // namespace extensions | 269 } // namespace extensions |
| OLD | NEW |