| OLD | NEW |
| 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 <memory> | 7 #include <memory> |
| 8 #include <utility> | 8 #include <utility> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/i18n/time_formatting.h" | 11 #include "base/i18n/time_formatting.h" |
| 12 #include "base/stl_util.h" | 12 #include "base/stl_util.h" |
| 13 #include "base/strings/string_number_conversions.h" | 13 #include "base/strings/string_number_conversions.h" |
| 14 #include "base/strings/string_split.h" | 14 #include "base/strings/string_split.h" |
| 15 #include "base/strings/string_util.h" | 15 #include "base/strings/string_util.h" |
| 16 #include "base/values.h" | 16 #include "base/values.h" |
| 17 #include "build/build_config.h" | 17 #include "build/build_config.h" |
| 18 #include "chrome/browser/browsing_data/cookies_tree_model.h" | 18 #include "chrome/browser/browsing_data/cookies_tree_model.h" |
| 19 #include "chrome/grit/generated_resources.h" | 19 #include "chrome/grit/generated_resources.h" |
| 20 #include "content/public/browser/cache_storage_context.h" | 20 #include "content/public/browser/cache_storage_context.h" |
| 21 #include "content/public/browser/indexed_db_context.h" | 21 #include "content/public/browser/indexed_db_context.h" |
| 22 #include "content/public/browser/service_worker_context.h" | 22 #include "content/public/browser/service_worker_context.h" |
| 23 #include "extensions/features/features.h" |
| 23 #include "net/cookies/canonical_cookie.h" | 24 #include "net/cookies/canonical_cookie.h" |
| 24 #include "storage/common/fileapi/file_system_types.h" | 25 #include "storage/common/fileapi/file_system_types.h" |
| 25 #include "ui/base/l10n/l10n_util.h" | 26 #include "ui/base/l10n/l10n_util.h" |
| 26 #include "ui/base/text/bytes_formatting.h" | 27 #include "ui/base/text/bytes_formatting.h" |
| 27 | 28 |
| 28 #if defined(ENABLE_EXTENSIONS) | 29 #if BUILDFLAG(ENABLE_EXTENSIONS) |
| 29 #include "extensions/common/extension_set.h" | 30 #include "extensions/common/extension_set.h" |
| 30 #endif | 31 #endif |
| 31 | 32 |
| 32 namespace { | 33 namespace { |
| 33 | 34 |
| 34 const char kKeyId[] = "id"; | 35 const char kKeyId[] = "id"; |
| 35 const char kKeyTitle[] = "title"; | 36 const char kKeyTitle[] = "title"; |
| 36 const char kKeyIcon[] = "icon"; | 37 const char kKeyIcon[] = "icon"; |
| 37 const char kKeyType[] = "type"; | 38 const char kKeyType[] = "type"; |
| 38 const char kKeyHasChildren[] = "hasChildren"; | 39 const char kKeyHasChildren[] = "hasChildren"; |
| 39 | 40 |
| 40 #if defined(ENABLE_EXTENSIONS) | 41 #if BUILDFLAG(ENABLE_EXTENSIONS) |
| 41 const char kKeyAppsProtectingThis[] = "appsProtectingThis"; | 42 const char kKeyAppsProtectingThis[] = "appsProtectingThis"; |
| 42 #endif | 43 #endif |
| 43 const char kKeyName[] = "name"; | 44 const char kKeyName[] = "name"; |
| 44 const char kKeyContent[] = "content"; | 45 const char kKeyContent[] = "content"; |
| 45 const char kKeyDomain[] = "domain"; | 46 const char kKeyDomain[] = "domain"; |
| 46 const char kKeyPath[] = "path"; | 47 const char kKeyPath[] = "path"; |
| 47 const char kKeySendFor[] = "sendfor"; | 48 const char kKeySendFor[] = "sendfor"; |
| 48 const char kKeyAccessibleToScript[] = "accessibleToScript"; | 49 const char kKeyAccessibleToScript[] = "accessibleToScript"; |
| 49 const char kKeyDesc[] = "desc"; | 50 const char kKeyDesc[] = "desc"; |
| 50 const char kKeySize[] = "size"; | 51 const char kKeySize[] = "size"; |
| (...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 312 media_license_info.last_modified_time))); | 313 media_license_info.last_modified_time))); |
| 313 break; | 314 break; |
| 314 } | 315 } |
| 315 default: | 316 default: |
| 316 #if defined(OS_MACOSX) | 317 #if defined(OS_MACOSX) |
| 317 dict->SetString(kKeyIcon, "chrome://theme/IDR_BOOKMARK_BAR_FOLDER"); | 318 dict->SetString(kKeyIcon, "chrome://theme/IDR_BOOKMARK_BAR_FOLDER"); |
| 318 #endif | 319 #endif |
| 319 break; | 320 break; |
| 320 } | 321 } |
| 321 | 322 |
| 322 #if defined(ENABLE_EXTENSIONS) | 323 #if BUILDFLAG(ENABLE_EXTENSIONS) |
| 323 const extensions::ExtensionSet* protecting_apps = | 324 const extensions::ExtensionSet* protecting_apps = |
| 324 node.GetModel()->ExtensionsProtectingNode(node); | 325 node.GetModel()->ExtensionsProtectingNode(node); |
| 325 if (protecting_apps && !protecting_apps->is_empty()) { | 326 if (protecting_apps && !protecting_apps->is_empty()) { |
| 326 base::ListValue* app_infos = new base::ListValue; | 327 base::ListValue* app_infos = new base::ListValue; |
| 327 for (extensions::ExtensionSet::const_iterator it = protecting_apps->begin(); | 328 for (extensions::ExtensionSet::const_iterator it = protecting_apps->begin(); |
| 328 it != protecting_apps->end(); ++it) { | 329 it != protecting_apps->end(); ++it) { |
| 329 std::unique_ptr<base::DictionaryValue> app_info( | 330 std::unique_ptr<base::DictionaryValue> app_info( |
| 330 new base::DictionaryValue()); | 331 new base::DictionaryValue()); |
| 331 app_info->SetString(kKeyId, (*it)->id()); | 332 app_info->SetString(kKeyId, (*it)->id()); |
| 332 app_info->SetString(kKeyName, (*it)->name()); | 333 app_info->SetString(kKeyName, (*it)->name()); |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 409 // lookup for O(1) space, but it could be further improved to O(1) lookup if | 410 // lookup for O(1) space, but it could be further improved to O(1) lookup if |
| 410 // desired (by trading O(n) space for the time improvement). | 411 // desired (by trading O(n) space for the time improvement). |
| 411 int site_count = root->child_count(); | 412 int site_count = root->child_count(); |
| 412 for (int i = 0; i < site_count; ++i) { | 413 for (int i = 0; i < site_count; ++i) { |
| 413 const CookieTreeNode* child = root->GetChild(i); | 414 const CookieTreeNode* child = root->GetChild(i); |
| 414 if (title == child->GetTitle()) | 415 if (title == child->GetTitle()) |
| 415 return child; | 416 return child; |
| 416 } | 417 } |
| 417 return nullptr; | 418 return nullptr; |
| 418 } | 419 } |
| OLD | NEW |