Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3468)

Unified Diff: chrome/browser/browsing_data/cookies_tree_model.cc

Issue 1408063003: Cleanup and optimizing switch using fall through. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressing nit. Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/browsing_data/cookies_tree_model.cc
diff --git a/chrome/browser/browsing_data/cookies_tree_model.cc b/chrome/browser/browsing_data/cookies_tree_model.cc
index 9538a02953985df6384bf1fc0fc6eb435293c3c8..bc3b3c5ced1dbcadd0eb4ef06ebed06c7d5ac791 100644
--- a/chrome/browser/browsing_data/cookies_tree_model.cc
+++ b/chrome/browser/browsing_data/cookies_tree_model.cc
@@ -133,28 +133,21 @@ GURL CanonicalizeCookieSource(const net::CanonicalCookie& cookie) {
#if defined(ENABLE_EXTENSIONS)
bool TypeIsProtected(CookieTreeNode::DetailedInfo::NodeType type) {
switch (type) {
- case CookieTreeNode::DetailedInfo::TYPE_COOKIE:
- return false;
+ // Fall through each below cases to return true.
case CookieTreeNode::DetailedInfo::TYPE_DATABASE:
- return true;
case CookieTreeNode::DetailedInfo::TYPE_LOCAL_STORAGE:
- return true;
case CookieTreeNode::DetailedInfo::TYPE_SESSION_STORAGE:
- return true;
case CookieTreeNode::DetailedInfo::TYPE_APPCACHE:
- return true;
case CookieTreeNode::DetailedInfo::TYPE_INDEXED_DB:
- return true;
case CookieTreeNode::DetailedInfo::TYPE_FILE_SYSTEM:
- return true;
- case CookieTreeNode::DetailedInfo::TYPE_QUOTA:
- return false;
- case CookieTreeNode::DetailedInfo::TYPE_CHANNEL_ID:
- return false;
case CookieTreeNode::DetailedInfo::TYPE_SERVICE_WORKER:
- return true;
case CookieTreeNode::DetailedInfo::TYPE_CACHE_STORAGE:
return true;
+
+ // Fall through each below cases to return false.
+ case CookieTreeNode::DetailedInfo::TYPE_COOKIE:
+ case CookieTreeNode::DetailedInfo::TYPE_QUOTA:
+ case CookieTreeNode::DetailedInfo::TYPE_CHANNEL_ID:
case CookieTreeNode::DetailedInfo::TYPE_FLASH_LSO:
return false;
default:
@@ -301,8 +294,7 @@ void CookieTreeNode::DeleteStoredObjects() {
CookiesTreeModel* CookieTreeNode::GetModel() const {
if (parent())
return parent()->GetModel();
- else
- return nullptr;
+ return nullptr;
}
///////////////////////////////////////////////////////////////////////////////
@@ -1031,28 +1023,24 @@ int CookiesTreeModel::GetIconIndex(ui::TreeModelNode* node) {
switch (ct_node->GetDetailedInfo().node_type) {
case CookieTreeNode::DetailedInfo::TYPE_HOST:
return ORIGIN;
+
+ // Fall through each below cases to return COOKIE.
case CookieTreeNode::DetailedInfo::TYPE_COOKIE:
+ case CookieTreeNode::DetailedInfo::TYPE_CHANNEL_ID:
return COOKIE;
+
+ // Fall through each below cases to return DATABASE.
case CookieTreeNode::DetailedInfo::TYPE_DATABASE:
- return DATABASE;
case CookieTreeNode::DetailedInfo::TYPE_LOCAL_STORAGE:
- return DATABASE; // close enough
case CookieTreeNode::DetailedInfo::TYPE_SESSION_STORAGE:
- return DATABASE; // ditto
case CookieTreeNode::DetailedInfo::TYPE_APPCACHE:
- return DATABASE; // ditto
case CookieTreeNode::DetailedInfo::TYPE_INDEXED_DB:
- return DATABASE; // ditto
case CookieTreeNode::DetailedInfo::TYPE_FILE_SYSTEM:
- return DATABASE; // ditto
- case CookieTreeNode::DetailedInfo::TYPE_QUOTA:
- return -1;
- case CookieTreeNode::DetailedInfo::TYPE_CHANNEL_ID:
- return COOKIE; // It's kinda like a cookie?
case CookieTreeNode::DetailedInfo::TYPE_SERVICE_WORKER:
- return DATABASE; // Just like appcache
case CookieTreeNode::DetailedInfo::TYPE_CACHE_STORAGE:
- return DATABASE; // ditto
+ return DATABASE;
+ case CookieTreeNode::DetailedInfo::TYPE_QUOTA:
+ return -1;
default:
break;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698