OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/ui/webui/quota_internals/quota_internals_types.h" | 5 #include "chrome/browser/ui/webui/quota_internals/quota_internals_types.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/values.h" | 9 #include "base/values.h" |
10 #include "net/base/url_util.h" | 10 #include "net/base/url_util.h" |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 | 72 |
73 PerOriginStorageInfo::PerOriginStorageInfo(const GURL& origin, | 73 PerOriginStorageInfo::PerOriginStorageInfo(const GURL& origin, |
74 storage::StorageType type) | 74 storage::StorageType type) |
75 : origin_(origin), | 75 : origin_(origin), |
76 type_(type), | 76 type_(type), |
77 host_(net::GetHostOrSpecFromURL(origin)), | 77 host_(net::GetHostOrSpecFromURL(origin)), |
78 in_use_(-1), | 78 in_use_(-1), |
79 used_count_(-1) { | 79 used_count_(-1) { |
80 } | 80 } |
81 | 81 |
| 82 PerOriginStorageInfo::PerOriginStorageInfo(const PerOriginStorageInfo& other) = |
| 83 default; |
| 84 |
82 PerOriginStorageInfo::~PerOriginStorageInfo() {} | 85 PerOriginStorageInfo::~PerOriginStorageInfo() {} |
83 | 86 |
84 base::Value* PerOriginStorageInfo::NewValue() const { | 87 base::Value* PerOriginStorageInfo::NewValue() const { |
85 base::DictionaryValue* dict = new base::DictionaryValue; | 88 base::DictionaryValue* dict = new base::DictionaryValue; |
86 DCHECK(!origin_.is_empty()); | 89 DCHECK(!origin_.is_empty()); |
87 DCHECK(!host_.empty()); | 90 DCHECK(!host_.empty()); |
88 dict->SetString("origin", origin_.spec()); | 91 dict->SetString("origin", origin_.spec()); |
89 dict->SetString("type", StorageTypeToString(type_)); | 92 dict->SetString("type", StorageTypeToString(type_)); |
90 dict->SetString("host", host_); | 93 dict->SetString("host", host_); |
91 if (in_use_ >= 0) | 94 if (in_use_ >= 0) |
92 dict->SetBoolean("inUse", (in_use_ > 0)); | 95 dict->SetBoolean("inUse", (in_use_ > 0)); |
93 if (used_count_ >= 0) | 96 if (used_count_ >= 0) |
94 dict->SetInteger("usedCount", used_count_); | 97 dict->SetInteger("usedCount", used_count_); |
95 if (!last_access_time_.is_null()) | 98 if (!last_access_time_.is_null()) |
96 dict->SetDouble("lastAccessTime", last_access_time_.ToDoubleT() * 1000.0); | 99 dict->SetDouble("lastAccessTime", last_access_time_.ToDoubleT() * 1000.0); |
97 if (!last_modified_time_.is_null()) { | 100 if (!last_modified_time_.is_null()) { |
98 dict->SetDouble("lastModifiedTime", | 101 dict->SetDouble("lastModifiedTime", |
99 last_modified_time_.ToDoubleT() * 1000.0); | 102 last_modified_time_.ToDoubleT() * 1000.0); |
100 } | 103 } |
101 return dict; | 104 return dict; |
102 } | 105 } |
103 | 106 |
104 } // namespace quota_internals | 107 } // namespace quota_internals |
OLD | NEW |