summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authorbauerb@chromium.org <bauerb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-24 15:32:42 +0000
committerbauerb@chromium.org <bauerb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-24 15:32:42 +0000
commit3cc47d6ba4dd8f5522e0b1939c3906742d964d94 (patch)
tree07b371fb4d1c5079a826e159756d63b0451a034b /chrome/browser
parent6cb60aa4474b7bd3680f5ce36aaf08bf0484dbea (diff)
downloadchromium_src-3cc47d6ba4dd8f5522e0b1939c3906742d964d94.zip
chromium_src-3cc47d6ba4dd8f5522e0b1939c3906742d964d94.tar.gz
chromium_src-3cc47d6ba4dd8f5522e0b1939c3906742d964d94.tar.bz2
Add IndexedDB to cookie tree.
XIB changes: Add another view with IndexedDB details to CookieDetailsView.xib. BUG=56248 TEST=CookiesTreeModelTest.*:CookiesDetailsTest.*:CookiesViewTest.*: Review URL: http://codereview.chromium.org/3429020 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@60470 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/cocoa/content_settings_dialog_controller.mm5
-rw-r--r--chrome/browser/cocoa/cookie_details.h56
-rw-r--r--chrome/browser/cocoa/cookie_details.mm65
-rw-r--r--chrome/browser/cocoa/cookie_details_unittest.mm48
-rw-r--r--chrome/browser/cocoa/cookies_window_controller.h4
-rw-r--r--chrome/browser/cocoa/cookies_window_controller.mm10
-rw-r--r--chrome/browser/cookies_tree_model.cc80
-rw-r--r--chrome/browser/cookies_tree_model.h102
-rw-r--r--chrome/browser/cookies_tree_model_unittest.cc153
-rw-r--r--chrome/browser/dom_ui/cookies_view_handler.cc34
-rw-r--r--chrome/browser/gtk/gtk_chrome_cookie_view.cc56
-rw-r--r--chrome/browser/gtk/gtk_chrome_cookie_view.h13
-rw-r--r--chrome/browser/gtk/options/cookie_filter_page_gtk.cc10
-rw-r--r--chrome/browser/gtk/options/cookies_view.cc21
-rw-r--r--chrome/browser/gtk/options/cookies_view.h10
-rw-r--r--chrome/browser/gtk/options/cookies_view_unittest.cc110
-rw-r--r--chrome/browser/resources/options/cookies_view.html31
-rw-r--r--chrome/browser/resources/options/cookies_view.js19
-rw-r--r--chrome/browser/tab_contents/tab_specific_content_settings.cc8
-rw-r--r--chrome/browser/views/indexed_db_info_view.cc148
-rw-r--r--chrome/browser/views/indexed_db_info_view.h56
-rw-r--r--chrome/browser/views/options/cookies_view.cc12
-rw-r--r--chrome/browser/views/options/cookies_view.h2
23 files changed, 894 insertions, 159 deletions
diff --git a/chrome/browser/cocoa/content_settings_dialog_controller.mm b/chrome/browser/cocoa/content_settings_dialog_controller.mm
index 0c71fd9..9ed2078 100644
--- a/chrome/browser/cocoa/content_settings_dialog_controller.mm
+++ b/chrome/browser/cocoa/content_settings_dialog_controller.mm
@@ -293,11 +293,14 @@ class PrefObserverDisabler {
new BrowsingDataLocalStorageHelper(profile_);
BrowsingDataAppCacheHelper* appcacheHelper =
new BrowsingDataAppCacheHelper(profile_);
+ BrowsingDataIndexedDBHelper* indexedDBHelper =
+ BrowsingDataIndexedDBHelper::Create(profile_);
CookiesWindowController* controller =
[[CookiesWindowController alloc] initWithProfile:profile_
databaseHelper:databaseHelper
storageHelper:storageHelper
- appcacheHelper:appcacheHelper];
+ appcacheHelper:appcacheHelper
+ indexedDBHelper:indexedDBHelper];
[controller attachSheetTo:[self window]];
}
diff --git a/chrome/browser/cocoa/cookie_details.h b/chrome/browser/cocoa/cookie_details.h
index 09511f0..5298ad8 100644
--- a/chrome/browser/cocoa/cookie_details.h
+++ b/chrome/browser/cocoa/cookie_details.h
@@ -5,6 +5,7 @@
#import <Cocoa/Cocoa.h>
#include "chrome/browser/browsing_data_database_helper.h"
+#include "chrome/browser/browsing_data_indexed_db_helper.h"
#include "chrome/browser/browsing_data_local_storage_helper.h"
#include "base/scoped_nsobject.h"
#include "net/base/cookie_monster.h"
@@ -21,31 +22,35 @@ enum CocoaCookieDetailsType {
// Detailed information about a cookie, used both in the cookie
// tree and the cookie prompt.
- kCocoaCookieDetailsTypeCookie = 1,
+ kCocoaCookieDetailsTypeCookie,
// Detailed information about a web database used for
// display in the cookie tree.
- kCocoaCookieDetailsTypeTreeDatabase = 2,
+ kCocoaCookieDetailsTypeTreeDatabase,
// Detailed information about local storage used for
// display in the cookie tree.
- kCocoaCookieDetailsTypeTreeLocalStorage = 3,
+ kCocoaCookieDetailsTypeTreeLocalStorage,
// Detailed information about an appcache used for display in the
// cookie tree.
- kCocoaCookieDetailsTypeTreeAppCache = 4,
+ kCocoaCookieDetailsTypeTreeAppCache,
+
+ // Detailed information about an IndexedDB used for display in the
+ // cookie tree.
+ kCocoaCookieDetailsTypeTreeIndexedDB,
// Detailed information about a web database used for display
// in the cookie prompt dialog.
- kCocoaCookieDetailsTypePromptDatabase = 5,
+ kCocoaCookieDetailsTypePromptDatabase,
// Detailed information about local storage used for display
// in the cookie prompt dialog.
- kCocoaCookieDetailsTypePromptLocalStorage = 6,
+ kCocoaCookieDetailsTypePromptLocalStorage,
// Detailed information about app caches used for display
// in the cookie prompt dialog.
- kCocoaCookieDetailsTypePromptAppCache = 7
+ kCocoaCookieDetailsTypePromptAppCache
};
// This class contains all of the information that can be displayed in
@@ -67,48 +72,52 @@ enum CocoaCookieDetailsType {
// it will expire with the session.
BOOL hasExpiration_;
- // These members are only set for type kCocoaCookieDetailsTypeCookie.
+ // Only set for type kCocoaCookieDetailsTypeCookie.
scoped_nsobject<NSString> content_;
scoped_nsobject<NSString> path_;
scoped_nsobject<NSString> sendFor_;
// Stringifed dates.
scoped_nsobject<NSString> expires_;
- // These members are only set for type kCocoaCookieDetailsTypeCookie and
+ // Only set for type kCocoaCookieDetailsTypeCookie and
// kCocoaCookieDetailsTypeTreeAppCache nodes.
scoped_nsobject<NSString> created_;
- // These members are only set for types kCocoaCookieDetailsTypeCookie,
- // kCocoaCookieDetailsTypePromptDatabase.
+ // Only set for types kCocoaCookieDetailsTypeCookie,
+ // kCocoaCookieDetailsTypePromptDatabase, and
+ // kCocoaCookieDetailsTypeTreeIndexedDB nodes.
scoped_nsobject<NSString> name_;
// Only set for type kCocoaCookieDetailsTypeTreeLocalStorage,
// kCocoaCookieDetailsTypeTreeDatabase,
- // kCocoaCookieDetailsTypePromptDatabase and
+ // kCocoaCookieDetailsTypePromptDatabase,
+ // kCocoaCookieDetailsTypeTreeIndexedDB, and
// kCocoaCookieDetailsTypeTreeAppCache nodes.
scoped_nsobject<NSString> fileSize_;
- // Only set for types kCocoaCookieDetailsTypeTreeLocalStorage and
- // kCocoaCookieDetailsTypeTreeDatabase nodes.
+ // Only set for types kCocoaCookieDetailsTypeTreeLocalStorage,
+ // kCocoaCookieDetailsTypeTreeDatabase, and
+ // kCocoaCookieDetailsTypeTreeIndexedDB nodes.
scoped_nsobject<NSString> lastModified_;
// Only set for type kCocoaCookieDetailsTypeTreeAppCache nodes.
scoped_nsobject<NSString> lastAccessed_;
- // These members are only set for types kCocoaCookieDetailsTypeCookie,
- // kCocoaCookieDetailsTypePromptDatabase and
- // kCocoaCookieDetailsTypePromptLocalStorage nodes.
+ // Only set for type kCocoaCookieDetailsTypeCookie,
+ // kCocoaCookieDetailsTypePromptDatabase,
+ // kCocoaCookieDetailsTypePromptLocalStorage, and
+ // kCocoaCookieDetailsTypeTreeIndexedDB nodes.
scoped_nsobject<NSString> domain_;
- // Used only for type kCocoaCookieTreeNodeTypeDatabaseStorage and
+ // Only set for type kCocoaCookieTreeNodeTypeDatabaseStorage and
// kCocoaCookieDetailsTypePromptDatabase nodes.
scoped_nsobject<NSString> databaseDescription_;
- // Used only for type kCocoaCookieDetailsTypePromptLocalStorage.
+ // Only set for type kCocoaCookieDetailsTypePromptLocalStorage.
scoped_nsobject<NSString> localStorageKey_;
scoped_nsobject<NSString> localStorageValue_;
- // Used only for type kCocoaCookieDetailsTypeTreeAppCache and
+ // Only set for type kCocoaCookieDetailsTypeTreeAppCache and
// kCocoaCookieDetailsTypePromptAppCache.
scoped_nsobject<NSString> manifestURL_;
}
@@ -128,11 +137,12 @@ enum CocoaCookieDetailsType {
// hidden value is |true|.
- (BOOL)shouldHideCookieDetailsView;
- (BOOL)shouldShowLocalStorageTreeDetailsView;
+- (BOOL)shouldShowLocalStoragePromptDetailsView;
- (BOOL)shouldShowDatabaseTreeDetailsView;
- (BOOL)shouldShowDatabasePromptDetailsView;
-- (BOOL)shouldShowLocalStoragePromptDetailsView;
- (BOOL)shouldShowAppCachePromptDetailsView;
- (BOOL)shouldShowAppCacheTreeDetailsView;
+- (BOOL)shouldShowIndexedDBTreeDetailsView;
- (NSString*)name;
- (NSString*)content;
@@ -185,6 +195,10 @@ enum CocoaCookieDetailsType {
// for an appcache, at that time only the manifest URL of the appcache is known.
- (id)initWithAppCacheManifestURL:(const std::string&)manifestURL;
+// Used for IndexedDB details in the cookie tree.
+- (id)initWithIndexedDBInfo:
+ (const BrowsingDataIndexedDBHelper::IndexedDBInfo*)indexedDB;
+
// A factory method to create a configured instance given a node from
// the cookie tree in |treeNode|.
+ (CocoaCookieDetails*)createFromCookieTreeNode:(CookieTreeNode*)treeNode;
diff --git a/chrome/browser/cocoa/cookie_details.mm b/chrome/browser/cocoa/cookie_details.mm
index d1d812b..4c483d1f 100644
--- a/chrome/browser/cocoa/cookie_details.mm
+++ b/chrome/browser/cocoa/cookie_details.mm
@@ -28,6 +28,10 @@
return type_ == kCocoaCookieDetailsTypeTreeLocalStorage;
}
+- (BOOL)shouldShowLocalStoragePromptDetailsView {
+ return type_ == kCocoaCookieDetailsTypePromptLocalStorage;
+}
+
- (BOOL)shouldShowDatabaseTreeDetailsView {
return type_ == kCocoaCookieDetailsTypeTreeDatabase;
}
@@ -40,14 +44,14 @@
return type_ == kCocoaCookieDetailsTypePromptDatabase;
}
-- (BOOL)shouldShowLocalStoragePromptDetailsView {
- return type_ == kCocoaCookieDetailsTypePromptLocalStorage;
-}
-
- (BOOL)shouldShowAppCachePromptDetailsView {
return type_ == kCocoaCookieDetailsTypePromptAppCache;
}
+- (BOOL)shouldShowIndexedDBTreeDetailsView {
+ return type_ == kCocoaCookieDetailsTypeTreeIndexedDB;
+}
+
- (NSString*)name {
return name_.get();
}
@@ -233,25 +237,46 @@
return self;
}
+- (id)initWithIndexedDBInfo:
+ (const BrowsingDataIndexedDBHelper::IndexedDBInfo*)indexedDBInfo {
+ if ((self = [super init])) {
+ type_ = kCocoaCookieDetailsTypeTreeIndexedDB;
+ canEditExpiration_ = NO;
+ domain_.reset([base::SysUTF8ToNSString(indexedDBInfo->origin) retain]);
+ fileSize_.reset([base::SysUTF16ToNSString(FormatBytes(indexedDBInfo->size,
+ GetByteDisplayUnits(indexedDBInfo->size), true)) retain]);
+ lastModified_.reset([base::SysWideToNSString(
+ base::TimeFormatFriendlyDateAndTime(
+ indexedDBInfo->last_modified)) retain]);
+ name_.reset([base::SysUTF8ToNSString(indexedDBInfo->database_name) retain]);
+ }
+ return self;
+}
+
+ (CocoaCookieDetails*)createFromCookieTreeNode:(CookieTreeNode*)treeNode {
CookieTreeNode::DetailedInfo info = treeNode->GetDetailedInfo();
CookieTreeNode::DetailedInfo::NodeType nodeType = info.node_type;
- if (nodeType == CookieTreeNode::DetailedInfo::TYPE_COOKIE) {
- NSString* origin = base::SysWideToNSString(info.origin.c_str());
- return [[[CocoaCookieDetails alloc] initWithCookie:info.cookie
- origin:origin
- canEditExpiration:NO] autorelease];
- } else if (nodeType == CookieTreeNode::DetailedInfo::TYPE_DATABASE) {
- return [[[CocoaCookieDetails alloc]
- initWithDatabase:info.database_info] autorelease];
- } else if (nodeType == CookieTreeNode::DetailedInfo::TYPE_LOCAL_STORAGE) {
- return [[[CocoaCookieDetails alloc]
- initWithLocalStorage:info.local_storage_info] autorelease];
- } else if (nodeType == CookieTreeNode::DetailedInfo::TYPE_APPCACHE) {
- return [[[CocoaCookieDetails alloc]
- initWithAppCacheInfo:info.appcache_info] autorelease];
- } else {
- return [[[CocoaCookieDetails alloc] initAsFolder] autorelease];
+ NSString* origin;
+ switch (nodeType) {
+ case CookieTreeNode::DetailedInfo::TYPE_COOKIE:
+ origin = base::SysWideToNSString(info.origin.c_str());
+ return [[[CocoaCookieDetails alloc] initWithCookie:info.cookie
+ origin:origin
+ canEditExpiration:NO] autorelease];
+ case CookieTreeNode::DetailedInfo::TYPE_DATABASE:
+ return [[[CocoaCookieDetails alloc]
+ initWithDatabase:info.database_info] autorelease];
+ case CookieTreeNode::DetailedInfo::TYPE_LOCAL_STORAGE:
+ return [[[CocoaCookieDetails alloc]
+ initWithLocalStorage:info.local_storage_info] autorelease];
+ case CookieTreeNode::DetailedInfo::TYPE_APPCACHE:
+ return [[[CocoaCookieDetails alloc]
+ initWithAppCacheInfo:info.appcache_info] autorelease];
+ case CookieTreeNode::DetailedInfo::TYPE_INDEXED_DB:
+ return [[[CocoaCookieDetails alloc]
+ initWithIndexedDBInfo:info.indexed_db_info] autorelease];
+ default:
+ return [[[CocoaCookieDetails alloc] initAsFolder] autorelease];
}
}
diff --git a/chrome/browser/cocoa/cookie_details_unittest.mm b/chrome/browser/cocoa/cookie_details_unittest.mm
index fa79c31..897d92a 100644
--- a/chrome/browser/cocoa/cookie_details_unittest.mm
+++ b/chrome/browser/cocoa/cookie_details_unittest.mm
@@ -46,6 +46,7 @@ TEST_F(CookiesDetailsTest, CreateForCookie) {
EXPECT_FALSE([details.get() shouldShowLocalStorageTreeDetailsView]);
EXPECT_FALSE([details.get() shouldShowDatabaseTreeDetailsView]);
EXPECT_FALSE([details.get() shouldShowAppCacheTreeDetailsView]);
+ EXPECT_FALSE([details.get() shouldShowIndexedDBTreeDetailsView]);
EXPECT_FALSE([details.get() shouldShowLocalStoragePromptDetailsView]);
EXPECT_FALSE([details.get() shouldShowDatabasePromptDetailsView]);
EXPECT_FALSE([details.get() shouldShowAppCachePromptDetailsView]);
@@ -72,6 +73,7 @@ TEST_F(CookiesDetailsTest, CreateForTreeDatabase) {
EXPECT_FALSE([details.get() shouldShowLocalStorageTreeDetailsView]);
EXPECT_TRUE([details.get() shouldShowDatabaseTreeDetailsView]);
EXPECT_FALSE([details.get() shouldShowAppCacheTreeDetailsView]);
+ EXPECT_FALSE([details.get() shouldShowIndexedDBTreeDetailsView]);
EXPECT_FALSE([details.get() shouldShowLocalStoragePromptDetailsView]);
EXPECT_FALSE([details.get() shouldShowDatabasePromptDetailsView]);
EXPECT_FALSE([details.get() shouldShowAppCachePromptDetailsView]);
@@ -84,7 +86,7 @@ TEST_F(CookiesDetailsTest, CreateForTreeLocalStorage) {
unsigned short port = 80;
std::string database_identifier("id");
std::string origin("chromium.org");
- FilePath file_path(FilePath::FromWStringHack(std::wstring(L"/")));
+ FilePath file_path(FILE_PATH_LITERAL("/"));
int64 size = 1234;
base::Time last_modified = base::Time::Now();
BrowsingDataLocalStorageHelper::LocalStorageInfo info(protocol, host, port,
@@ -100,6 +102,7 @@ TEST_F(CookiesDetailsTest, CreateForTreeLocalStorage) {
EXPECT_TRUE([details.get() shouldShowLocalStorageTreeDetailsView]);
EXPECT_FALSE([details.get() shouldShowDatabaseTreeDetailsView]);
EXPECT_FALSE([details.get() shouldShowAppCacheTreeDetailsView]);
+ EXPECT_FALSE([details.get() shouldShowIndexedDBTreeDetailsView]);
EXPECT_FALSE([details.get() shouldShowLocalStoragePromptDetailsView]);
EXPECT_FALSE([details.get() shouldShowDatabasePromptDetailsView]);
EXPECT_FALSE([details.get() shouldShowAppCachePromptDetailsView]);
@@ -128,6 +131,46 @@ TEST_F(CookiesDetailsTest, CreateForTreeAppCache) {
EXPECT_FALSE([details.get() shouldShowLocalStorageTreeDetailsView]);
EXPECT_FALSE([details.get() shouldShowDatabaseTreeDetailsView]);
EXPECT_TRUE([details.get() shouldShowAppCacheTreeDetailsView]);
+ EXPECT_FALSE([details.get() shouldShowIndexedDBTreeDetailsView]);
+ EXPECT_FALSE([details.get() shouldShowLocalStoragePromptDetailsView]);
+ EXPECT_FALSE([details.get() shouldShowDatabasePromptDetailsView]);
+ EXPECT_FALSE([details.get() shouldShowAppCachePromptDetailsView]);
+}
+
+TEST_F(CookiesDetailsTest, CreateForTreeIndexedDB) {
+ scoped_nsobject<CocoaCookieDetails> details;
+
+ std::string protocol("http");
+ std::string host("moose.org");
+ unsigned short port = 80;
+ std::string database_identifier("id");
+ std::string origin("moose.org");
+ std::string name("name");
+ FilePath file_path(FILE_PATH_LITERAL("/"));
+ int64 size = 1234;
+ base::Time last_modified = base::Time::Now();
+ BrowsingDataIndexedDBHelper::IndexedDBInfo info(protocol,
+ host,
+ port,
+ database_identifier,
+ origin,
+ name,
+ file_path,
+ size,
+ last_modified);
+
+ details.reset([[CocoaCookieDetails alloc] initWithIndexedDBInfo:&info]);
+
+ EXPECT_EQ([details.get() type], kCocoaCookieDetailsTypeTreeIndexedDB);
+ EXPECT_NSEQ(@"moose.org", [details.get() domain]);
+ EXPECT_NSEQ(@"1234 B", [details.get() fileSize]);
+ EXPECT_NSNE(@"", [details.get() lastModified]);
+
+ EXPECT_TRUE([details.get() shouldHideCookieDetailsView]);
+ EXPECT_FALSE([details.get() shouldShowLocalStorageTreeDetailsView]);
+ EXPECT_FALSE([details.get() shouldShowDatabaseTreeDetailsView]);
+ EXPECT_FALSE([details.get() shouldShowAppCacheTreeDetailsView]);
+ EXPECT_TRUE([details.get() shouldShowIndexedDBTreeDetailsView]);
EXPECT_FALSE([details.get() shouldShowLocalStoragePromptDetailsView]);
EXPECT_FALSE([details.get() shouldShowDatabasePromptDetailsView]);
EXPECT_FALSE([details.get() shouldShowAppCachePromptDetailsView]);
@@ -153,6 +196,7 @@ TEST_F(CookiesDetailsTest, CreateForPromptDatabase) {
EXPECT_FALSE([details.get() shouldShowLocalStorageTreeDetailsView]);
EXPECT_FALSE([details.get() shouldShowDatabaseTreeDetailsView]);
EXPECT_FALSE([details.get() shouldShowAppCacheTreeDetailsView]);
+ EXPECT_FALSE([details.get() shouldShowIndexedDBTreeDetailsView]);
EXPECT_FALSE([details.get() shouldShowLocalStoragePromptDetailsView]);
EXPECT_TRUE([details.get() shouldShowDatabasePromptDetailsView]);
EXPECT_FALSE([details.get() shouldShowAppCachePromptDetailsView]);
@@ -176,6 +220,7 @@ TEST_F(CookiesDetailsTest, CreateForPromptLocalStorage) {
EXPECT_FALSE([details.get() shouldShowLocalStorageTreeDetailsView]);
EXPECT_FALSE([details.get() shouldShowDatabaseTreeDetailsView]);
EXPECT_FALSE([details.get() shouldShowAppCacheTreeDetailsView]);
+ EXPECT_FALSE([details.get() shouldShowIndexedDBTreeDetailsView]);
EXPECT_TRUE([details.get() shouldShowLocalStoragePromptDetailsView]);
EXPECT_FALSE([details.get() shouldShowDatabasePromptDetailsView]);
EXPECT_FALSE([details.get() shouldShowAppCachePromptDetailsView]);
@@ -195,6 +240,7 @@ TEST_F(CookiesDetailsTest, CreateForPromptAppCache) {
EXPECT_FALSE([details.get() shouldShowLocalStorageTreeDetailsView]);
EXPECT_FALSE([details.get() shouldShowDatabaseTreeDetailsView]);
EXPECT_FALSE([details.get() shouldShowAppCacheTreeDetailsView]);
+ EXPECT_FALSE([details.get() shouldShowIndexedDBTreeDetailsView]);
EXPECT_FALSE([details.get() shouldShowLocalStoragePromptDetailsView]);
EXPECT_FALSE([details.get() shouldShowDatabasePromptDetailsView]);
EXPECT_TRUE([details.get() shouldShowAppCachePromptDetailsView]);
diff --git a/chrome/browser/cocoa/cookies_window_controller.h b/chrome/browser/cocoa/cookies_window_controller.h
index 0f6217f..0f2098b 100644
--- a/chrome/browser/cocoa/cookies_window_controller.h
+++ b/chrome/browser/cocoa/cookies_window_controller.h
@@ -103,6 +103,7 @@ class CookiesTreeModelObserverBridge : public CookiesTreeModel::Observer {
BrowsingDataDatabaseHelper* databaseHelper_; // weak
BrowsingDataLocalStorageHelper* storageHelper_; // weak
BrowsingDataAppCacheHelper* appcacheHelper_; // weak
+ BrowsingDataIndexedDBHelper* indexedDBHelper_; // weak
}
@property (assign, nonatomic) BOOL removeButtonEnabled;
@property (readonly, nonatomic) NSTreeController* treeController;
@@ -111,7 +112,8 @@ class CookiesTreeModelObserverBridge : public CookiesTreeModel::Observer {
- (id)initWithProfile:(Profile*)profile
databaseHelper:(BrowsingDataDatabaseHelper*)databaseHelper
storageHelper:(BrowsingDataLocalStorageHelper*)storageHelper
- appcacheHelper:(BrowsingDataAppCacheHelper*)appcacheHelper;
+ appcacheHelper:(BrowsingDataAppCacheHelper*)appcacheHelper
+ indexedDBHelper:(BrowsingDataIndexedDBHelper*)indexedDBHelper;
// Shows the cookies window as a modal sheet attached to |window|.
- (void)attachSheetTo:(NSWindow*)window;
diff --git a/chrome/browser/cocoa/cookies_window_controller.mm b/chrome/browser/cocoa/cookies_window_controller.mm
index 0984294..453c216 100644
--- a/chrome/browser/cocoa/cookies_window_controller.mm
+++ b/chrome/browser/cocoa/cookies_window_controller.mm
@@ -165,7 +165,8 @@ bool CookiesTreeModelObserverBridge::HasCocoaModel() {
- (id)initWithProfile:(Profile*)profile
databaseHelper:(BrowsingDataDatabaseHelper*)databaseHelper
storageHelper:(BrowsingDataLocalStorageHelper*)storageHelper
- appcacheHelper:(BrowsingDataAppCacheHelper*)appcacheHelper {
+ appcacheHelper:(BrowsingDataAppCacheHelper*)appcacheHelper
+ indexedDBHelper:(BrowsingDataIndexedDBHelper*)indexedDBHelper {
DCHECK(profile);
NSString* nibpath = [mac_util::MainAppBundle() pathForResource:@"Cookies"
ofType:@"nib"];
@@ -174,6 +175,7 @@ bool CookiesTreeModelObserverBridge::HasCocoaModel() {
databaseHelper_ = databaseHelper;
storageHelper_ = storageHelper;
appcacheHelper_ = appcacheHelper;
+ indexedDBHelper_ = indexedDBHelper;
[self loadTreeModelFromProfile];
@@ -414,7 +416,11 @@ bool CookiesTreeModelObserverBridge::HasCocoaModel() {
- (void)loadTreeModelFromProfile {
treeModel_.reset(new CookiesTreeModel(
profile_->GetRequestContext()->GetCookieStore()->GetCookieMonster(),
- databaseHelper_, storageHelper_, NULL, appcacheHelper_));
+ databaseHelper_,
+ storageHelper_,
+ NULL,
+ appcacheHelper_,
+ indexedDBHelper_));
modelObserver_.reset(new CookiesTreeModelObserverBridge(self));
treeModel_->AddObserver(modelObserver_.get());
diff --git a/chrome/browser/cookies_tree_model.cc b/chrome/browser/cookies_tree_model.cc
index afb395d..2fbd557 100644
--- a/chrome/browser/cookies_tree_model.cc
+++ b/chrome/browser/cookies_tree_model.cc
@@ -182,6 +182,22 @@ CookieTreeSessionStorageNode::CookieTreeSessionStorageNode(
}
///////////////////////////////////////////////////////////////////////////////
+// CookieTreeIndexedDBNode, public:
+
+CookieTreeIndexedDBNode::CookieTreeIndexedDBNode(
+ BrowsingDataIndexedDBHelper::IndexedDBInfo* indexed_db_info)
+ : CookieTreeNode(indexed_db_info->database_name.empty() ?
+ l10n_util::GetStringUTF16(IDS_COOKIES_WEB_DATABASE_UNNAMED_NAME) :
+ UTF8ToUTF16(indexed_db_info->database_name)),
+ indexed_db_info_(indexed_db_info) {
+}
+
+void CookieTreeIndexedDBNode::DeleteStoredObjects() {
+ GetModel()->indexed_db_helper_->DeleteIndexedDBFile(
+ indexed_db_info_->file_path);
+}
+
+///////////////////////////////////////////////////////////////////////////////
// CookieTreeRootNode, public:
CookieTreeOriginNode* CookieTreeRootNode::GetOrCreateOriginNode(
@@ -223,6 +239,7 @@ CookieTreeOriginNode::CookieTreeOriginNode(const GURL& url)
local_storages_child_(NULL),
session_storages_child_(NULL),
appcaches_child_(NULL),
+ indexed_dbs_child_(NULL),
url_(url) {}
@@ -268,6 +285,14 @@ CookieTreeAppCachesNode* CookieTreeOriginNode::GetOrCreateAppCachesNode() {
return appcaches_child_;
}
+CookieTreeIndexedDBsNode* CookieTreeOriginNode::GetOrCreateIndexedDBsNode() {
+ if (indexed_dbs_child_)
+ return indexed_dbs_child_;
+ indexed_dbs_child_ = new CookieTreeIndexedDBsNode;
+ AddChildSortedByTitle(indexed_dbs_child_);
+ return indexed_dbs_child_;
+}
+
void CookieTreeOriginNode::CreateContentException(
HostContentSettingsMap* content_settings, ContentSetting setting) const {
if (CanCreateContentException()) {
@@ -319,6 +344,13 @@ CookieTreeSessionStoragesNode::CookieTreeSessionStoragesNode()
}
///////////////////////////////////////////////////////////////////////////////
+// CookieTreeIndexedDBsNode, public:
+
+CookieTreeIndexedDBsNode::CookieTreeIndexedDBsNode()
+ : CookieTreeNode(l10n_util::GetStringUTF16(IDS_COOKIES_INDEXED_DB)) {
+}
+
+///////////////////////////////////////////////////////////////////////////////
// CookieTreeNode, protected
bool CookieTreeNode::NodeTitleComparator::operator() (
@@ -347,7 +379,8 @@ CookiesTreeModel::CookiesTreeModel(
BrowsingDataDatabaseHelper* database_helper,
BrowsingDataLocalStorageHelper* local_storage_helper,
BrowsingDataLocalStorageHelper* session_storage_helper,
- BrowsingDataAppCacheHelper* appcache_helper)
+ BrowsingDataAppCacheHelper* appcache_helper,
+ BrowsingDataIndexedDBHelper* indexed_db_helper)
: ALLOW_THIS_IN_INITIALIZER_LIST(TreeNodeModel<CookieTreeNode>(
new CookieTreeRootNode(this))),
cookie_monster_(cookie_monster),
@@ -355,6 +388,7 @@ CookiesTreeModel::CookiesTreeModel(
database_helper_(database_helper),
local_storage_helper_(local_storage_helper),
session_storage_helper_(session_storage_helper),
+ indexed_db_helper_(indexed_db_helper),
batch_update_(0) {
LoadCookies();
DCHECK(database_helper_);
@@ -374,6 +408,11 @@ CookiesTreeModel::CookiesTreeModel(
appcache_helper_->StartFetching(NewCallback(
this, &CookiesTreeModel::OnAppCacheModelInfoLoaded));
}
+
+ if (indexed_db_helper_) {
+ indexed_db_helper_->StartFetching(NewCallback(
+ this, &CookiesTreeModel::OnIndexedDBModelInfoLoaded));
+ }
}
CookiesTreeModel::~CookiesTreeModel() {
@@ -383,6 +422,8 @@ CookiesTreeModel::~CookiesTreeModel() {
session_storage_helper_->CancelNotification();
if (appcache_helper_)
appcache_helper_->CancelNotification();
+ if (indexed_db_helper_)
+ indexed_db_helper_->CancelNotification();
}
///////////////////////////////////////////////////////////////////////////////
@@ -424,6 +465,9 @@ int CookiesTreeModel::GetIconIndex(TreeModelNode* node) {
case CookieTreeNode::DetailedInfo::TYPE_APPCACHE:
return DATABASE; // ditto
break;
+ case CookieTreeNode::DetailedInfo::TYPE_INDEXED_DB:
+ return DATABASE; // ditto
+ break;
default:
return -1;
}
@@ -493,6 +537,7 @@ void CookiesTreeModel::UpdateSearchResults(const std::wstring& filter) {
PopulateLocalStorageInfoWithFilter(filter);
PopulateSessionStorageInfoWithFilter(filter);
PopulateAppCacheInfoWithFilter(filter);
+ PopulateIndexedDBInfoWithFilter(filter);
NotifyObserverTreeNodeChanged(root);
NotifyObserverEndBatch();
}
@@ -645,6 +690,39 @@ void CookiesTreeModel::PopulateSessionStorageInfoWithFilter(
NotifyObserverEndBatch();
}
+void CookiesTreeModel::OnIndexedDBModelInfoLoaded(
+ const IndexedDBInfoList& indexed_db_info) {
+ indexed_db_info_list_ = indexed_db_info;
+ PopulateIndexedDBInfoWithFilter(std::wstring());
+}
+
+void CookiesTreeModel::PopulateIndexedDBInfoWithFilter(
+ const std::wstring& filter) {
+ if (indexed_db_info_list_.empty())
+ return;
+ CookieTreeRootNode* root = static_cast<CookieTreeRootNode*>(GetRoot());
+ NotifyObserverBeginBatch();
+ for (IndexedDBInfoList::iterator indexed_db_info =
+ indexed_db_info_list_.begin();
+ indexed_db_info != indexed_db_info_list_.end();
+ ++indexed_db_info) {
+ GURL origin(indexed_db_info->origin);
+
+ if (!filter.size() ||
+ (CookieTreeOriginNode::TitleForUrl(origin).find(filter) !=
+ std::wstring::npos)) {
+ CookieTreeOriginNode* origin_node =
+ root->GetOrCreateOriginNode(origin);
+ CookieTreeIndexedDBsNode* indexed_dbs_node =
+ origin_node->GetOrCreateIndexedDBsNode();
+ indexed_dbs_node->AddIndexedDBNode(
+ new CookieTreeIndexedDBNode(&(*indexed_db_info)));
+ }
+ }
+ NotifyObserverTreeNodeChanged(root);
+ NotifyObserverEndBatch();
+}
+
void CookiesTreeModel::NotifyObserverBeginBatch() {
// Only notify the model once if we're batching in a nested manner.
if (batch_update_++ == 0) {
diff --git a/chrome/browser/cookies_tree_model.h b/chrome/browser/cookies_tree_model.h
index dc040dd..509084a 100644
--- a/chrome/browser/cookies_tree_model.h
+++ b/chrome/browser/cookies_tree_model.h
@@ -19,6 +19,7 @@
#include "base/utf_string_conversions.h"
#include "chrome/browser/browsing_data_appcache_helper.h"
#include "chrome/browser/browsing_data_database_helper.h"
+#include "chrome/browser/browsing_data_indexed_db_helper.h"
#include "chrome/browser/browsing_data_local_storage_helper.h"
#include "net/base/cookie_monster.h"
@@ -33,6 +34,8 @@ class CookieTreeLocalStorageNode;
class CookieTreeLocalStoragesNode;
class CookieTreeSessionStorageNode;
class CookieTreeSessionStoragesNode;
+class CookieTreeIndexedDBNode;
+class CookieTreeIndexedDBsNode;
class CookieTreeOriginNode;
// CookieTreeNode -------------------------------------------------------------
@@ -59,6 +62,8 @@ class CookieTreeNode : public TreeNode<CookieTreeNode> {
TYPE_SESSION_STORAGE, // This is used for CookieTreeSessionStorageNode.
TYPE_APPCACHES, // This is used for CookieTreeAppCachesNode.
TYPE_APPCACHE, // This is used for CookieTreeAppCacheNode.
+ TYPE_INDEXED_DBS, // This is used for CookieTreeIndexedDBsNode.
+ TYPE_INDEXED_DB, // This is used for CookieTreeIndexedDBNode.
};
// TODO(viettrungluu): Figure out whether we want to store |origin| as a
@@ -71,18 +76,21 @@ class CookieTreeNode : public TreeNode<CookieTreeNode> {
local_storage_info,
const BrowsingDataLocalStorageHelper::LocalStorageInfo*
session_storage_info,
- const appcache::AppCacheInfo* appcache_info)
+ const appcache::AppCacheInfo* appcache_info,
+ const BrowsingDataIndexedDBHelper::IndexedDBInfo* indexed_db_info)
: origin(UTF16ToWideHack(origin)),
node_type(node_type),
cookie(cookie),
database_info(database_info),
local_storage_info(local_storage_info),
session_storage_info(session_storage_info),
- appcache_info(appcache_info) {
+ appcache_info(appcache_info),
+ indexed_db_info(indexed_db_info) {
DCHECK((node_type != TYPE_DATABASE) || database_info);
DCHECK((node_type != TYPE_LOCAL_STORAGE) || local_storage_info);
DCHECK((node_type != TYPE_SESSION_STORAGE) || session_storage_info);
DCHECK((node_type != TYPE_APPCACHE) || appcache_info);
+ DCHECK((node_type != TYPE_INDEXED_DB) || indexed_db_info);
}
#if !defined(WCHAR_T_IS_UTF16)
DetailedInfo(const std::wstring& origin, NodeType node_type,
@@ -92,18 +100,21 @@ class CookieTreeNode : public TreeNode<CookieTreeNode> {
local_storage_info,
const BrowsingDataLocalStorageHelper::LocalStorageInfo*
session_storage_info,
- const appcache::AppCacheInfo* appcache_info)
+ const appcache::AppCacheInfo* appcache_info,
+ const BrowsingDataIndexedDBHelper::IndexedDBInfo* indexed_db_info)
: origin(origin),
node_type(node_type),
cookie(cookie),
database_info(database_info),
local_storage_info(local_storage_info),
session_storage_info(session_storage_info),
- appcache_info(appcache_info) {
+ appcache_info(appcache_info),
+ indexed_db_info(indexed_db_info) {
DCHECK((node_type != TYPE_DATABASE) || database_info);
DCHECK((node_type != TYPE_LOCAL_STORAGE) || local_storage_info);
DCHECK((node_type != TYPE_SESSION_STORAGE) || session_storage_info);
DCHECK((node_type != TYPE_APPCACHE) || appcache_info);
+ DCHECK((node_type != TYPE_INDEXED_DB) || indexed_db_info);
}
#endif
@@ -115,6 +126,7 @@ class CookieTreeNode : public TreeNode<CookieTreeNode> {
const BrowsingDataLocalStorageHelper::LocalStorageInfo*
session_storage_info;
const appcache::AppCacheInfo* appcache_info;
+ const BrowsingDataIndexedDBHelper::IndexedDBInfo* indexed_db_info;
};
CookieTreeNode() {}
@@ -160,7 +172,7 @@ class CookieTreeRootNode : public CookieTreeNode {
virtual DetailedInfo GetDetailedInfo() const {
return DetailedInfo(string16(),
DetailedInfo::TYPE_ROOT,
- NULL, NULL, NULL, NULL, NULL);
+ NULL, NULL, NULL, NULL, NULL, NULL);
}
private:
@@ -182,7 +194,7 @@ class CookieTreeOriginNode : public CookieTreeNode {
virtual DetailedInfo GetDetailedInfo() const {
return DetailedInfo(GetTitle(),
DetailedInfo::TYPE_ORIGIN,
- NULL, NULL, NULL, NULL, NULL);
+ NULL, NULL, NULL, NULL, NULL, NULL);
}
// CookieTreeOriginNode methods:
@@ -191,6 +203,7 @@ class CookieTreeOriginNode : public CookieTreeNode {
CookieTreeLocalStoragesNode* GetOrCreateLocalStoragesNode();
CookieTreeSessionStoragesNode* GetOrCreateSessionStoragesNode();
CookieTreeAppCachesNode* GetOrCreateAppCachesNode();
+ CookieTreeIndexedDBsNode* GetOrCreateIndexedDBsNode();
// Creates an content exception for this origin of type
// CONTENT_SETTINGS_TYPE_COOKIES.
@@ -211,6 +224,7 @@ class CookieTreeOriginNode : public CookieTreeNode {
CookieTreeLocalStoragesNode* local_storages_child_;
CookieTreeSessionStoragesNode* session_storages_child_;
CookieTreeAppCachesNode* appcaches_child_;
+ CookieTreeIndexedDBsNode* indexed_dbs_child_;
// The URL for which this node was initially created.
GURL url_;
@@ -233,7 +247,7 @@ class CookieTreeCookieNode : public CookieTreeNode {
virtual DetailedInfo GetDetailedInfo() const {
return DetailedInfo(GetParent()->GetParent()->GetTitle(),
DetailedInfo::TYPE_COOKIE,
- cookie_, NULL, NULL, NULL, NULL);
+ cookie_, NULL, NULL, NULL, NULL, NULL);
}
private:
@@ -252,7 +266,7 @@ class CookieTreeCookiesNode : public CookieTreeNode {
virtual DetailedInfo GetDetailedInfo() const {
return DetailedInfo(GetParent()->GetTitle(),
DetailedInfo::TYPE_COOKIES,
- NULL, NULL, NULL, NULL, NULL);
+ NULL, NULL, NULL, NULL, NULL, NULL);
}
void AddCookieNode(CookieTreeCookieNode* child) {
@@ -278,7 +292,7 @@ class CookieTreeAppCacheNode : public CookieTreeNode {
virtual DetailedInfo GetDetailedInfo() const {
return DetailedInfo(GetParent()->GetParent()->GetTitle(),
DetailedInfo::TYPE_APPCACHE,
- NULL, NULL, NULL, NULL, appcache_info_);
+ NULL, NULL, NULL, NULL, appcache_info_, NULL);
}
private:
@@ -294,7 +308,7 @@ class CookieTreeAppCachesNode : public CookieTreeNode {
virtual DetailedInfo GetDetailedInfo() const {
return DetailedInfo(GetParent()->GetTitle(),
DetailedInfo::TYPE_APPCACHES,
- NULL, NULL, NULL, NULL, NULL);
+ NULL, NULL, NULL, NULL, NULL, NULL);
}
void AddAppCacheNode(CookieTreeAppCacheNode* child) {
@@ -320,7 +334,7 @@ class CookieTreeDatabaseNode : public CookieTreeNode {
virtual DetailedInfo GetDetailedInfo() const {
return DetailedInfo(GetParent()->GetParent()->GetTitle(),
DetailedInfo::TYPE_DATABASE,
- NULL, database_info_, NULL, NULL, NULL);
+ NULL, database_info_, NULL, NULL, NULL, NULL);
}
private:
@@ -339,7 +353,7 @@ class CookieTreeDatabasesNode : public CookieTreeNode {
virtual DetailedInfo GetDetailedInfo() const {
return DetailedInfo(GetParent()->GetTitle(),
DetailedInfo::TYPE_DATABASES,
- NULL, NULL, NULL, NULL, NULL);
+ NULL, NULL, NULL, NULL, NULL, NULL);
}
void AddDatabaseNode(CookieTreeDatabaseNode* child) {
@@ -366,7 +380,7 @@ class CookieTreeLocalStorageNode : public CookieTreeNode {
virtual DetailedInfo GetDetailedInfo() const {
return DetailedInfo(GetParent()->GetParent()->GetTitle(),
DetailedInfo::TYPE_LOCAL_STORAGE,
- NULL, NULL, local_storage_info_, NULL, NULL);
+ NULL, NULL, local_storage_info_, NULL, NULL, NULL);
}
private:
@@ -385,7 +399,7 @@ class CookieTreeLocalStoragesNode : public CookieTreeNode {
virtual DetailedInfo GetDetailedInfo() const {
return DetailedInfo(GetParent()->GetTitle(),
DetailedInfo::TYPE_LOCAL_STORAGES,
- NULL, NULL, NULL, NULL, NULL);
+ NULL, NULL, NULL, NULL, NULL, NULL);
}
void AddLocalStorageNode(CookieTreeLocalStorageNode* child) {
@@ -412,7 +426,7 @@ class CookieTreeSessionStorageNode : public CookieTreeNode {
virtual DetailedInfo GetDetailedInfo() const {
return DetailedInfo(GetParent()->GetParent()->GetTitle(),
DetailedInfo::TYPE_SESSION_STORAGE,
- NULL, NULL, NULL, session_storage_info_, NULL);
+ NULL, NULL, NULL, session_storage_info_, NULL, NULL);
}
private:
@@ -431,7 +445,7 @@ class CookieTreeSessionStoragesNode : public CookieTreeNode {
virtual DetailedInfo GetDetailedInfo() const {
return DetailedInfo(GetParent()->GetTitle(),
DetailedInfo::TYPE_SESSION_STORAGES,
- NULL, NULL, NULL, NULL, NULL);
+ NULL, NULL, NULL, NULL, NULL, NULL);
}
void AddSessionStorageNode(CookieTreeSessionStorageNode* child) {
@@ -443,6 +457,51 @@ class CookieTreeSessionStoragesNode : public CookieTreeNode {
DISALLOW_COPY_AND_ASSIGN(CookieTreeSessionStoragesNode);
};
+// CookieTreeIndexedDBNode -----------------------------------------------
+class CookieTreeIndexedDBNode : public CookieTreeNode {
+ public:
+ // Does not take ownership of session_storage_info, and session_storage_info
+ // should remain valid at least as long as the CookieTreeSessionStorageNode
+ // is valid.
+ explicit CookieTreeIndexedDBNode(
+ BrowsingDataIndexedDBHelper::IndexedDBInfo* indexed_db_info);
+ virtual ~CookieTreeIndexedDBNode() {}
+
+ // CookieTreeNode methods:
+ virtual void DeleteStoredObjects();
+ virtual DetailedInfo GetDetailedInfo() const {
+ return DetailedInfo(GetParent()->GetParent()->GetTitle(),
+ DetailedInfo::TYPE_INDEXED_DB,
+ NULL, NULL, NULL, NULL, NULL, indexed_db_info_);
+ }
+
+ private:
+ // indexed_db_info_ is not owned by the node, and is expected to remain
+ // valid as long as the CookieTreeIndexedDBNode is valid.
+ BrowsingDataIndexedDBHelper::IndexedDBInfo* indexed_db_info_;
+
+ DISALLOW_COPY_AND_ASSIGN(CookieTreeIndexedDBNode);
+};
+
+class CookieTreeIndexedDBsNode : public CookieTreeNode {
+ public:
+ CookieTreeIndexedDBsNode();
+ virtual ~CookieTreeIndexedDBsNode() {}
+
+ virtual DetailedInfo GetDetailedInfo() const {
+ return DetailedInfo(GetParent()->GetTitle(),
+ DetailedInfo::TYPE_INDEXED_DBS,
+ NULL, NULL, NULL, NULL, NULL, NULL);
+ }
+
+ void AddIndexedDBNode(CookieTreeIndexedDBNode* child) {
+ AddChildSortedByTitle(child);
+ }
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(CookieTreeIndexedDBsNode);
+};
+
// CookiesTreeModel -----------------------------------------------------------
class CookiesTreeModel : public TreeNodeModel<CookieTreeNode> {
@@ -463,7 +522,8 @@ class CookiesTreeModel : public TreeNodeModel<CookieTreeNode> {
BrowsingDataDatabaseHelper* database_helper,
BrowsingDataLocalStorageHelper* local_storage_helper,
BrowsingDataLocalStorageHelper* session_storage_helper,
- BrowsingDataAppCacheHelper* appcache_helper);
+ BrowsingDataAppCacheHelper* appcache_helper,
+ BrowsingDataIndexedDBHelper* indexed_db_helper);
virtual ~CookiesTreeModel();
// TreeModel methods:
@@ -506,6 +566,8 @@ class CookiesTreeModel : public TreeNodeModel<CookieTreeNode> {
LocalStorageInfoList;
typedef std::vector<BrowsingDataLocalStorageHelper::LocalStorageInfo>
SessionStorageInfoList;
+ typedef std::vector<BrowsingDataIndexedDBHelper::IndexedDBInfo>
+ IndexedDBInfoList;
void LoadCookies();
void LoadCookiesWithFilter(const std::wstring& filter);
@@ -516,11 +578,14 @@ class CookiesTreeModel : public TreeNodeModel<CookieTreeNode> {
const LocalStorageInfoList& local_storage_info);
void OnSessionStorageModelInfoLoaded(
const LocalStorageInfoList& local_storage_info);
+ void OnIndexedDBModelInfoLoaded(
+ const IndexedDBInfoList& indexed_db_info);
void PopulateAppCacheInfoWithFilter(const std::wstring& filter);
void PopulateDatabaseInfoWithFilter(const std::wstring& filter);
void PopulateLocalStorageInfoWithFilter(const std::wstring& filter);
void PopulateSessionStorageInfoWithFilter(const std::wstring& filter);
+ void PopulateIndexedDBInfoWithFilter(const std::wstring& filter);
void NotifyObserverBeginBatch();
void NotifyObserverEndBatch();
@@ -535,8 +600,10 @@ class CookiesTreeModel : public TreeNodeModel<CookieTreeNode> {
scoped_refptr<BrowsingDataLocalStorageHelper> local_storage_helper_;
scoped_refptr<BrowsingDataLocalStorageHelper> session_storage_helper_;
+ scoped_refptr<BrowsingDataIndexedDBHelper> indexed_db_helper_;
LocalStorageInfoList local_storage_info_list_;
LocalStorageInfoList session_storage_info_list_;
+ IndexedDBInfoList indexed_db_info_list_;
// The CookiesTreeModel maintains a separate list of observers that are
// specifically of the type CookiesTreeModel::Observer.
@@ -551,6 +618,7 @@ class CookiesTreeModel : public TreeNodeModel<CookieTreeNode> {
friend class CookieTreeCookieNode;
friend class CookieTreeDatabaseNode;
friend class CookieTreeLocalStorageNode;
+ friend class CookieTreeIndexedDBNode;
DISALLOW_COPY_AND_ASSIGN(CookiesTreeModel);
};
diff --git a/chrome/browser/cookies_tree_model_unittest.cc b/chrome/browser/cookies_tree_model_unittest.cc
index 7a79917..75844d0 100644
--- a/chrome/browser/cookies_tree_model_unittest.cc
+++ b/chrome/browser/cookies_tree_model_unittest.cc
@@ -9,6 +9,7 @@
#include "chrome/browser/host_content_settings_map.h"
#include "chrome/browser/mock_browsing_data_appcache_helper.h"
#include "chrome/browser/mock_browsing_data_database_helper.h"
+#include "chrome/browser/mock_browsing_data_indexed_db_helper.h"
#include "chrome/browser/mock_browsing_data_local_storage_helper.h"
#include "chrome/common/net/url_request_context_getter.h"
#include "chrome/common/notification_details.h"
@@ -64,6 +65,8 @@ class CookiesTreeModelTest : public testing::Test {
new MockBrowsingDataLocalStorageHelper(profile_.get());
mock_browsing_data_appcache_helper_ =
new MockBrowsingDataAppCacheHelper(profile_.get());
+ mock_browsing_data_indexed_db_helper_ =
+ new MockBrowsingDataIndexedDBHelper(profile_.get());
}
CookiesTreeModel* CreateCookiesTreeModelWithInitialSample() {
@@ -75,29 +78,36 @@ class CookiesTreeModelTest : public testing::Test {
monster, mock_browsing_data_database_helper_,
mock_browsing_data_local_storage_helper_,
mock_browsing_data_session_storage_helper_,
- mock_browsing_data_appcache_helper_);
+ mock_browsing_data_appcache_helper_,
+ mock_browsing_data_indexed_db_helper_);
mock_browsing_data_database_helper_->AddDatabaseSamples();
mock_browsing_data_database_helper_->Notify();
mock_browsing_data_local_storage_helper_->AddLocalStorageSamples();
mock_browsing_data_local_storage_helper_->Notify();
mock_browsing_data_session_storage_helper_->AddLocalStorageSamples();
mock_browsing_data_session_storage_helper_->Notify();
+ mock_browsing_data_indexed_db_helper_->AddIndexedDBSamples();
+ mock_browsing_data_indexed_db_helper_->Notify();
{
SCOPED_TRACE("Initial State 3 cookies, 2 databases, 2 local storages, "
- "2 session storages");
- // 26 because there's the root, then foo1 -> cookies -> a,
+ "2 session storages, 2 indexed DBs");
+ // 32 because there's the root, then foo1 -> cookies -> a,
// foo2 -> cookies -> b, foo3 -> cookies -> c,
// dbhost1 -> database -> db1, dbhost2 -> database -> db2,
// host1 -> localstorage -> http://host1:1/,
// host2 -> localstorage -> http://host2:2/.
// host1 -> sessionstorage -> http://host1:1/,
- // host2 -> sessionstorage -> http://host2:2/.
- EXPECT_EQ(26, cookies_model->GetRoot()->GetTotalNodeCount());
+ // host2 -> sessionstorage -> http://host2:2/,
+ // idbhost1 -> indexeddb -> http://idbhost1:1/,
+ // idbhost2 -> indexeddb -> http://idbhost2:2/.
+ EXPECT_EQ(32, cookies_model->GetRoot()->GetTotalNodeCount());
EXPECT_EQ("db1,db2", GetDisplayedDatabases(cookies_model));
EXPECT_EQ("http://host1:1/,http://host2:2/",
GetDisplayedLocalStorages(cookies_model));
EXPECT_EQ("http://host1:1/,http://host2:2/",
GetDisplayedSessionStorages(cookies_model));
+ EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/",
+ GetDisplayedIndexedDBs(cookies_model));
}
return cookies_model;
}
@@ -139,6 +149,8 @@ class CookiesTreeModelTest : public testing::Test {
case CookieTreeNode::DetailedInfo::TYPE_APPCACHE:
return node->GetDetailedInfo().appcache_info->manifest_url.spec() +
",";
+ case CookieTreeNode::DetailedInfo::TYPE_INDEXED_DB:
+ return node->GetDetailedInfo().indexed_db_info->origin + ",";
default:
return "";
}
@@ -167,6 +179,11 @@ class CookiesTreeModelTest : public testing::Test {
node, CookieTreeNode::DetailedInfo::TYPE_SESSION_STORAGE);
}
+ std::string GetIndexedDBsOfChildren(const CookieTreeNode* node) {
+ return GetNodesOfChildren(
+ node, CookieTreeNode::DetailedInfo::TYPE_INDEXED_DB);
+ }
+
// Get the nodes names displayed in the view (if we had one) in the order
// they are displayed, as a comma seperated string.
// Ex: EXPECT_STREQ("X,Y", GetDisplayedNodes(cookies_view, type).c_str());
@@ -205,6 +222,11 @@ class CookiesTreeModelTest : public testing::Test {
CookieTreeNode::DetailedInfo::TYPE_APPCACHE);
}
+ std::string GetDisplayedIndexedDBs(CookiesTreeModel* cookies_model) {
+ return GetDisplayedNodes(cookies_model,
+ CookieTreeNode::DetailedInfo::TYPE_INDEXED_DB);
+ }
+
// do not call on the root
void DeleteStoredObjects(CookieTreeNode* node) {
node->DeleteStoredObjects();
@@ -228,6 +250,8 @@ class CookiesTreeModelTest : public testing::Test {
mock_browsing_data_session_storage_helper_;
scoped_refptr<MockBrowsingDataAppCacheHelper>
mock_browsing_data_appcache_helper_;
+ scoped_refptr<MockBrowsingDataIndexedDBHelper>
+ mock_browsing_data_indexed_db_helper_;
};
TEST_F(CookiesTreeModelTest, RemoveAll) {
@@ -246,11 +270,14 @@ TEST_F(CookiesTreeModelTest, RemoveAll) {
GetDisplayedLocalStorages(cookies_model.get()));
EXPECT_EQ("http://host1:1/,http://host2:2/",
GetDisplayedSessionStorages(cookies_model.get()));
+ EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/",
+ GetDisplayedIndexedDBs(cookies_model.get()));
}
mock_browsing_data_database_helper_->Reset();
mock_browsing_data_local_storage_helper_->Reset();
mock_browsing_data_session_storage_helper_->Reset();
+ mock_browsing_data_indexed_db_helper_->Reset();
cookies_model->DeleteAllStoredObjects();
@@ -264,6 +291,7 @@ TEST_F(CookiesTreeModelTest, RemoveAll) {
EXPECT_TRUE(mock_browsing_data_database_helper_->AllDeleted());
EXPECT_TRUE(mock_browsing_data_local_storage_helper_->AllDeleted());
EXPECT_FALSE(mock_browsing_data_session_storage_helper_->AllDeleted());
+ EXPECT_TRUE(mock_browsing_data_indexed_db_helper_->AllDeleted());
}
}
@@ -282,7 +310,9 @@ TEST_F(CookiesTreeModelTest, Remove) {
GetDisplayedLocalStorages(cookies_model.get()));
EXPECT_EQ("http://host1:1/,http://host2:2/",
GetDisplayedSessionStorages(cookies_model.get()));
- EXPECT_EQ(23, cookies_model->GetRoot()->GetTotalNodeCount());
+ EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/",
+ GetDisplayedIndexedDBs(cookies_model.get()));
+ EXPECT_EQ(29, cookies_model->GetRoot()->GetTotalNodeCount());
}
DeleteStoredObjects(cookies_model->GetRoot()->GetChild(2));
@@ -295,7 +325,9 @@ TEST_F(CookiesTreeModelTest, Remove) {
GetDisplayedLocalStorages(cookies_model.get()));
EXPECT_EQ("http://host1:1/,http://host2:2/",
GetDisplayedSessionStorages(cookies_model.get()));
- EXPECT_EQ(20, cookies_model->GetRoot()->GetTotalNodeCount());
+ EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/",
+ GetDisplayedIndexedDBs(cookies_model.get()));
+ EXPECT_EQ(26, cookies_model->GetRoot()->GetTotalNodeCount());
}
DeleteStoredObjects(cookies_model->GetRoot()->GetChild(3));
@@ -308,7 +340,24 @@ TEST_F(CookiesTreeModelTest, Remove) {
GetDisplayedLocalStorages(cookies_model.get()));
EXPECT_EQ("http://host2:2/",
GetDisplayedSessionStorages(cookies_model.get()));
- EXPECT_EQ(15, cookies_model->GetRoot()->GetTotalNodeCount());
+ EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/",
+ GetDisplayedIndexedDBs(cookies_model.get()));
+ EXPECT_EQ(21, cookies_model->GetRoot()->GetTotalNodeCount());
+ }
+
+ DeleteStoredObjects(cookies_model->GetRoot()->GetChild(4));
+ {
+ SCOPED_TRACE("First IndexedDB origin removed");
+ EXPECT_STREQ("B,C", GetMonsterCookies(monster).c_str());
+ EXPECT_STREQ("B,C", GetDisplayedCookies(cookies_model.get()).c_str());
+ EXPECT_EQ("db2", GetDisplayedDatabases(cookies_model.get()));
+ EXPECT_EQ("http://host2:2/",
+ GetDisplayedLocalStorages(cookies_model.get()));
+ EXPECT_EQ("http://host2:2/",
+ GetDisplayedSessionStorages(cookies_model.get()));
+ EXPECT_EQ("http://idbhost2:2/",
+ GetDisplayedIndexedDBs(cookies_model.get()));
+ EXPECT_EQ(18, cookies_model->GetRoot()->GetTotalNodeCount());
}
}
@@ -322,18 +371,22 @@ TEST_F(CookiesTreeModelTest, RemoveCookiesNode) {
SCOPED_TRACE("First origin removed");
EXPECT_STREQ("B,C", GetMonsterCookies(monster).c_str());
EXPECT_STREQ("B,C", GetDisplayedCookies(cookies_model.get()).c_str());
- // 20 because in this case, the origin remains, although the COOKIES
+ // 28 because in this case, the origin remains, although the COOKIES
// node beneath it has been deleted. So, we have
// root -> foo1 -> cookies -> a, foo2, foo3 -> cookies -> c
// dbhost1 -> database -> db1, dbhost2 -> database -> db2,
// host1 -> localstorage -> http://host1:1/,
- // host2 -> localstorage -> http://host2:2/.
- EXPECT_EQ(24, cookies_model->GetRoot()->GetTotalNodeCount());
+ // host2 -> localstorage -> http://host2:2/,
+ // idbhost1 -> sessionstorage -> http://idbhost1:1/,
+ // idbhost2 -> sessionstorage -> http://idbhost2:2/.
+ EXPECT_EQ(30, cookies_model->GetRoot()->GetTotalNodeCount());
EXPECT_EQ("db1,db2", GetDisplayedDatabases(cookies_model.get()));
EXPECT_EQ("http://host1:1/,http://host2:2/",
GetDisplayedLocalStorages(cookies_model.get()));
EXPECT_EQ("http://host1:1/,http://host2:2/",
GetDisplayedSessionStorages(cookies_model.get()));
+ EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/",
+ GetDisplayedIndexedDBs(cookies_model.get()));
}
DeleteStoredObjects(cookies_model->GetRoot()->GetChild(3)->GetChild(0));
@@ -346,7 +399,9 @@ TEST_F(CookiesTreeModelTest, RemoveCookiesNode) {
GetDisplayedLocalStorages(cookies_model.get()));
EXPECT_EQ("http://host1:1/,http://host2:2/",
GetDisplayedSessionStorages(cookies_model.get()));
- EXPECT_EQ(22, cookies_model->GetRoot()->GetTotalNodeCount());
+ EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/",
+ GetDisplayedIndexedDBs(cookies_model.get()));
+ EXPECT_EQ(28, cookies_model->GetRoot()->GetTotalNodeCount());
}
DeleteStoredObjects(cookies_model->GetRoot()->GetChild(5)->GetChild(0));
@@ -359,7 +414,9 @@ TEST_F(CookiesTreeModelTest, RemoveCookiesNode) {
GetDisplayedLocalStorages(cookies_model.get()));
EXPECT_EQ("http://host1:1/,http://host2:2/",
GetDisplayedSessionStorages(cookies_model.get()));
- EXPECT_EQ(20, cookies_model->GetRoot()->GetTotalNodeCount());
+ EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/",
+ GetDisplayedIndexedDBs(cookies_model.get()));
+ EXPECT_EQ(26, cookies_model->GetRoot()->GetTotalNodeCount());
}
}
@@ -378,15 +435,19 @@ TEST_F(CookiesTreeModelTest, RemoveCookieNode) {
GetDisplayedLocalStorages(cookies_model.get()));
EXPECT_EQ("http://host1:1/,http://host2:2/",
GetDisplayedSessionStorages(cookies_model.get()));
- // 24 because in this case, the origin remains, although the COOKIES
+ EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/",
+ GetDisplayedIndexedDBs(cookies_model.get()));
+ // 28 because in this case, the origin remains, although the COOKIES
// node beneath it has been deleted. So, we have
// root -> foo1 -> cookies -> a, foo2, foo3 -> cookies -> c
// dbhost1 -> database -> db1, dbhost2 -> database -> db2,
// host1 -> localstorage -> http://host1:1/,
// host2 -> localstorage -> http://host2:2/.
// host1 -> sessionstorage -> http://host1:1/,
- // host2 -> sessionstorage -> http://host2:2/.
- EXPECT_EQ(24, cookies_model->GetRoot()->GetTotalNodeCount());
+ // host2 -> sessionstorage -> http://host2:2/,
+ // idbhost1 -> sessionstorage -> http://idbhost1:1/,
+ // idbhost2 -> sessionstorage -> http://idbhost2:2/.
+ EXPECT_EQ(30, cookies_model->GetRoot()->GetTotalNodeCount());
}
DeleteStoredObjects(cookies_model->GetRoot()->GetChild(3)->GetChild(0));
@@ -399,7 +460,9 @@ TEST_F(CookiesTreeModelTest, RemoveCookieNode) {
GetDisplayedLocalStorages(cookies_model.get()));
EXPECT_EQ("http://host1:1/,http://host2:2/",
GetDisplayedSessionStorages(cookies_model.get()));
- EXPECT_EQ(22, cookies_model->GetRoot()->GetTotalNodeCount());
+ EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/",
+ GetDisplayedIndexedDBs(cookies_model.get()));
+ EXPECT_EQ(28, cookies_model->GetRoot()->GetTotalNodeCount());
}
DeleteStoredObjects(cookies_model->GetRoot()->GetChild(5)->GetChild(0));
@@ -412,7 +475,9 @@ TEST_F(CookiesTreeModelTest, RemoveCookieNode) {
GetDisplayedLocalStorages(cookies_model.get()));
EXPECT_EQ("http://host1:1/,http://host2:2/",
GetDisplayedSessionStorages(cookies_model.get()));
- EXPECT_EQ(20, cookies_model->GetRoot()->GetTotalNodeCount());
+ EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/",
+ GetDisplayedIndexedDBs(cookies_model.get()));
+ EXPECT_EQ(26, cookies_model->GetRoot()->GetTotalNodeCount());
}
}
@@ -426,24 +491,30 @@ TEST_F(CookiesTreeModelTest, RemoveSingleCookieNode) {
mock_browsing_data_database_helper_,
mock_browsing_data_local_storage_helper_,
mock_browsing_data_session_storage_helper_,
- mock_browsing_data_appcache_helper_);
+ mock_browsing_data_appcache_helper_,
+ mock_browsing_data_indexed_db_helper_);
mock_browsing_data_database_helper_->AddDatabaseSamples();
mock_browsing_data_database_helper_->Notify();
mock_browsing_data_local_storage_helper_->AddLocalStorageSamples();
mock_browsing_data_local_storage_helper_->Notify();
mock_browsing_data_session_storage_helper_->AddLocalStorageSamples();
mock_browsing_data_session_storage_helper_->Notify();
+ mock_browsing_data_indexed_db_helper_->AddIndexedDBSamples();
+ mock_browsing_data_indexed_db_helper_->Notify();
{
- SCOPED_TRACE("Initial State 4 cookies, 2 databases, 2 local storages");
- // 27 because there's the root, then foo1 -> cookies -> a,
+ SCOPED_TRACE("Initial State 4 cookies, 2 databases, 2 local storages, "
+ "2 session storages, 2 indexed DBs");
+ // 33 because there's the root, then foo1 -> cookies -> a,
// foo2 -> cookies -> b, foo3 -> cookies -> c,d
// dbhost1 -> database -> db1, dbhost2 -> database -> db2,
// host1 -> localstorage -> http://host1:1/,
// host2 -> localstorage -> http://host2:2/.
// host1 -> sessionstorage -> http://host1:1/,
- // host2 -> sessionstorage -> http://host2:2/.
- EXPECT_EQ(27, cookies_model.GetRoot()->GetTotalNodeCount());
+ // host2 -> sessionstorage -> http://host2:2/,
+ // idbhost1 -> sessionstorage -> http://idbhost1:1/,
+ // idbhost2 -> sessionstorage -> http://idbhost2:2/.
+ EXPECT_EQ(33, cookies_model.GetRoot()->GetTotalNodeCount());
EXPECT_STREQ("A,B,C,D", GetMonsterCookies(monster).c_str());
EXPECT_STREQ("A,B,C,D", GetDisplayedCookies(&cookies_model).c_str());
EXPECT_EQ("db1,db2", GetDisplayedDatabases(&cookies_model));
@@ -451,6 +522,8 @@ TEST_F(CookiesTreeModelTest, RemoveSingleCookieNode) {
GetDisplayedLocalStorages(&cookies_model));
EXPECT_EQ("http://host1:1/,http://host2:2/",
GetDisplayedSessionStorages(&cookies_model));
+ EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/",
+ GetDisplayedIndexedDBs(&cookies_model));
}
DeleteStoredObjects(cookies_model.GetRoot()->GetChild(2));
{
@@ -462,7 +535,9 @@ TEST_F(CookiesTreeModelTest, RemoveSingleCookieNode) {
GetDisplayedLocalStorages(&cookies_model));
EXPECT_EQ("http://host1:1/,http://host2:2/",
GetDisplayedSessionStorages(&cookies_model));
- EXPECT_EQ(23, cookies_model.GetRoot()->GetTotalNodeCount());
+ EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/",
+ GetDisplayedIndexedDBs(&cookies_model));
+ EXPECT_EQ(29, cookies_model.GetRoot()->GetTotalNodeCount());
}
}
@@ -477,25 +552,30 @@ TEST_F(CookiesTreeModelTest, RemoveSingleCookieNodeOf3) {
mock_browsing_data_database_helper_,
mock_browsing_data_local_storage_helper_,
mock_browsing_data_session_storage_helper_,
- mock_browsing_data_appcache_helper_);
+ mock_browsing_data_appcache_helper_,
+ mock_browsing_data_indexed_db_helper_);
mock_browsing_data_database_helper_->AddDatabaseSamples();
mock_browsing_data_database_helper_->Notify();
mock_browsing_data_local_storage_helper_->AddLocalStorageSamples();
mock_browsing_data_local_storage_helper_->Notify();
mock_browsing_data_session_storage_helper_->AddLocalStorageSamples();
mock_browsing_data_session_storage_helper_->Notify();
+ mock_browsing_data_indexed_db_helper_->AddIndexedDBSamples();
+ mock_browsing_data_indexed_db_helper_->Notify();
{
SCOPED_TRACE("Initial State 5 cookies, 2 databases, 2 local storages, "
- "2 session storages");
- // 28 because there's the root, then foo1 -> cookies -> a,
+ "2 session storages, 2 indexed DBs");
+ // 34 because there's the root, then foo1 -> cookies -> a,
// foo2 -> cookies -> b, foo3 -> cookies -> c,d,e
// dbhost1 -> database -> db1, dbhost2 -> database -> db2,
// host1 -> localstorage -> http://host1:1/,
// host2 -> localstorage -> http://host2:2/.
// host1 -> sessionstorage -> http://host1:1/,
- // host2 -> sessionstorage -> http://host2:2/.
- EXPECT_EQ(28, cookies_model.GetRoot()->GetTotalNodeCount());
+ // host2 -> sessionstorage -> http://host2:2/,
+ // idbhost1 -> sessionstorage -> http://idbhost1:1/,
+ // idbhost2 -> sessionstorage -> http://idbhost2:2/.
+ EXPECT_EQ(34, cookies_model.GetRoot()->GetTotalNodeCount());
EXPECT_STREQ("A,B,C,D,E", GetMonsterCookies(monster).c_str());
EXPECT_STREQ("A,B,C,D,E", GetDisplayedCookies(&cookies_model).c_str());
EXPECT_EQ("db1,db2", GetDisplayedDatabases(&cookies_model));
@@ -503,6 +583,8 @@ TEST_F(CookiesTreeModelTest, RemoveSingleCookieNodeOf3) {
GetDisplayedLocalStorages(&cookies_model));
EXPECT_EQ("http://host1:1/,http://host2:2/",
GetDisplayedSessionStorages(&cookies_model));
+ EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/",
+ GetDisplayedIndexedDBs(&cookies_model));
}
DeleteStoredObjects(cookies_model.GetRoot()->GetChild(2)->GetChild(0)->
GetChild(1));
@@ -510,12 +592,14 @@ TEST_F(CookiesTreeModelTest, RemoveSingleCookieNodeOf3) {
SCOPED_TRACE("Middle cookie in third origin removed");
EXPECT_STREQ("A,B,C,E", GetMonsterCookies(monster).c_str());
EXPECT_STREQ("A,B,C,E", GetDisplayedCookies(&cookies_model).c_str());
- EXPECT_EQ(27, cookies_model.GetRoot()->GetTotalNodeCount());
+ EXPECT_EQ(33, cookies_model.GetRoot()->GetTotalNodeCount());
EXPECT_EQ("db1,db2", GetDisplayedDatabases(&cookies_model));
EXPECT_EQ("http://host1:1/,http://host2:2/",
GetDisplayedLocalStorages(&cookies_model));
EXPECT_EQ("http://host1:1/,http://host2:2/",
GetDisplayedSessionStorages(&cookies_model));
+ EXPECT_EQ("http://idbhost1:1/,http://idbhost2:2/",
+ GetDisplayedIndexedDBs(&cookies_model));
}
}
@@ -530,7 +614,8 @@ TEST_F(CookiesTreeModelTest, RemoveSecondOrigin) {
mock_browsing_data_database_helper_,
mock_browsing_data_local_storage_helper_,
mock_browsing_data_session_storage_helper_,
- mock_browsing_data_appcache_helper_);
+ mock_browsing_data_appcache_helper_,
+ mock_browsing_data_indexed_db_helper_);
{
SCOPED_TRACE("Initial State 5 cookies");
// 11 because there's the root, then foo1 -> cookies -> a,
@@ -565,7 +650,8 @@ TEST_F(CookiesTreeModelTest, OriginOrdering) {
new MockBrowsingDataDatabaseHelper(profile_.get()),
new MockBrowsingDataLocalStorageHelper(profile_.get()),
new MockBrowsingDataLocalStorageHelper(profile_.get()),
- new MockBrowsingDataAppCacheHelper(profile_.get()));
+ new MockBrowsingDataAppCacheHelper(profile_.get()),
+ new MockBrowsingDataIndexedDBHelper(profile_.get()));
{
SCOPED_TRACE("Initial State 8 cookies");
@@ -592,7 +678,8 @@ TEST_F(CookiesTreeModelTest, ContentSettings) {
new MockBrowsingDataDatabaseHelper(profile_.get()),
new MockBrowsingDataLocalStorageHelper(profile_.get()),
new MockBrowsingDataLocalStorageHelper(profile_.get()),
- new MockBrowsingDataAppCacheHelper(profile_.get()));
+ new MockBrowsingDataAppCacheHelper(profile_.get()),
+ new MockBrowsingDataIndexedDBHelper(profile_.get()));
TestingProfile profile;
HostContentSettingsMap* content_settings =
diff --git a/chrome/browser/dom_ui/cookies_view_handler.cc b/chrome/browser/dom_ui/cookies_view_handler.cc
index 4f62393..06c9808 100644
--- a/chrome/browser/dom_ui/cookies_view_handler.cc
+++ b/chrome/browser/dom_ui/cookies_view_handler.cc
@@ -13,6 +13,7 @@
#include "base/values.h"
#include "chrome/browser/browsing_data_appcache_helper.h"
#include "chrome/browser/browsing_data_database_helper.h"
+#include "chrome/browser/browsing_data_indexed_db_helper.h"
#include "chrome/browser/browsing_data_local_storage_helper.h"
#include "chrome/browser/profile.h"
#include "grit/generated_resources.h"
@@ -96,7 +97,7 @@ bool GetCookieTreeNodeDictionary(const CookieTreeNode& node,
const BrowsingDataDatabaseHelper::DatabaseInfo& database_info =
*node.GetDetailedInfo().database_info;
- dict->SetString(kKeyName,database_info.database_name.empty() ?
+ dict->SetString(kKeyName, database_info.database_name.empty() ?
l10n_util::GetStringUTF8(IDS_COOKIES_WEB_DATABASE_UNNAMED_NAME) :
database_info.database_name);
dict->SetString(kKeyDesc, database_info.description);
@@ -146,6 +147,26 @@ bool GetCookieTreeNodeDictionary(const CookieTreeNode& node,
break;
}
+ case CookieTreeNode::DetailedInfo::TYPE_INDEXED_DB: {
+ dict->SetString(kKeyType, "indexed_db");
+ dict->SetString(kKeyIcon, "chrome://theme/IDR_COOKIE_STORAGE_ICON");
+
+ const BrowsingDataIndexedDBHelper::IndexedDBInfo& indexed_db_info =
+ *node.GetDetailedInfo().indexed_db_info;
+
+ dict->SetString(kKeyName, indexed_db_info.database_name.empty() ?
+ l10n_util::GetStringUTF8(IDS_COOKIES_WEB_DATABASE_UNNAMED_NAME) :
+ indexed_db_info.database_name);
+ dict->SetString(kKeyOrigin, indexed_db_info.origin);
+ dict->SetString(kKeySize,
+ FormatBytes(indexed_db_info.size,
+ GetByteDisplayUnits(indexed_db_info.size),
+ true));
+ dict->SetString(kKeyModified, WideToUTF8(
+ base::TimeFormatFriendlyDateAndTime(indexed_db_info.last_modified)));
+
+ break;
+ }
default:
break;
}
@@ -201,6 +222,14 @@ void CookiesViewHandler::GetLocalizedValues(
l10n_util::GetStringUTF16(IDS_COOKIES_LOCAL_STORAGE_LAST_MODIFIED_LABEL));
localized_strings->SetString("label_local_storage_origin",
l10n_util::GetStringUTF16(IDS_COOKIES_LOCAL_STORAGE_ORIGIN_LABEL));
+ localized_strings->SetString("label_indexed_db_name",
+ l10n_util::GetStringUTF16(IDS_COOKIES_COOKIE_NAME_LABEL));
+ localized_strings->SetString("label_indexed_db_size",
+ l10n_util::GetStringUTF16(IDS_COOKIES_LOCAL_STORAGE_SIZE_ON_DISK_LABEL));
+ localized_strings->SetString("label_indexed_db_last_modified",
+ l10n_util::GetStringUTF16(IDS_COOKIES_LOCAL_STORAGE_LAST_MODIFIED_LABEL));
+ localized_strings->SetString("label_indexed_db_origin",
+ l10n_util::GetStringUTF16(IDS_COOKIES_LOCAL_STORAGE_ORIGIN_LABEL));
localized_strings->SetString("label_app_cache_manifest",
l10n_util::GetStringUTF16(IDS_COOKIES_APPLICATION_CACHE_MANIFEST_LABEL));
localized_strings->SetString("label_cookie_last_accessed",
@@ -229,7 +258,8 @@ void CookiesViewHandler::Initialize() {
new BrowsingDataDatabaseHelper(profile),
new BrowsingDataLocalStorageHelper(profile),
NULL,
- new BrowsingDataAppCacheHelper(profile)));
+ new BrowsingDataAppCacheHelper(profile),
+ BrowsingDataIndexedDBHelper::Create(profile)));
cookies_tree_model_->AddObserver(this);
}
diff --git a/chrome/browser/gtk/gtk_chrome_cookie_view.cc b/chrome/browser/gtk/gtk_chrome_cookie_view.cc
index 5ecba7e..aa4d344 100644
--- a/chrome/browser/gtk/gtk_chrome_cookie_view.cc
+++ b/chrome/browser/gtk/gtk_chrome_cookie_view.cc
@@ -179,6 +179,14 @@ void SetAppCacheDetailsSensitivity(GtkChromeCookieView *self,
gtk_widget_set_sensitive(self->appcache_last_accessed_entry_, enabled);
}
+void SetIndexedDBDetailsSensitivity(GtkChromeCookieView *self,
+ gboolean enabled) {
+ gtk_widget_set_sensitive(self->indexed_db_name_entry_, enabled);
+ gtk_widget_set_sensitive(self->indexed_db_origin_entry_, enabled);
+ gtk_widget_set_sensitive(self->indexed_db_size_entry_, enabled);
+ gtk_widget_set_sensitive(self->indexed_db_last_modified_entry_, enabled);
+}
+
void SetLocalStorageItemSensitivity(GtkChromeCookieView* self,
gboolean enabled) {
gtk_widget_set_sensitive(self->local_storage_item_origin_entry_, enabled);
@@ -237,6 +245,8 @@ void UpdateVisibleDetailedInfo(GtkChromeCookieView *self, GtkWidget* table) {
SetLocalStorageDetailsSensitivity(self,
table == self->local_storage_details_table_);
SetAppCacheDetailsSensitivity(self, table == self->appcache_details_table_);
+ SetIndexedDBDetailsSensitivity(self,
+ table == self->indexed_db_details_table_);
SetLocalStorageItemSensitivity(self,
table == self->local_storage_item_table_);
SetDatabaseAccessedSensitivity(self,
@@ -256,6 +266,8 @@ void UpdateVisibleDetailedInfo(GtkChromeCookieView *self, GtkWidget* table) {
gtk_widget_hide(self->local_storage_details_table_);
if (table != self->appcache_details_table_)
gtk_widget_hide(self->appcache_details_table_);
+ if (table != self->indexed_db_details_table_)
+ gtk_widget_hide(self->indexed_db_details_table_);
if (table != self->local_storage_item_table_)
gtk_widget_hide(self->local_storage_item_table_);
if (table != self->database_accessed_table_)
@@ -363,6 +375,26 @@ void BuildWidgets(GtkChromeCookieView *self, gboolean editable_expiration) {
self->appcache_details_table_,
&self->appcache_last_accessed_entry_);
+ // IndexedDB details.
+ self->indexed_db_details_table_ = gtk_table_new(4, 2, FALSE);
+ gtk_container_add(GTK_CONTAINER(self->table_box_),
+ self->indexed_db_details_table_);
+ gtk_table_set_col_spacing(GTK_TABLE(self->indexed_db_details_table_), 0,
+ gtk_util::kLabelSpacing);
+
+ row = 0;
+ InitDetailRow(row++, IDS_COOKIES_COOKIE_NAME_LABEL,
+ self->indexed_db_details_table_,
+ &self->indexed_db_name_entry_);
+ InitDetailRow(row++, IDS_COOKIES_LOCAL_STORAGE_ORIGIN_LABEL,
+ self->indexed_db_details_table_,
+ &self->indexed_db_origin_entry_);
+ InitDetailRow(row++, IDS_COOKIES_LOCAL_STORAGE_SIZE_ON_DISK_LABEL,
+ self->indexed_db_details_table_, &self->indexed_db_size_entry_);
+ InitDetailRow(row++, IDS_COOKIES_LOCAL_STORAGE_LAST_MODIFIED_LABEL,
+ self->indexed_db_details_table_,
+ &self->indexed_db_last_modified_entry_);
+
// Local storage item.
self->local_storage_item_table_ = gtk_table_new(3, 2, FALSE);
gtk_container_add(GTK_CONTAINER(self->table_box_),
@@ -564,6 +596,30 @@ void gtk_chrome_cookie_view_display_app_cache(
SetAppCacheDetailsSensitivity(self, TRUE);
}
+// Switches the display to showing the passed in IndexedDB data.
+void gtk_chrome_cookie_view_display_indexed_db(
+ GtkChromeCookieView* self,
+ const BrowsingDataIndexedDBHelper::IndexedDBInfo& indexed_db_info) {
+ UpdateVisibleDetailedInfo(self, self->indexed_db_details_table_);
+
+ gtk_entry_set_text(GTK_ENTRY(self->indexed_db_name_entry_),
+ indexed_db_info.database_name.empty() ?
+ l10n_util::GetStringUTF8(
+ IDS_COOKIES_WEB_DATABASE_UNNAMED_NAME).c_str() :
+ indexed_db_info.database_name.c_str());
+ gtk_entry_set_text(GTK_ENTRY(self->indexed_db_origin_entry_),
+ indexed_db_info.origin.c_str());
+ gtk_entry_set_text(GTK_ENTRY(self->indexed_db_size_entry_),
+ UTF16ToUTF8(FormatBytes(
+ indexed_db_info.size,
+ GetByteDisplayUnits(indexed_db_info.size),
+ true)).c_str());
+ gtk_entry_set_text(GTK_ENTRY(self->indexed_db_last_modified_entry_),
+ WideToUTF8(base::TimeFormatFriendlyDateAndTime(
+ indexed_db_info.last_modified)).c_str());
+ SetLocalStorageDetailsSensitivity(self, TRUE);
+}
+
void gtk_chrome_cookie_view_display_local_storage_item(
GtkChromeCookieView* self,
const std::string& host,
diff --git a/chrome/browser/gtk/gtk_chrome_cookie_view.h b/chrome/browser/gtk/gtk_chrome_cookie_view.h
index cacf0dc..049d621 100644
--- a/chrome/browser/gtk/gtk_chrome_cookie_view.h
+++ b/chrome/browser/gtk/gtk_chrome_cookie_view.h
@@ -12,6 +12,7 @@
#include "chrome/browser/browsing_data_appcache_helper.h"
#include "chrome/browser/browsing_data_database_helper.h"
+#include "chrome/browser/browsing_data_indexed_db_helper.h"
#include "chrome/browser/browsing_data_local_storage_helper.h"
#include "net/base/cookie_monster.h"
@@ -93,6 +94,13 @@ typedef struct {
GtkWidget* appcache_created_entry_;
GtkWidget* appcache_last_accessed_entry_;
+ // The IndexedDB details widgets.
+ GtkWidget* indexed_db_details_table_;
+ GtkWidget* indexed_db_name_entry_;
+ GtkWidget* indexed_db_origin_entry_;
+ GtkWidget* indexed_db_size_entry_;
+ GtkWidget* indexed_db_last_modified_entry_;
+
// The local storage item widgets.
GtkWidget* local_storage_item_table_;
GtkWidget* local_storage_item_origin_entry_;
@@ -157,6 +165,11 @@ void gtk_chrome_cookie_view_display_app_cache(
GtkChromeCookieView* widget,
const appcache::AppCacheInfo& info);
+// Switches the display to showing the passed in IndexedDB data.
+void gtk_chrome_cookie_view_display_indexed_db(
+ GtkChromeCookieView* widget,
+ const BrowsingDataIndexedDBHelper::IndexedDBInfo& info);
+
// Switches the display to an individual storage item.
void gtk_chrome_cookie_view_display_local_storage_item(
GtkChromeCookieView* widget,
diff --git a/chrome/browser/gtk/options/cookie_filter_page_gtk.cc b/chrome/browser/gtk/options/cookie_filter_page_gtk.cc
index 4bf3701..f60bebd 100644
--- a/chrome/browser/gtk/options/cookie_filter_page_gtk.cc
+++ b/chrome/browser/gtk/options/cookie_filter_page_gtk.cc
@@ -193,12 +193,10 @@ void CookieFilterPageGtk::OnShowCookiesClicked(GtkWidget* button) {
UserMetricsRecordAction(UserMetricsAction("Options_ShowCookies"), NULL);
CookiesView::Show(GTK_WINDOW(gtk_widget_get_toplevel(button)),
profile(),
- new BrowsingDataDatabaseHelper(
- profile()),
- new BrowsingDataLocalStorageHelper(
- profile()),
- new BrowsingDataAppCacheHelper(
- profile()));
+ new BrowsingDataDatabaseHelper(profile()),
+ new BrowsingDataLocalStorageHelper(profile()),
+ new BrowsingDataAppCacheHelper(profile()),
+ BrowsingDataIndexedDBHelper::Create(profile()));
}
void CookieFilterPageGtk::OnFlashLinkClicked(GtkWidget* button) {
diff --git a/chrome/browser/gtk/options/cookies_view.cc b/chrome/browser/gtk/options/cookies_view.cc
index aee19d7..415dedb 100644
--- a/chrome/browser/gtk/options/cookies_view.cc
+++ b/chrome/browser/gtk/options/cookies_view.cc
@@ -50,11 +50,13 @@ void CookiesView::Show(
Profile* profile,
BrowsingDataDatabaseHelper* browsing_data_database_helper,
BrowsingDataLocalStorageHelper* browsing_data_local_storage_helper,
- BrowsingDataAppCacheHelper* browsing_data_appcache_helper) {
+ BrowsingDataAppCacheHelper* browsing_data_appcache_helper,
+ BrowsingDataIndexedDBHelper* browsing_data_indexed_db_helper) {
DCHECK(profile);
DCHECK(browsing_data_database_helper);
DCHECK(browsing_data_local_storage_helper);
DCHECK(browsing_data_appcache_helper);
+ DCHECK(browsing_data_indexed_db_helper);
// If there's already an existing editor window, activate it.
if (instance_) {
@@ -64,7 +66,8 @@ void CookiesView::Show(
profile,
browsing_data_database_helper,
browsing_data_local_storage_helper,
- browsing_data_appcache_helper);
+ browsing_data_appcache_helper,
+ browsing_data_indexed_db_helper);
}
}
@@ -73,11 +76,13 @@ CookiesView::CookiesView(
Profile* profile,
BrowsingDataDatabaseHelper* browsing_data_database_helper,
BrowsingDataLocalStorageHelper* browsing_data_local_storage_helper,
- BrowsingDataAppCacheHelper* browsing_data_appcache_helper)
+ BrowsingDataAppCacheHelper* browsing_data_appcache_helper,
+ BrowsingDataIndexedDBHelper* browsing_data_indexed_db_helper)
: profile_(profile),
browsing_data_database_helper_(browsing_data_database_helper),
browsing_data_local_storage_helper_(browsing_data_local_storage_helper),
browsing_data_appcache_helper_(browsing_data_appcache_helper),
+ browsing_data_indexed_db_helper_(browsing_data_indexed_db_helper),
filter_update_factory_(this),
destroy_dialog_in_destructor_(false) {
Init(parent);
@@ -90,7 +95,7 @@ CookiesView::CookiesView(
gtk_chrome_cookie_view_clear(GTK_CHROME_COOKIE_VIEW(cookie_display_));
}
-void CookiesView::TestDestroySyncrhonously() {
+void CookiesView::TestDestroySynchronously() {
g_signal_handler_disconnect(dialog_, destroy_handler_);
destroy_dialog_in_destructor_ = true;
}
@@ -188,7 +193,8 @@ void CookiesView::Init(GtkWindow* parent) {
browsing_data_database_helper_,
browsing_data_local_storage_helper_,
NULL,
- browsing_data_appcache_helper_));
+ browsing_data_appcache_helper_,
+ browsing_data_indexed_db_helper_));
cookies_tree_adapter_.reset(
new gtk_tree::TreeAdapter(this, cookies_tree_model_.get()));
tree_ = gtk_tree_view_new_with_model(
@@ -270,6 +276,11 @@ void CookiesView::EnableControls() {
gtk_chrome_cookie_view_display_app_cache(
GTK_CHROME_COOKIE_VIEW(cookie_display_),
*detailed_info.appcache_info);
+ } else if (detailed_info.node_type ==
+ CookieTreeNode::DetailedInfo::TYPE_INDEXED_DB) {
+ gtk_chrome_cookie_view_display_indexed_db(
+ GTK_CHROME_COOKIE_VIEW(cookie_display_),
+ *detailed_info.indexed_db_info);
} else {
gtk_chrome_cookie_view_clear(GTK_CHROME_COOKIE_VIEW(cookie_display_));
}
diff --git a/chrome/browser/gtk/options/cookies_view.h b/chrome/browser/gtk/options/cookies_view.h
index 2d58b61..27c0e0f 100644
--- a/chrome/browser/gtk/options/cookies_view.h
+++ b/chrome/browser/gtk/options/cookies_view.h
@@ -17,6 +17,7 @@
#include "base/task.h"
#include "chrome/browser/browsing_data_appcache_helper.h"
#include "chrome/browser/browsing_data_database_helper.h"
+#include "chrome/browser/browsing_data_indexed_db_helper.h"
#include "chrome/browser/browsing_data_local_storage_helper.h"
#include "chrome/browser/gtk/gtk_chrome_cookie_view.h"
#include "chrome/browser/gtk/gtk_tree.h"
@@ -43,7 +44,8 @@ class CookiesView : public gtk_tree::TreeAdapter::Delegate {
Profile* profile,
BrowsingDataDatabaseHelper* browsing_data_database_helper,
BrowsingDataLocalStorageHelper* browsing_data_local_storage_helper,
- BrowsingDataAppCacheHelper* browsing_data_appcache_helper);
+ BrowsingDataAppCacheHelper* browsing_data_appcache_helper,
+ BrowsingDataIndexedDBHelper* browsing_data_indexed_db_helper);
// gtk_tree::TreeAdapter::Delegate implementation.
virtual void OnAnyModelUpdateStart();
@@ -55,11 +57,12 @@ class CookiesView : public gtk_tree::TreeAdapter::Delegate {
Profile* profile,
BrowsingDataDatabaseHelper* browsing_data_database_helper,
BrowsingDataLocalStorageHelper* browsing_data_local_storage_helper,
- BrowsingDataAppCacheHelper* browsing_data_appcache_helper);
+ BrowsingDataAppCacheHelper* browsing_data_appcache_helper,
+ BrowsingDataIndexedDBHelper* browsing_data_indexed_db_helper);
// A method only used in unit tests that sets a bit inside this class that
// lets it be stack allocated.
- void TestDestroySyncrhonously();
+ void TestDestroySynchronously();
// Initialize the dialog contents and layout.
void Init(GtkWindow* parent);
@@ -112,6 +115,7 @@ class CookiesView : public gtk_tree::TreeAdapter::Delegate {
scoped_refptr<BrowsingDataLocalStorageHelper>
browsing_data_local_storage_helper_;
scoped_refptr<BrowsingDataAppCacheHelper> browsing_data_appcache_helper_;
+ scoped_refptr<BrowsingDataIndexedDBHelper> browsing_data_indexed_db_helper_;
// A factory to construct Runnable Methods so that we can be called back to
// re-evaluate the model after the search query string changes.
diff --git a/chrome/browser/gtk/options/cookies_view_unittest.cc b/chrome/browser/gtk/options/cookies_view_unittest.cc
index a32d5f4..2a71eea6 100644
--- a/chrome/browser/gtk/options/cookies_view_unittest.cc
+++ b/chrome/browser/gtk/options/cookies_view_unittest.cc
@@ -12,6 +12,7 @@
#include "base/string_util.h"
#include "chrome/browser/mock_browsing_data_appcache_helper.h"
#include "chrome/browser/mock_browsing_data_database_helper.h"
+#include "chrome/browser/mock_browsing_data_indexed_db_helper.h"
#include "chrome/browser/mock_browsing_data_local_storage_helper.h"
#include "chrome/browser/gtk/gtk_chrome_cookie_view.h"
#include "chrome/common/net/url_request_context_getter.h"
@@ -36,12 +37,15 @@ class CookiesViewTest : public testing::Test {
new MockBrowsingDataLocalStorageHelper(profile_.get());
mock_browsing_data_appcache_helper_ =
new MockBrowsingDataAppCacheHelper(profile_.get());
+ mock_browsing_data_indexed_db_helper_ =
+ new MockBrowsingDataIndexedDBHelper(profile_.get());
}
void CheckDetailsSensitivity(gboolean expected_cookies,
gboolean expected_database,
gboolean expected_local_storage,
gboolean expected_appcache,
+ gboolean expected_indexed_db,
const CookiesView& cookies_view) {
GtkChromeCookieView* display = GTK_CHROME_COOKIE_VIEW(
cookies_view.cookie_display_);
@@ -84,6 +88,15 @@ class CookiesViewTest : public testing::Test {
GTK_WIDGET_SENSITIVE(display->appcache_created_entry_));
EXPECT_EQ(expected_appcache,
GTK_WIDGET_SENSITIVE(display->appcache_last_accessed_entry_));
+ // IndexedDB
+ EXPECT_EQ(expected_indexed_db,
+ GTK_WIDGET_SENSITIVE(display->indexed_db_name_entry_));
+ EXPECT_EQ(expected_indexed_db,
+ GTK_WIDGET_SENSITIVE(display->indexed_db_origin_entry_));
+ EXPECT_EQ(expected_indexed_db,
+ GTK_WIDGET_SENSITIVE(display->indexed_db_size_entry_));
+ EXPECT_EQ(expected_indexed_db,
+ GTK_WIDGET_SENSITIVE(display->indexed_db_last_modified_entry_));
}
// Get the cookie names in the cookie list, as a comma seperated string.
@@ -194,6 +207,8 @@ class CookiesViewTest : public testing::Test {
mock_browsing_data_local_storage_helper_;
scoped_refptr<MockBrowsingDataAppCacheHelper>
mock_browsing_data_appcache_helper_;
+ scoped_refptr<MockBrowsingDataIndexedDBHelper>
+ mock_browsing_data_indexed_db_helper_;
};
TEST_F(CookiesViewTest, Empty) {
@@ -201,11 +216,12 @@ TEST_F(CookiesViewTest, Empty) {
profile_.get(),
mock_browsing_data_database_helper_,
mock_browsing_data_local_storage_helper_,
- mock_browsing_data_appcache_helper_);
- cookies_view.TestDestroySyncrhonously();
+ mock_browsing_data_appcache_helper_,
+ mock_browsing_data_indexed_db_helper_);
+ cookies_view.TestDestroySynchronously();
EXPECT_EQ(FALSE, GTK_WIDGET_SENSITIVE(cookies_view.remove_all_button_));
EXPECT_EQ(FALSE, GTK_WIDGET_SENSITIVE(cookies_view.remove_button_));
- CheckDetailsSensitivity(FALSE, FALSE, FALSE, FALSE, cookies_view);
+ CheckDetailsSensitivity(FALSE, FALSE, FALSE, FALSE, FALSE, cookies_view);
EXPECT_STREQ("", GetDisplayedCookies(cookies_view).c_str());
}
@@ -222,8 +238,9 @@ TEST_F(CookiesViewTest, Noop) {
profile_.get(),
mock_browsing_data_database_helper_,
mock_browsing_data_local_storage_helper_,
- mock_browsing_data_appcache_helper_);
- cookies_view.TestDestroySyncrhonously();
+ mock_browsing_data_appcache_helper_,
+ mock_browsing_data_indexed_db_helper_);
+ cookies_view.TestDestroySynchronously();
mock_browsing_data_database_helper_->AddDatabaseSamples();
mock_browsing_data_database_helper_->Notify();
mock_browsing_data_local_storage_helper_->AddLocalStorageSamples();
@@ -238,7 +255,7 @@ TEST_F(CookiesViewTest, Noop) {
GetDisplayedCookies(cookies_view).c_str());
EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_all_button_));
EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_button_));
- CheckDetailsSensitivity(FALSE, FALSE, FALSE, FALSE, cookies_view);
+ CheckDetailsSensitivity(FALSE, FALSE, FALSE, FALSE, FALSE, cookies_view);
}
TEST_F(CookiesViewTest, RemoveAll) {
@@ -249,8 +266,9 @@ TEST_F(CookiesViewTest, RemoveAll) {
profile_.get(),
mock_browsing_data_database_helper_,
mock_browsing_data_local_storage_helper_,
- mock_browsing_data_appcache_helper_);
- cookies_view.TestDestroySyncrhonously();
+ mock_browsing_data_appcache_helper_,
+ mock_browsing_data_indexed_db_helper_);
+ cookies_view.TestDestroySynchronously();
mock_browsing_data_database_helper_->AddDatabaseSamples();
mock_browsing_data_database_helper_->Notify();
mock_browsing_data_local_storage_helper_->AddLocalStorageSamples();
@@ -263,7 +281,7 @@ TEST_F(CookiesViewTest, RemoveAll) {
SCOPED_TRACE("Before removing");
EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_all_button_));
EXPECT_EQ(FALSE, GTK_WIDGET_SENSITIVE(cookies_view.remove_button_));
- CheckDetailsSensitivity(FALSE, FALSE, FALSE, FALSE, cookies_view);
+ CheckDetailsSensitivity(FALSE, FALSE, FALSE, FALSE, FALSE, cookies_view);
EXPECT_STREQ("foo,_Cookies,__A,foo2,_Cookies,__B,"
"gdbhost1,_Web Databases,__db1,"
"gdbhost2,_Web Databases,__db2,"
@@ -281,7 +299,7 @@ TEST_F(CookiesViewTest, RemoveAll) {
EXPECT_EQ(0u, monster->GetAllCookies().size());
EXPECT_EQ(FALSE, GTK_WIDGET_SENSITIVE(cookies_view.remove_all_button_));
EXPECT_EQ(FALSE, GTK_WIDGET_SENSITIVE(cookies_view.remove_button_));
- CheckDetailsSensitivity(FALSE, FALSE, FALSE, FALSE, cookies_view);
+ CheckDetailsSensitivity(FALSE, FALSE, FALSE, FALSE, FALSE, cookies_view);
EXPECT_STREQ("", GetDisplayedCookies(cookies_view).c_str());
EXPECT_TRUE(mock_browsing_data_database_helper_->AllDeleted());
EXPECT_TRUE(mock_browsing_data_local_storage_helper_->AllDeleted());
@@ -296,8 +314,9 @@ TEST_F(CookiesViewTest, RemoveAllWithDefaultSelected) {
profile_.get(),
mock_browsing_data_database_helper_,
mock_browsing_data_local_storage_helper_,
- mock_browsing_data_appcache_helper_);
- cookies_view.TestDestroySyncrhonously();
+ mock_browsing_data_appcache_helper_,
+ mock_browsing_data_indexed_db_helper_);
+ cookies_view.TestDestroySynchronously();
mock_browsing_data_database_helper_->AddDatabaseSamples();
mock_browsing_data_database_helper_->Notify();
mock_browsing_data_local_storage_helper_->AddLocalStorageSamples();
@@ -309,7 +328,7 @@ TEST_F(CookiesViewTest, RemoveAllWithDefaultSelected) {
SCOPED_TRACE("Before removing");
EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_all_button_));
EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_button_));
- CheckDetailsSensitivity(FALSE, FALSE, FALSE, FALSE, cookies_view);
+ CheckDetailsSensitivity(FALSE, FALSE, FALSE, FALSE, FALSE, cookies_view);
EXPECT_STREQ("foo,_Cookies,__A,foo2,_Cookies,__B,"
"gdbhost1,_Web Databases,__db1,"
"gdbhost2,_Web Databases,__db2,"
@@ -327,7 +346,7 @@ TEST_F(CookiesViewTest, RemoveAllWithDefaultSelected) {
EXPECT_EQ(0u, monster->GetAllCookies().size());
EXPECT_EQ(FALSE, GTK_WIDGET_SENSITIVE(cookies_view.remove_all_button_));
EXPECT_EQ(FALSE, GTK_WIDGET_SENSITIVE(cookies_view.remove_button_));
- CheckDetailsSensitivity(FALSE, FALSE, FALSE, FALSE, cookies_view);
+ CheckDetailsSensitivity(FALSE, FALSE, FALSE, FALSE, FALSE, cookies_view);
EXPECT_STREQ("", GetDisplayedCookies(cookies_view).c_str());
EXPECT_EQ(0,
gtk_tree_selection_count_selected_rows(cookies_view.selection_));
@@ -345,8 +364,9 @@ TEST_F(CookiesViewTest, Remove) {
profile_.get(),
mock_browsing_data_database_helper_,
mock_browsing_data_local_storage_helper_,
- mock_browsing_data_appcache_helper_);
- cookies_view.TestDestroySyncrhonously();
+ mock_browsing_data_appcache_helper_,
+ mock_browsing_data_indexed_db_helper_);
+ cookies_view.TestDestroySynchronously();
mock_browsing_data_database_helper_->AddDatabaseSamples();
mock_browsing_data_database_helper_->Notify();
mock_browsing_data_local_storage_helper_->AddLocalStorageSamples();
@@ -359,7 +379,7 @@ TEST_F(CookiesViewTest, Remove) {
SCOPED_TRACE("First selection");
EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_all_button_));
EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_button_));
- CheckDetailsSensitivity(TRUE, FALSE, FALSE, FALSE, cookies_view);
+ CheckDetailsSensitivity(TRUE, FALSE, FALSE, FALSE, FALSE, cookies_view);
EXPECT_STREQ("foo1,_Cookies,__A,foo2,+Cookies,++B,++C,"
"gdbhost1,_Web Databases,__db1,"
"gdbhost2,_Web Databases,__db2,"
@@ -382,7 +402,7 @@ TEST_F(CookiesViewTest, Remove) {
EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_all_button_));
EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_button_));
EXPECT_STREQ("1:0:0", GetSelectedPath(cookies_view).c_str());
- CheckDetailsSensitivity(TRUE, FALSE, FALSE, FALSE, cookies_view);
+ CheckDetailsSensitivity(TRUE, FALSE, FALSE, FALSE, FALSE, cookies_view);
}
EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_button_));
@@ -400,7 +420,7 @@ TEST_F(CookiesViewTest, Remove) {
EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_all_button_));
EXPECT_EQ(FALSE, GTK_WIDGET_SENSITIVE(cookies_view.remove_button_));
EXPECT_STREQ("", GetSelectedPath(cookies_view).c_str());
- CheckDetailsSensitivity(FALSE, FALSE, FALSE, FALSE, cookies_view);
+ CheckDetailsSensitivity(FALSE, FALSE, FALSE, FALSE, FALSE, cookies_view);
}
ASSERT_TRUE(ExpandByPath(cookies_view, "0"));
@@ -419,7 +439,7 @@ TEST_F(CookiesViewTest, Remove) {
EXPECT_EQ(0u, monster->GetAllCookies().size());
EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_all_button_));
EXPECT_EQ(FALSE, GTK_WIDGET_SENSITIVE(cookies_view.remove_button_));
- CheckDetailsSensitivity(FALSE, FALSE, FALSE, FALSE, cookies_view);
+ CheckDetailsSensitivity(FALSE, FALSE, FALSE, FALSE, FALSE, cookies_view);
EXPECT_STREQ("gdbhost1,_Web Databases,__db1,"
"gdbhost2,_Web Databases,__db2,"
"host1,_Local Storage,__http://host1:1/,"
@@ -442,7 +462,7 @@ TEST_F(CookiesViewTest, Remove) {
EXPECT_EQ(0u, monster->GetAllCookies().size());
EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_all_button_));
EXPECT_EQ(FALSE, GTK_WIDGET_SENSITIVE(cookies_view.remove_button_));
- CheckDetailsSensitivity(FALSE, FALSE, FALSE, FALSE, cookies_view);
+ CheckDetailsSensitivity(FALSE, FALSE, FALSE, FALSE, FALSE, cookies_view);
EXPECT_STREQ("gdbhost2,_Web Databases,__db2,"
"host1,_Local Storage,__http://host1:1/,"
"host2,_Local Storage,__http://host2:2/",
@@ -467,7 +487,7 @@ TEST_F(CookiesViewTest, Remove) {
EXPECT_EQ(0u, monster->GetAllCookies().size());
EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_all_button_));
EXPECT_EQ(FALSE, GTK_WIDGET_SENSITIVE(cookies_view.remove_button_));
- CheckDetailsSensitivity(FALSE, FALSE, FALSE, FALSE, cookies_view);
+ CheckDetailsSensitivity(FALSE, FALSE, FALSE, FALSE, FALSE, cookies_view);
EXPECT_STREQ("gdbhost2,_Web Databases,__db2,"
"host2,_Local Storage,__http://host2:2/",
GetDisplayedCookies(cookies_view).c_str());
@@ -489,8 +509,9 @@ TEST_F(CookiesViewTest, RemoveCookiesByType) {
profile_.get(),
mock_browsing_data_database_helper_,
mock_browsing_data_local_storage_helper_,
- mock_browsing_data_appcache_helper_);
- cookies_view.TestDestroySyncrhonously();
+ mock_browsing_data_appcache_helper_,
+ mock_browsing_data_indexed_db_helper_);
+ cookies_view.TestDestroySynchronously();
mock_browsing_data_database_helper_->AddDatabaseSamples();
mock_browsing_data_database_helper_->Notify();
mock_browsing_data_local_storage_helper_->AddLocalStorageSamples();
@@ -624,8 +645,9 @@ TEST_F(CookiesViewTest, RemoveByDomain) {
profile_.get(),
mock_browsing_data_database_helper_,
mock_browsing_data_local_storage_helper_,
- mock_browsing_data_appcache_helper_);
- cookies_view.TestDestroySyncrhonously();
+ mock_browsing_data_appcache_helper_,
+ mock_browsing_data_indexed_db_helper_);
+ cookies_view.TestDestroySynchronously();
mock_browsing_data_database_helper_->AddDatabaseSamples();
mock_browsing_data_database_helper_->Notify();
mock_browsing_data_local_storage_helper_->AddLocalStorageSamples();
@@ -750,8 +772,9 @@ TEST_F(CookiesViewTest, RemoveDefaultSelection) {
profile_.get(),
mock_browsing_data_database_helper_,
mock_browsing_data_local_storage_helper_,
- mock_browsing_data_appcache_helper_);
- cookies_view.TestDestroySyncrhonously();
+ mock_browsing_data_appcache_helper_,
+ mock_browsing_data_indexed_db_helper_);
+ cookies_view.TestDestroySynchronously();
mock_browsing_data_database_helper_->AddDatabaseSamples();
mock_browsing_data_database_helper_->Notify();
mock_browsing_data_local_storage_helper_->AddLocalStorageSamples();
@@ -858,8 +881,9 @@ TEST_F(CookiesViewTest, Filter) {
profile_.get(),
mock_browsing_data_database_helper_,
mock_browsing_data_local_storage_helper_,
- mock_browsing_data_appcache_helper_);
- cookies_view.TestDestroySyncrhonously();
+ mock_browsing_data_appcache_helper_,
+ mock_browsing_data_indexed_db_helper_);
+ cookies_view.TestDestroySynchronously();
mock_browsing_data_database_helper_->AddDatabaseSamples();
mock_browsing_data_database_helper_->Notify();
mock_browsing_data_local_storage_helper_->AddLocalStorageSamples();
@@ -928,8 +952,9 @@ TEST_F(CookiesViewTest, FilterRemoveAll) {
profile_.get(),
mock_browsing_data_database_helper_,
mock_browsing_data_local_storage_helper_,
- mock_browsing_data_appcache_helper_);
- cookies_view.TestDestroySyncrhonously();
+ mock_browsing_data_appcache_helper_,
+ mock_browsing_data_indexed_db_helper_);
+ cookies_view.TestDestroySynchronously();
mock_browsing_data_database_helper_->AddDatabaseSamples();
mock_browsing_data_database_helper_->Notify();
mock_browsing_data_local_storage_helper_->AddLocalStorageSamples();
@@ -997,8 +1022,9 @@ TEST_F(CookiesViewTest, FilterRemove) {
profile_.get(),
mock_browsing_data_database_helper_,
mock_browsing_data_local_storage_helper_,
- mock_browsing_data_appcache_helper_);
- cookies_view.TestDestroySyncrhonously();
+ mock_browsing_data_appcache_helper_,
+ mock_browsing_data_indexed_db_helper_);
+ cookies_view.TestDestroySynchronously();
mock_browsing_data_database_helper_->AddDatabaseSamples();
mock_browsing_data_database_helper_->Notify();
mock_browsing_data_local_storage_helper_->AddLocalStorageSamples();
@@ -1047,7 +1073,7 @@ TEST_F(CookiesViewTest, FilterRemove) {
SCOPED_TRACE("First selection");
EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_all_button_));
EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_button_));
- CheckDetailsSensitivity(TRUE, FALSE, FALSE, FALSE, cookies_view);
+ CheckDetailsSensitivity(TRUE, FALSE, FALSE, FALSE, FALSE, cookies_view);
}
gtk_button_clicked(GTK_BUTTON(cookies_view.remove_button_));
@@ -1061,7 +1087,7 @@ TEST_F(CookiesViewTest, FilterRemove) {
EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_all_button_));
EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_button_));
EXPECT_STREQ("1:0:0", GetSelectedPath(cookies_view).c_str());
- CheckDetailsSensitivity(TRUE, FALSE, FALSE, FALSE, cookies_view);
+ CheckDetailsSensitivity(TRUE, FALSE, FALSE, FALSE, FALSE, cookies_view);
}
gtk_button_clicked(GTK_BUTTON(cookies_view.remove_button_));
@@ -1073,7 +1099,7 @@ TEST_F(CookiesViewTest, FilterRemove) {
GetDisplayedCookies(cookies_view).c_str());
EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_all_button_));
EXPECT_EQ(FALSE, GTK_WIDGET_SENSITIVE(cookies_view.remove_button_));
- CheckDetailsSensitivity(FALSE, FALSE, FALSE, FALSE, cookies_view);
+ CheckDetailsSensitivity(FALSE, FALSE, FALSE, FALSE, FALSE, cookies_view);
}
ASSERT_TRUE(ExpandByPath(cookies_view, "0"));
@@ -1086,7 +1112,7 @@ TEST_F(CookiesViewTest, FilterRemove) {
EXPECT_STREQ("C,B", GetMonsterCookies(monster).c_str());
EXPECT_EQ(FALSE, GTK_WIDGET_SENSITIVE(cookies_view.remove_all_button_));
EXPECT_EQ(FALSE, GTK_WIDGET_SENSITIVE(cookies_view.remove_button_));
- CheckDetailsSensitivity(FALSE, FALSE, FALSE, FALSE, cookies_view);
+ CheckDetailsSensitivity(FALSE, FALSE, FALSE, FALSE, FALSE, cookies_view);
EXPECT_STREQ("", GetDisplayedCookies(cookies_view).c_str());
}
@@ -1132,7 +1158,7 @@ TEST_F(CookiesViewTest, FilterRemove) {
SCOPED_TRACE("First selection");
EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_all_button_));
EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_button_));
- CheckDetailsSensitivity(FALSE, TRUE, FALSE, FALSE, cookies_view);
+ CheckDetailsSensitivity(FALSE, TRUE, FALSE, FALSE, FALSE, cookies_view);
}
gtk_button_clicked(GTK_BUTTON(cookies_view.remove_button_));
@@ -1146,7 +1172,7 @@ TEST_F(CookiesViewTest, FilterRemove) {
GetDisplayedCookies(cookies_view).c_str());
EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_all_button_));
EXPECT_EQ(FALSE, GTK_WIDGET_SENSITIVE(cookies_view.remove_button_));
- CheckDetailsSensitivity(FALSE, FALSE, FALSE, FALSE, cookies_view);
+ CheckDetailsSensitivity(FALSE, FALSE, FALSE, FALSE, FALSE, cookies_view);
}
ASSERT_TRUE(ExpandByPath(cookies_view, "2"));
@@ -1160,7 +1186,7 @@ TEST_F(CookiesViewTest, FilterRemove) {
SCOPED_TRACE("First selection");
EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_all_button_));
EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_button_));
- CheckDetailsSensitivity(FALSE, FALSE, TRUE, FALSE, cookies_view);
+ CheckDetailsSensitivity(FALSE, FALSE, TRUE, FALSE, FALSE, cookies_view);
}
gtk_button_clicked(GTK_BUTTON(cookies_view.remove_button_));
@@ -1173,6 +1199,6 @@ TEST_F(CookiesViewTest, FilterRemove) {
GetDisplayedCookies(cookies_view).c_str());
EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_all_button_));
EXPECT_EQ(FALSE, GTK_WIDGET_SENSITIVE(cookies_view.remove_button_));
- CheckDetailsSensitivity(FALSE, FALSE, FALSE, FALSE, cookies_view);
+ CheckDetailsSensitivity(FALSE, FALSE, FALSE, FALSE, FALSE, cookies_view);
}
}
diff --git a/chrome/browser/resources/options/cookies_view.html b/chrome/browser/resources/options/cookies_view.html
index 7a93769..83ff149 100644
--- a/chrome/browser/resources/options/cookies_view.html
+++ b/chrome/browser/resources/options/cookies_view.html
@@ -143,6 +143,37 @@
</td></tr>
</table>
+ <div class="cookies-details-pane hidden" id="indexedDBInfo">
+ <table>
+ <tr>
+ <td class="cookie-details-label"
+ i18n-content="label_indexed_db_name">
+ </td>
+ <td><span id="indexedDBName"></span></td>
+ </tr>
+ <tr>
+ <td class="cookie-details-label"
+ i18n-content="label_indexed_db_origin">
+ </td>
+ <td><span id="indexedDBOrigin"></span></td>
+ </tr>
+ <tr>
+ <td class="cookie-details-label"
+ i18n-content="label_indexed_db_size">
+ </td>
+ <td><span id="indexedDBSize"></span></td>
+ </tr>
+ <tr>
+ <td class="cookie-details-label"
+ i18n-content="label_indexed_db_last_modified">
+ </td>
+ <td><span id="indexedDBLastModified"></span></td>
+ </tr>
+ </table>
+ </div>
+ </td></tr>
+ </table>
+
<button id="remove-cookie" i18n-content="remove_cookie"></button>
<button id="remove-all-cookie" i18n-content="remove_all_cookie"></button>
</div>
diff --git a/chrome/browser/resources/options/cookies_view.js b/chrome/browser/resources/options/cookies_view.js
index da01daa..3ffd4c8 100644
--- a/chrome/browser/resources/options/cookies_view.js
+++ b/chrome/browser/resources/options/cookies_view.js
@@ -62,7 +62,11 @@ cr.define('options', function() {
*/
updateVisibleDetailedInfo: function(name) {
const infoPaneNames = [
- 'cookiesInfo', 'appCacheInfo', 'webDbInfo', 'localStorageInfo'];
+ 'cookiesInfo',
+ 'appCacheInfo',
+ 'webDbInfo',
+ 'localStorageInfo',
+ 'indexedDBInfo'];
for (var i = 0 ; i < infoPaneNames.length; ++i) {
var paneName = infoPaneNames[i];
@@ -140,6 +144,16 @@ cr.define('options', function() {
$('localStorageLastModified').textContent = localStorage.modified;
},
+ /**
+ * Sets IndexedDB info to display.
+ */
+ setIndexedDBInfo: function(indexedDB) {
+ $('indexedDBName').textContent = indexedDB.name;
+ $('indexedDBOrigin').textContent = indexedDB.origin;
+ $('indexedDBSize').textContent = indexedDB.size;
+ $('indexedDBLastModified').textContent = indexedDB.modified;
+ },
+
lastQuery_ : null,
/**
@@ -180,6 +194,9 @@ cr.define('options', function() {
} else if (data && data.type == 'app_cache') {
this.setAppCacheInfo(data);
this.updateVisibleDetailedInfo('appCacheInfo');
+ } else if (data && data.type == 'indexed_db') {
+ this.setIndexedDBInfo(data);
+ this.updateVisibleDetailedInfo('indexedDBInfo');
} else {
this.clearCookieInfo();
this.updateVisibleDetailedInfo('cookiesInfo');
diff --git a/chrome/browser/tab_contents/tab_specific_content_settings.cc b/chrome/browser/tab_contents/tab_specific_content_settings.cc
index 7c86182..5e289c5 100644
--- a/chrome/browser/tab_contents/tab_specific_content_settings.cc
+++ b/chrome/browser/tab_contents/tab_specific_content_settings.cc
@@ -260,6 +260,10 @@ void TabSpecificContentSettings::LocalSharedObjectsContainer::Reset() {
CookiesTreeModel*
TabSpecificContentSettings::LocalSharedObjectsContainer::GetCookiesTreeModel() {
- return new CookiesTreeModel(
- cookies_, databases_, local_storages_, session_storages_, appcaches_);
+ return new CookiesTreeModel(cookies_,
+ databases_,
+ local_storages_,
+ session_storages_,
+ appcaches_,
+ indexed_dbs_);
}
diff --git a/chrome/browser/views/indexed_db_info_view.cc b/chrome/browser/views/indexed_db_info_view.cc
new file mode 100644
index 0000000..1b0b28c
--- /dev/null
+++ b/chrome/browser/views/indexed_db_info_view.cc
@@ -0,0 +1,148 @@
+// Copyright (c) 2010 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 "chrome/browser/views/indexed_db_info_view.h"
+
+#include <algorithm>
+
+#include "app/l10n_util.h"
+#include "base/i18n/time_formatting.h"
+#include "base/utf_string_conversions.h"
+#include "gfx/color_utils.h"
+#include "grit/generated_resources.h"
+#include "views/grid_layout.h"
+#include "views/controls/label.h"
+#include "views/controls/textfield/textfield.h"
+#include "views/standard_layout.h"
+
+static const int kIndexedDBInfoViewBorderSize = 1;
+static const int kIndexedDBInfoViewInsetSize = 3;
+
+///////////////////////////////////////////////////////////////////////////////
+// IndexedDBInfoView, public:
+
+IndexedDBInfoView::IndexedDBInfoView()
+ : name_value_field_(NULL),
+ origin_value_field_(NULL),
+ size_value_field_(NULL),
+ last_modified_value_field_(NULL) {
+}
+
+IndexedDBInfoView::~IndexedDBInfoView() {
+}
+
+void IndexedDBInfoView::SetIndexedDBInfo(
+ const BrowsingDataIndexedDBHelper::IndexedDBInfo& indexed_db_info) {
+ name_value_field_->SetText(
+ indexed_db_info.database_name.empty() ?
+ l10n_util::GetString(IDS_COOKIES_WEB_DATABASE_UNNAMED_NAME) :
+ UTF8ToWide(indexed_db_info.database_name));
+ origin_value_field_->SetText(UTF8ToWide(indexed_db_info.origin));
+ size_value_field_->SetText(
+ FormatBytes(indexed_db_info.size,
+ GetByteDisplayUnits(indexed_db_info.size),
+ true));
+ last_modified_value_field_->SetText(
+ base::TimeFormatFriendlyDateAndTime(indexed_db_info.last_modified));
+ EnableIndexedDBDisplay(true);
+}
+
+void IndexedDBInfoView::EnableIndexedDBDisplay(bool enabled) {
+ name_value_field_->SetEnabled(enabled);
+ origin_value_field_->SetEnabled(enabled);
+ size_value_field_->SetEnabled(enabled);
+ last_modified_value_field_->SetEnabled(enabled);
+}
+
+void IndexedDBInfoView::ClearIndexedDBDisplay() {
+ std::wstring no_cookie_string =
+ l10n_util::GetString(IDS_COOKIES_COOKIE_NONESELECTED);
+ name_value_field_->SetText(no_cookie_string);
+ origin_value_field_->SetText(no_cookie_string);
+ size_value_field_->SetText(no_cookie_string);
+ last_modified_value_field_->SetText(no_cookie_string);
+ EnableIndexedDBDisplay(false);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// IndexedDBInfoView, views::View overrides:
+
+void IndexedDBInfoView::ViewHierarchyChanged(bool is_add,
+ views::View* parent,
+ views::View* child) {
+ if (is_add && child == this)
+ Init();
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// IndexedDBInfoView, private:
+
+void IndexedDBInfoView::Init() {
+ SkColor border_color = color_utils::GetSysSkColor(COLOR_3DSHADOW);
+ views::Border* border = views::Border::CreateSolidBorder(
+ kIndexedDBInfoViewBorderSize, border_color);
+ set_border(border);
+
+ views::Label* name_label = new views::Label(
+ l10n_util::GetString(IDS_COOKIES_COOKIE_NAME_LABEL));
+ name_value_field_ = new views::Textfield;
+ views::Label* origin_label = new views::Label(
+ l10n_util::GetString(IDS_COOKIES_LOCAL_STORAGE_ORIGIN_LABEL));
+ origin_value_field_ = new views::Textfield;
+ views::Label* size_label = new views::Label(
+ l10n_util::GetString(IDS_COOKIES_LOCAL_STORAGE_SIZE_ON_DISK_LABEL));
+ size_value_field_ = new views::Textfield;
+ views::Label* last_modified_label = new views::Label(
+ l10n_util::GetString(IDS_COOKIES_LOCAL_STORAGE_LAST_MODIFIED_LABEL));
+ last_modified_value_field_ = new views::Textfield;
+
+ using views::GridLayout;
+
+ GridLayout* layout = new GridLayout(this);
+ layout->SetInsets(kIndexedDBInfoViewInsetSize,
+ kIndexedDBInfoViewInsetSize,
+ kIndexedDBInfoViewInsetSize,
+ kIndexedDBInfoViewInsetSize);
+ SetLayoutManager(layout);
+
+ int three_column_layout_id = 0;
+ views::ColumnSet* column_set = layout->AddColumnSet(three_column_layout_id);
+ column_set->AddColumn(GridLayout::TRAILING, GridLayout::CENTER, 0,
+ GridLayout::USE_PREF, 0, 0);
+ column_set->AddPaddingColumn(0, kRelatedControlHorizontalSpacing);
+ column_set->AddColumn(GridLayout::FILL, GridLayout::FILL, 1,
+ GridLayout::USE_PREF, 0, 0);
+
+ layout->StartRow(0, three_column_layout_id);
+ layout->AddView(name_label);
+ layout->AddView(name_value_field_);
+ layout->AddPaddingRow(0, kRelatedControlSmallVerticalSpacing);
+ layout->StartRow(0, three_column_layout_id);
+ layout->AddView(origin_label);
+ layout->AddView(origin_value_field_);
+ layout->AddPaddingRow(0, kRelatedControlSmallVerticalSpacing);
+ layout->StartRow(0, three_column_layout_id);
+ layout->AddView(size_label);
+ layout->AddView(size_value_field_);
+ layout->AddPaddingRow(0, kRelatedControlSmallVerticalSpacing);
+ layout->StartRow(0, three_column_layout_id);
+ layout->AddView(last_modified_label);
+ layout->AddView(last_modified_value_field_);
+
+ // Color these borderless text areas the same as the containing dialog.
+ SkColor text_area_background = color_utils::GetSysSkColor(COLOR_3DFACE);
+ // Now that the Textfields are in the view hierarchy, we can initialize them.
+ name_value_field_->SetReadOnly(true);
+ name_value_field_->RemoveBorder();
+ name_value_field_->SetBackgroundColor(text_area_background);
+ origin_value_field_->SetReadOnly(true);
+ origin_value_field_->RemoveBorder();
+ origin_value_field_->SetBackgroundColor(text_area_background);
+ size_value_field_->SetReadOnly(true);
+ size_value_field_->RemoveBorder();
+ size_value_field_->SetBackgroundColor(text_area_background);
+ last_modified_value_field_->SetReadOnly(true);
+ last_modified_value_field_->RemoveBorder();
+ last_modified_value_field_->SetBackgroundColor(text_area_background);
+}
diff --git a/chrome/browser/views/indexed_db_info_view.h b/chrome/browser/views/indexed_db_info_view.h
new file mode 100644
index 0000000..20ba89b
--- /dev/null
+++ b/chrome/browser/views/indexed_db_info_view.h
@@ -0,0 +1,56 @@
+// Copyright (c) 2010 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.
+
+#ifndef CHROME_BROWSER_VIEWS_INDEXED_DB_INFO_VIEW_H_
+#define CHROME_BROWSER_VIEWS_INDEXED_DB_INFO_VIEW_H_
+#pragma once
+
+#include "views/view.h"
+#include "chrome/browser/browsing_data_indexed_db_helper.h"
+
+namespace views {
+class Label;
+class Textfield;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// IndexedDBInfoView
+//
+// Responsible for displaying a tabular grid of IndexedDB information.
+class IndexedDBInfoView : public views::View {
+ public:
+ IndexedDBInfoView();
+ virtual ~IndexedDBInfoView();
+
+ // Update the display from the specified Local Storage info.
+ void SetIndexedDBInfo(
+ const BrowsingDataIndexedDBHelper::IndexedDBInfo&
+ indexed_db_info);
+
+ // Clears the cookie display to indicate that no or multiple local storages
+ // are selected.
+ void ClearIndexedDBDisplay();
+
+ // Enables or disables the local storate property text fields.
+ void EnableIndexedDBDisplay(bool enabled);
+
+ protected:
+ // views::View overrides:
+ virtual void ViewHierarchyChanged(
+ bool is_add, views::View* parent, views::View* child);
+
+ private:
+ // Set up the view layout
+ void Init();
+
+ // Individual property labels
+ views::Textfield* name_value_field_;
+ views::Textfield* origin_value_field_;
+ views::Textfield* size_value_field_;
+ views::Textfield* last_modified_value_field_;
+
+ DISALLOW_COPY_AND_ASSIGN(IndexedDBInfoView);
+};
+
+#endif // CHROME_BROWSER_VIEWS_INDEXED_DB_INFO_VIEW_H_
diff --git a/chrome/browser/views/options/cookies_view.cc b/chrome/browser/views/options/cookies_view.cc
index 2bba860..5e2b6d0 100644
--- a/chrome/browser/views/options/cookies_view.cc
+++ b/chrome/browser/views/options/cookies_view.cc
@@ -13,6 +13,7 @@
#include "chrome/browser/views/appcache_info_view.h"
#include "chrome/browser/views/cookie_info_view.h"
#include "chrome/browser/views/database_info_view.h"
+#include "chrome/browser/views/indexed_db_info_view.h"
#include "chrome/browser/views/local_storage_info_view.h"
#include "gfx/canvas.h"
#include "gfx/color_utils.h"
@@ -229,6 +230,10 @@ void CookiesView::OnTreeViewSelectionChanged(views::TreeView* tree_view) {
CookieTreeNode::DetailedInfo::TYPE_APPCACHE) {
UpdateVisibleDetailedInfo(appcache_info_view_);
appcache_info_view_->SetAppCacheInfo(detailed_info.appcache_info);
+ } else if (detailed_info.node_type ==
+ CookieTreeNode::DetailedInfo::TYPE_INDEXED_DB) {
+ UpdateVisibleDetailedInfo(indexed_db_info_view_);
+ indexed_db_info_view_->SetIndexedDBInfo(*detailed_info.indexed_db_info);
} else {
UpdateVisibleDetailedInfo(cookie_info_view_);
cookie_info_view_->ClearCookieDisplay();
@@ -263,6 +268,7 @@ CookiesView::CookiesView(Profile* profile)
database_info_view_(NULL),
local_storage_info_view_(NULL),
appcache_info_view_(NULL),
+ indexed_db_info_view_(NULL),
remove_button_(NULL),
remove_all_button_(NULL),
profile_(profile),
@@ -285,7 +291,8 @@ void CookiesView::Init() {
new BrowsingDataDatabaseHelper(profile_),
new BrowsingDataLocalStorageHelper(profile_),
NULL,
- new BrowsingDataAppCacheHelper(profile_)));
+ new BrowsingDataAppCacheHelper(profile_),
+ BrowsingDataIndexedDBHelper::Create(profile_)));
cookies_tree_model_->AddObserver(this);
info_panel_ = new InfoPanelView;
@@ -293,10 +300,12 @@ void CookiesView::Init() {
database_info_view_ = new DatabaseInfoView;
local_storage_info_view_ = new LocalStorageInfoView;
appcache_info_view_ = new AppCacheInfoView;
+ indexed_db_info_view_ = new IndexedDBInfoView;
info_panel_->AddChildView(cookie_info_view_);
info_panel_->AddChildView(database_info_view_);
info_panel_->AddChildView(local_storage_info_view_);
info_panel_->AddChildView(appcache_info_view_);
+ info_panel_->AddChildView(indexed_db_info_view_);
cookies_tree_ = new CookiesTreeView(cookies_tree_model_.get());
remove_button_ = new views::NativeButton(
@@ -384,4 +393,5 @@ void CookiesView::UpdateVisibleDetailedInfo(views::View* view) {
database_info_view_->SetVisible(view == database_info_view_);
local_storage_info_view_->SetVisible(view == local_storage_info_view_);
appcache_info_view_->SetVisible(view == appcache_info_view_);
+ indexed_db_info_view_->SetVisible(view == indexed_db_info_view_);
}
diff --git a/chrome/browser/views/options/cookies_view.h b/chrome/browser/views/options/cookies_view.h
index 121affd..dc6b9ff 100644
--- a/chrome/browser/views/options/cookies_view.h
+++ b/chrome/browser/views/options/cookies_view.h
@@ -30,6 +30,7 @@ class AppCacheInfoView;
class CookieInfoView;
class CookiesTreeView;
class DatabaseInfoView;
+class IndexedDBInfoView;
class LocalStorageInfoView;
class Profile;
class Timer;
@@ -134,6 +135,7 @@ class CookiesView : public CookiesTreeModel::Observer,
DatabaseInfoView* database_info_view_;
LocalStorageInfoView* local_storage_info_view_;
AppCacheInfoView* appcache_info_view_;
+ IndexedDBInfoView* indexed_db_info_view_;
views::NativeButton* remove_button_;
views::NativeButton* remove_all_button_;