| 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 #ifndef CHROME_BROWSER_CHROMEOS_EXTENSIONS_INSTALL_LIMITER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_EXTENSIONS_INSTALL_LIMITER_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_EXTENSIONS_INSTALL_LIMITER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_EXTENSIONS_INSTALL_LIMITER_H_ |
| 7 | 7 |
| 8 #include <stdint.h> |
| 9 |
| 8 #include <queue> | 10 #include <queue> |
| 9 #include <set> | 11 #include <set> |
| 10 | 12 |
| 11 #include "base/basictypes.h" | |
| 12 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
| 13 #include "base/files/file_path.h" | 14 #include "base/files/file_path.h" |
| 15 #include "base/macros.h" |
| 14 #include "base/memory/ref_counted.h" | 16 #include "base/memory/ref_counted.h" |
| 15 #include "base/memory/weak_ptr.h" | 17 #include "base/memory/weak_ptr.h" |
| 16 #include "base/timer/timer.h" | 18 #include "base/timer/timer.h" |
| 17 #include "chrome/browser/extensions/crx_installer.h" | 19 #include "chrome/browser/extensions/crx_installer.h" |
| 18 #include "components/keyed_service/core/keyed_service.h" | 20 #include "components/keyed_service/core/keyed_service.h" |
| 19 #include "content/public/browser/notification_observer.h" | 21 #include "content/public/browser/notification_observer.h" |
| 20 #include "content/public/browser/notification_registrar.h" | 22 #include "content/public/browser/notification_registrar.h" |
| 21 | 23 |
| 22 namespace extensions { | 24 namespace extensions { |
| 23 | 25 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 50 }; | 52 }; |
| 51 | 53 |
| 52 typedef std::queue<DeferredInstall> DeferredInstallList; | 54 typedef std::queue<DeferredInstall> DeferredInstallList; |
| 53 typedef std::set<scoped_refptr<CrxInstaller> > CrxInstallerSet; | 55 typedef std::set<scoped_refptr<CrxInstaller> > CrxInstallerSet; |
| 54 | 56 |
| 55 // Adds install info with size. If |size| is greater than a certain threshold, | 57 // Adds install info with size. If |size| is greater than a certain threshold, |
| 56 // it stores the install info into |deferred_installs_| to run it later. | 58 // it stores the install info into |deferred_installs_| to run it later. |
| 57 // Otherwise, it just runs the installer. | 59 // Otherwise, it just runs the installer. |
| 58 void AddWithSize(const scoped_refptr<CrxInstaller>& installer, | 60 void AddWithSize(const scoped_refptr<CrxInstaller>& installer, |
| 59 const base::FilePath& path, | 61 const base::FilePath& path, |
| 60 int64 size); | 62 int64_t size); |
| 61 | 63 |
| 62 // Checks and runs deferred big app installs when appropriate. | 64 // Checks and runs deferred big app installs when appropriate. |
| 63 void CheckAndRunDeferrredInstalls(); | 65 void CheckAndRunDeferrredInstalls(); |
| 64 | 66 |
| 65 // Starts install using passed-in info and observes |installer|'s done | 67 // Starts install using passed-in info and observes |installer|'s done |
| 66 // notification. | 68 // notification. |
| 67 void RunInstall(const scoped_refptr<CrxInstaller>& installer, | 69 void RunInstall(const scoped_refptr<CrxInstaller>& installer, |
| 68 const base::FilePath& path); | 70 const base::FilePath& path); |
| 69 | 71 |
| 70 // content::NotificationObserver overrides: | 72 // content::NotificationObserver overrides: |
| (...skipping 10 matching lines...) Expand all Loading... |
| 81 base::OneShotTimer wait_timer_; | 83 base::OneShotTimer wait_timer_; |
| 82 | 84 |
| 83 bool disabled_for_test_; | 85 bool disabled_for_test_; |
| 84 | 86 |
| 85 DISALLOW_COPY_AND_ASSIGN(InstallLimiter); | 87 DISALLOW_COPY_AND_ASSIGN(InstallLimiter); |
| 86 }; | 88 }; |
| 87 | 89 |
| 88 } // namespace extensions | 90 } // namespace extensions |
| 89 | 91 |
| 90 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_INSTALL_LIMITER_H_ | 92 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_INSTALL_LIMITER_H_ |
| OLD | NEW |