summaryrefslogtreecommitdiffstats
path: root/storage/browser/quota/storage_observer.cc
blob: 81d33873c894343da83f839175f15eeecf636eab (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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
// Copyright 2014 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 <stdint.h>

#include "storage/browser/quota/storage_observer.h"

namespace storage {

// StorageObserver::Filter

StorageObserver::Filter::Filter()
    : storage_type(kStorageTypeUnknown) {
}

StorageObserver::Filter::Filter(StorageType storage_type, const GURL& origin)
    : storage_type(storage_type), origin(origin) {
}

bool StorageObserver::Filter::operator==(const Filter& other) const {
  return storage_type == other.storage_type &&
         origin == other.origin;
}

// StorageObserver::MonitorParams

StorageObserver::MonitorParams::MonitorParams()
    : dispatch_initial_state(false) {
}

StorageObserver::MonitorParams::MonitorParams(
    StorageType storage_type,
    const GURL& origin,
    const base::TimeDelta& rate,
    bool get_initial_state)
        : filter(storage_type, origin),
          rate(rate),
          dispatch_initial_state(get_initial_state) {
}

StorageObserver::MonitorParams::MonitorParams(
    const Filter& filter,
    const base::TimeDelta& rate,
    bool get_initial_state)
        : filter(filter),
          rate(rate),
          dispatch_initial_state(get_initial_state) {
}

// StorageObserver::Event

StorageObserver::Event::Event()
    : usage(0), quota(0) {
}

StorageObserver::Event::Event(const Filter& filter,
                              int64_t usage,
                              int64_t quota)
    : filter(filter), usage(usage), quota(quota) {}

bool StorageObserver::Event::operator==(const Event& other) const {
  return filter == other.filter &&
         usage == other.usage &&
         quota == other.quota;
}

}  // namespace storage