| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/install_limiter.h" | 5 #include "chrome/browser/chromeos/extensions/install_limiter.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| 11 #include "base/threading/sequenced_worker_pool.h" | 11 #include "base/threading/sequenced_worker_pool.h" |
| 12 #include "chrome/browser/chrome_notification_types.h" | 12 #include "chrome/browser/chrome_notification_types.h" |
| 13 #include "chrome/browser/chromeos/extensions/install_limiter_factory.h" | 13 #include "chrome/browser/chromeos/extensions/install_limiter_factory.h" |
| 14 #include "content/public/browser/browser_thread.h" | 14 #include "content/public/browser/browser_thread.h" |
| 15 #include "content/public/browser/notification_details.h" | 15 #include "content/public/browser/notification_details.h" |
| 16 #include "content/public/browser/notification_source.h" | 16 #include "content/public/browser/notification_source.h" |
| 17 | 17 |
| 18 using content::BrowserThread; | 18 using content::BrowserThread; |
| 19 | 19 |
| 20 namespace { | 20 namespace { |
| 21 | 21 |
| 22 int64 GetFileSizeOnBlockingPool(const base::FilePath& file) { | 22 int64 GetFileSizeOnBlockingPool(const base::FilePath& file) { |
| 23 DCHECK(BrowserThread::GetBlockingPool()->RunsTasksOnCurrentThread()); | 23 DCHECK(BrowserThread::GetBlockingPool()->RunsTasksOnCurrentThread()); |
| 24 | 24 |
| 25 // Get file size. In case of error, sets 0 as file size to let the installer | 25 // Get file size. In case of error, sets 0 as file size to let the installer |
| 26 // run and fail. | 26 // run and fail. |
| 27 int64 size; | 27 int64 size; |
| 28 return file_util::GetFileSize(file, &size) ? size : 0; | 28 return base::GetFileSize(file, &size) ? size : 0; |
| 29 } | 29 } |
| 30 | 30 |
| 31 } // namespace | 31 } // namespace |
| 32 | 32 |
| 33 namespace extensions { | 33 namespace extensions { |
| 34 | 34 |
| 35 //////////////////////////////////////////////////////////////////////////////// | 35 //////////////////////////////////////////////////////////////////////////////// |
| 36 // InstallLimiter::DeferredInstall | 36 // InstallLimiter::DeferredInstall |
| 37 | 37 |
| 38 InstallLimiter::DeferredInstall::DeferredInstall( | 38 InstallLimiter::DeferredInstall::DeferredInstall( |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 chrome::NOTIFICATION_CRX_INSTALLER_DONE, | 133 chrome::NOTIFICATION_CRX_INSTALLER_DONE, |
| 134 source); | 134 source); |
| 135 | 135 |
| 136 const scoped_refptr<CrxInstaller> installer = | 136 const scoped_refptr<CrxInstaller> installer = |
| 137 content::Source<extensions::CrxInstaller>(source).ptr(); | 137 content::Source<extensions::CrxInstaller>(source).ptr(); |
| 138 running_installers_.erase(installer); | 138 running_installers_.erase(installer); |
| 139 CheckAndRunDeferrredInstalls(); | 139 CheckAndRunDeferrredInstalls(); |
| 140 } | 140 } |
| 141 | 141 |
| 142 } // namespace extensions | 142 } // namespace extensions |
| OLD | NEW |