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

Side by Side Diff: chrome/browser/ui/webui/cookies_tree_model_util.cc

Issue 10790150: Show Flash LSOs for Pepper Flash in cookie dialog. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix Created 8 years, 4 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/webui/cookies_tree_model_util.h" 5 #include "chrome/browser/ui/webui/cookies_tree_model_util.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/i18n/time_formatting.h" 9 #include "base/i18n/time_formatting.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 std::string CookiesTreeModelUtil::GetTreeNodeId(const CookieTreeNode* node) { 80 std::string CookiesTreeModelUtil::GetTreeNodeId(const CookieTreeNode* node) {
81 CookieTreeNodeMap::const_iterator iter = node_map_.find(node); 81 CookieTreeNodeMap::const_iterator iter = node_map_.find(node);
82 if (iter != node_map_.end()) 82 if (iter != node_map_.end())
83 return base::IntToString(iter->second); 83 return base::IntToString(iter->second);
84 84
85 int32 new_id = id_map_.Add(node); 85 int32 new_id = id_map_.Add(node);
86 node_map_[node] = new_id; 86 node_map_[node] = new_id;
87 return base::IntToString(new_id); 87 return base::IntToString(new_id);
88 } 88 }
89 89
90 bool CookiesTreeModelUtil::GetCookieTreeNodeDictionary( 90 bool CookiesTreeModelUtil::GetCookieTreeNodeDictionary(
James Hawkins 2012/07/30 03:04:39 Holy moly this existing code is bad.
91 const CookieTreeNode& node, 91 const CookieTreeNode& node,
92 base::DictionaryValue* dict) { 92 base::DictionaryValue* dict) {
93 // Use node's address as an id for WebUI to look it up. 93 // Use node's address as an id for WebUI to look it up.
94 dict->SetString(kKeyId, GetTreeNodeId(&node)); 94 dict->SetString(kKeyId, GetTreeNodeId(&node));
95 dict->SetString(kKeyTitle, node.GetTitle()); 95 dict->SetString(kKeyTitle, node.GetTitle());
96 dict->SetBoolean(kKeyHasChildren, !node.empty()); 96 dict->SetBoolean(kKeyHasChildren, !node.empty());
97 97
98 switch (node.GetDetailedInfo().node_type) { 98 switch (node.GetDetailedInfo().node_type) {
99 case CookieTreeNode::DetailedInfo::TYPE_HOST: { 99 case CookieTreeNode::DetailedInfo::TYPE_HOST: {
100 dict->SetString(kKeyType, "origin"); 100 dict->SetString(kKeyType, "origin");
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 dict->SetString(kKeyCertType, 247 dict->SetString(kKeyCertType,
248 ClientCertTypeToString(server_bound_cert.type())); 248 ClientCertTypeToString(server_bound_cert.type()));
249 dict->SetString(kKeyCreated, UTF16ToUTF8( 249 dict->SetString(kKeyCreated, UTF16ToUTF8(
250 base::TimeFormatFriendlyDateAndTime( 250 base::TimeFormatFriendlyDateAndTime(
251 server_bound_cert.creation_time()))); 251 server_bound_cert.creation_time())));
252 dict->SetString(kKeyExpires, UTF16ToUTF8( 252 dict->SetString(kKeyExpires, UTF16ToUTF8(
253 base::TimeFormatFriendlyDateAndTime( 253 base::TimeFormatFriendlyDateAndTime(
254 server_bound_cert.expiration_time()))); 254 server_bound_cert.expiration_time())));
255 break; 255 break;
256 } 256 }
257 case CookieTreeNode::DetailedInfo::TYPE_FLASH_LSO: {
258 dict->SetString(kKeyType, "flash_lso");
259 dict->SetString(kKeyIcon, "chrome://theme/IDR_COOKIE_ICON");
260
261 dict->SetString(kKeyDomain, node.GetDetailedInfo().flash_lso_domain);
262 }
257 default: 263 default:
258 #if defined(OS_MACOSX) 264 #if defined(OS_MACOSX)
259 dict->SetString(kKeyIcon, "chrome://theme/IDR_BOOKMARK_BAR_FOLDER"); 265 dict->SetString(kKeyIcon, "chrome://theme/IDR_BOOKMARK_BAR_FOLDER");
260 #endif 266 #endif
261 break; 267 break;
262 } 268 }
263 269
264 const ExtensionSet* protecting_apps = 270 const ExtensionSet* protecting_apps =
265 node.GetModel()->ExtensionsProtectingNode(node); 271 node.GetModel()->ExtensionsProtectingNode(node);
266 if (protecting_apps && !protecting_apps->is_empty()) { 272 if (protecting_apps && !protecting_apps->is_empty()) {
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 child = id_map_.Lookup(node_id); 315 child = id_map_.Lookup(node_id);
310 child_index = parent->GetIndexOf(child); 316 child_index = parent->GetIndexOf(child);
311 if (child_index == -1) 317 if (child_index == -1)
312 break; 318 break;
313 319
314 parent = child; 320 parent = child;
315 } 321 }
316 322
317 return child_index >= 0 ? child : NULL; 323 return child_index >= 0 ? child : NULL;
318 } 324 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698