Elim cr-checkbox
[chromium-blink-merge.git] / chrome / browser / extensions / updater / chromeos_extension_cache_delegate.cc
blob135dcb6e24a151724bb38eb11dd972712084e304
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "chrome/browser/extensions/updater/chromeos_extension_cache_delegate.h"
7 #include <stddef.h>
9 #include "base/path_service.h"
10 #include "chrome/browser/chromeos/settings/cros_settings.h"
11 #include "chromeos/chromeos_paths.h"
12 #include "chromeos/settings/cros_settings_names.h"
14 namespace extensions {
16 ChromeOSExtensionCacheDelegate::ChromeOSExtensionCacheDelegate() {
17 CHECK(PathService::Get(chromeos::DIR_DEVICE_EXTENSION_LOCAL_CACHE,
18 &cache_dir_));
21 ChromeOSExtensionCacheDelegate::ChromeOSExtensionCacheDelegate(
22 const base::FilePath& cache_dir)
23 : cache_dir_(cache_dir) {
26 const base::FilePath& ChromeOSExtensionCacheDelegate::GetCacheDir() const {
27 return cache_dir_;
30 size_t ChromeOSExtensionCacheDelegate::GetMaximumCacheSize() const {
31 size_t max_size = ExtensionCacheDelegate::GetMaximumCacheSize();
32 int policy_size = 0;
33 if (chromeos::CrosSettings::Get()->GetInteger(chromeos::kExtensionCacheSize,
34 &policy_size) &&
35 policy_size >= static_cast<int>(GetMinimumCacheSize())) {
36 max_size = policy_size;
38 return max_size;
41 } // namespace extensions