| 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/chromeos/extensions/file_manager/open_with_browser.h" | 5 #include "chrome/browser/chromeos/extensions/file_manager/open_with_browser.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| 11 #include "base/threading/sequenced_worker_pool.h" | 11 #include "base/threading/sequenced_worker_pool.h" |
| 12 #include "chrome/browser/chromeos/drive/drive.pb.h" | 12 #include "chrome/browser/chromeos/drive/drive.pb.h" |
| 13 #include "chrome/browser/chromeos/drive/drive_integration_service.h" | |
| 14 #include "chrome/browser/chromeos/drive/file_system.h" | 13 #include "chrome/browser/chromeos/drive/file_system.h" |
| 15 #include "chrome/browser/chromeos/drive/file_system_util.h" | 14 #include "chrome/browser/chromeos/drive/file_system_util.h" |
| 16 #include "chrome/browser/extensions/api/file_handlers/app_file_handler_util.h" | 15 #include "chrome/browser/extensions/api/file_handlers/app_file_handler_util.h" |
| 17 #include "chrome/browser/extensions/crx_installer.h" | 16 #include "chrome/browser/extensions/crx_installer.h" |
| 18 #include "chrome/browser/extensions/extension_install_prompt.h" | 17 #include "chrome/browser/extensions/extension_install_prompt.h" |
| 19 #include "chrome/browser/extensions/extension_service.h" | 18 #include "chrome/browser/extensions/extension_service.h" |
| 20 #include "chrome/browser/extensions/extension_system.h" | 19 #include "chrome/browser/extensions/extension_system.h" |
| 21 #include "chrome/browser/plugins/plugin_prefs.h" | 20 #include "chrome/browser/plugins/plugin_prefs.h" |
| 22 #include "chrome/browser/profiles/profile.h" | 21 #include "chrome/browser/profiles/profile.h" |
| 23 #include "chrome/browser/profiles/profile_manager.h" | 22 #include "chrome/browser/profiles/profile_manager.h" |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 BrowserThread::GetBlockingPool(), | 194 BrowserThread::GetBlockingPool(), |
| 196 FROM_HERE, | 195 FROM_HERE, |
| 197 base::Bind(&ReadUrlFromGDocOnBlockingPool, file_path), | 196 base::Bind(&ReadUrlFromGDocOnBlockingPool, file_path), |
| 198 base::Bind(&OpenNewTab, static_cast<Profile*>(NULL))); | 197 base::Bind(&OpenNewTab, static_cast<Profile*>(NULL))); |
| 199 } | 198 } |
| 200 return true; | 199 return true; |
| 201 } | 200 } |
| 202 | 201 |
| 203 if (file_path.MatchesExtension(kCRXExtension)) { | 202 if (file_path.MatchesExtension(kCRXExtension)) { |
| 204 if (drive::util::IsUnderDriveMountPoint(file_path)) { | 203 if (drive::util::IsUnderDriveMountPoint(file_path)) { |
| 205 drive::DriveIntegrationService* integration_service = | 204 drive::FileSystemInterface* file_system = |
| 206 drive::DriveIntegrationServiceFactory::GetForProfile(profile); | 205 drive::util::GetFileSystemByProfile(profile); |
| 207 if (!integration_service) | 206 if (!file_system) |
| 208 return false; | 207 return false; |
| 209 integration_service->file_system()->GetFileByPath( | 208 file_system->GetFileByPath( |
| 210 drive::util::ExtractDrivePath(file_path), | 209 drive::util::ExtractDrivePath(file_path), |
| 211 base::Bind(&OnCRXDownloadCallback, profile)); | 210 base::Bind(&OnCRXDownloadCallback, profile)); |
| 212 } else { | 211 } else { |
| 213 InstallCRX(profile, file_path); | 212 InstallCRX(profile, file_path); |
| 214 } | 213 } |
| 215 return true; | 214 return true; |
| 216 } | 215 } |
| 217 | 216 |
| 218 // Failed to open the file of unknown type. | 217 // Failed to open the file of unknown type. |
| 219 LOG(WARNING) << "Unknown file type: " << file_path.value(); | 218 LOG(WARNING) << "Unknown file type: " << file_path.value(); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 230 base::FilePath::FromUTF8Unsafe("dummy").AddExtension(file_extension); | 229 base::FilePath::FromUTF8Unsafe("dummy").AddExtension(file_extension); |
| 231 if (file_path.MatchesExtension(kPdfExtension)) | 230 if (file_path.MatchesExtension(kPdfExtension)) |
| 232 return IsPdfPluginEnabled(profile); | 231 return IsPdfPluginEnabled(profile); |
| 233 if (file_path.MatchesExtension(kSwfExtension)) | 232 if (file_path.MatchesExtension(kSwfExtension)) |
| 234 return IsFlashPluginEnabled(profile); | 233 return IsFlashPluginEnabled(profile); |
| 235 return false; | 234 return false; |
| 236 } | 235 } |
| 237 | 236 |
| 238 } // namespace util | 237 } // namespace util |
| 239 } // namespace file_manager | 238 } // namespace file_manager |
| OLD | NEW |