summaryrefslogtreecommitdiffstats
path: root/webkit/quota/mock_special_storage_policy.cc
blob: c7fdb8f67b59ac8523ff48916f845b927726dbc4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "webkit/quota/mock_special_storage_policy.h"

namespace quota {

MockSpecialStoragePolicy::MockSpecialStoragePolicy()
    : all_unlimited_(false) {}

MockSpecialStoragePolicy::~MockSpecialStoragePolicy() {}

bool MockSpecialStoragePolicy::IsStorageProtected(const GURL& origin) {
  return protected_.find(origin) != protected_.end();
}

bool MockSpecialStoragePolicy::IsStorageUnlimited(const GURL& origin) {
  if (all_unlimited_)
    return true;
  return unlimited_.find(origin) != unlimited_.end();
}

bool MockSpecialStoragePolicy::IsStorageSessionOnly(const GURL& origin) {
  return session_only_.find(origin) != session_only_.end();
}

bool MockSpecialStoragePolicy::IsFileHandler(const std::string& extension_id) {
  return file_handlers_.find(extension_id) != file_handlers_.end();
}

bool MockSpecialStoragePolicy::HasSessionOnlyOrigins() {
  return !session_only_.empty();
}

}  // namespace quota