| 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 #include "chrome/browser/extensions/file_manager_util.h" | 4 #include "chrome/browser/extensions/file_manager_util.h" |
| 5 | 5 |
| 6 #include "base/bind.h" | 6 #include "base/bind.h" |
| 7 #include "base/json/json_writer.h" | 7 #include "base/json/json_writer.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
| 10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 #include "ui/base/l10n/l10n_util.h" | 31 #include "ui/base/l10n/l10n_util.h" |
| 32 #include "webkit/fileapi/file_system_context.h" | 32 #include "webkit/fileapi/file_system_context.h" |
| 33 #include "webkit/fileapi/file_system_mount_point_provider.h" | 33 #include "webkit/fileapi/file_system_mount_point_provider.h" |
| 34 #include "webkit/fileapi/file_system_util.h" | 34 #include "webkit/fileapi/file_system_util.h" |
| 35 #include "webkit/plugins/webplugininfo.h" | 35 #include "webkit/plugins/webplugininfo.h" |
| 36 | 36 |
| 37 #if defined(OS_CHROMEOS) | 37 #if defined(OS_CHROMEOS) |
| 38 #include "chrome/browser/chromeos/media/media_player.h" | 38 #include "chrome/browser/chromeos/media/media_player.h" |
| 39 #endif | 39 #endif |
| 40 | 40 |
| 41 using content::BrowserContext; |
| 41 using content::BrowserThread; | 42 using content::BrowserThread; |
| 42 using content::PluginService; | 43 using content::PluginService; |
| 43 using content::UserMetricsAction; | 44 using content::UserMetricsAction; |
| 44 | 45 |
| 45 #define FILEBROWSER_DOMAIN "hhaomjibdihmijegdhdafkllkbggdgoj" | 46 #define FILEBROWSER_DOMAIN "hhaomjibdihmijegdhdafkllkbggdgoj" |
| 46 const char kFileBrowserDomain[] = FILEBROWSER_DOMAIN; | 47 const char kFileBrowserDomain[] = FILEBROWSER_DOMAIN; |
| 47 | 48 |
| 48 namespace file_manager_util { | 49 namespace file_manager_util { |
| 49 namespace { | 50 namespace { |
| 50 | 51 |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 | 210 |
| 210 GURL base_url = fileapi::GetFileSystemRootURI(origin_url, | 211 GURL base_url = fileapi::GetFileSystemRootURI(origin_url, |
| 211 fileapi::kFileSystemTypeExternal); | 212 fileapi::kFileSystemTypeExternal); |
| 212 *url = GURL(base_url.spec() + virtual_path.value()); | 213 *url = GURL(base_url.spec() + virtual_path.value()); |
| 213 return true; | 214 return true; |
| 214 } | 215 } |
| 215 | 216 |
| 216 bool ConvertFileToRelativeFileSystemPath( | 217 bool ConvertFileToRelativeFileSystemPath( |
| 217 Profile* profile, const FilePath& full_file_path, FilePath* virtual_path) { | 218 Profile* profile, const FilePath& full_file_path, FilePath* virtual_path) { |
| 218 fileapi::ExternalFileSystemMountPointProvider* provider = | 219 fileapi::ExternalFileSystemMountPointProvider* provider = |
| 219 profile->GetFileSystemContext()->external_provider(); | 220 BrowserContext::GetFileSystemContext(profile)->external_provider(); |
| 220 if (!provider) | 221 if (!provider) |
| 221 return false; | 222 return false; |
| 222 | 223 |
| 223 // Find if this file path is managed by the external provider. | 224 // Find if this file path is managed by the external provider. |
| 224 if (!provider->GetVirtualPath(full_file_path, virtual_path)) | 225 if (!provider->GetVirtualPath(full_file_path, virtual_path)) |
| 225 return false; | 226 return false; |
| 226 | 227 |
| 227 return true; | 228 return true; |
| 228 } | 229 } |
| 229 | 230 |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 400 return; | 401 return; |
| 401 | 402 |
| 402 scoped_refptr<CrxInstaller> installer(CrxInstaller::Create(service, | 403 scoped_refptr<CrxInstaller> installer(CrxInstaller::Create(service, |
| 403 new ExtensionInstallUI(profile))); | 404 new ExtensionInstallUI(profile))); |
| 404 installer->set_is_gallery_install(false); | 405 installer->set_is_gallery_install(false); |
| 405 installer->set_allow_silent_install(false); | 406 installer->set_allow_silent_install(false); |
| 406 installer->InstallCrx(full_path); | 407 installer->InstallCrx(full_path); |
| 407 } | 408 } |
| 408 | 409 |
| 409 } // namespace file_manager_util | 410 } // namespace file_manager_util |
| OLD | NEW |