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

Side by Side Diff: chrome/browser/browsing_data/cookies_tree_model.cc

Issue 120593003: Move kFileScheme constant into content namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 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/browsing_data/cookies_tree_model.h" 5 #include "chrome/browser/browsing_data/cookies_tree_model.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <functional> 8 #include <functional>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 65
66 std::string CanonicalizeHost(const GURL& url) { 66 std::string CanonicalizeHost(const GURL& url) {
67 // The canonicalized representation makes the registry controlled domain 67 // The canonicalized representation makes the registry controlled domain
68 // come first, and then adds subdomains in reverse order, e.g. 68 // come first, and then adds subdomains in reverse order, e.g.
69 // 1.mail.google.com would become google.com.mail.1, and then a standard 69 // 1.mail.google.com would become google.com.mail.1, and then a standard
70 // string comparison works to order hosts by registry controlled domain 70 // string comparison works to order hosts by registry controlled domain
71 // first. Leading dots are ignored, ".google.com" is the same as 71 // first. Leading dots are ignored, ".google.com" is the same as
72 // "google.com". 72 // "google.com".
73 73
74 if (url.SchemeIsFile()) { 74 if (url.SchemeIsFile()) {
75 return std::string(chrome::kFileScheme) + 75 return std::string(content::kFileScheme) +
76 content::kStandardSchemeSeparator; 76 content::kStandardSchemeSeparator;
77 } 77 }
78 78
79 std::string host = url.host(); 79 std::string host = url.host();
80 std::string retval = 80 std::string retval =
81 net::registry_controlled_domains::GetDomainAndRegistry( 81 net::registry_controlled_domains::GetDomainAndRegistry(
82 host, 82 host,
83 net::registry_controlled_domains::EXCLUDE_PRIVATE_REGISTRIES); 83 net::registry_controlled_domains::EXCLUDE_PRIVATE_REGISTRIES);
84 if (!retval.length()) // Is an IP address or other special origin. 84 if (!retval.length()) // Is an IP address or other special origin.
85 return host; 85 return host;
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after
548 CookieTreeNode::DetailedInfo CookieTreeRootNode::GetDetailedInfo() const { 548 CookieTreeNode::DetailedInfo CookieTreeRootNode::GetDetailedInfo() const {
549 return DetailedInfo().Init(DetailedInfo::TYPE_ROOT); 549 return DetailedInfo().Init(DetailedInfo::TYPE_ROOT);
550 } 550 }
551 551
552 /////////////////////////////////////////////////////////////////////////////// 552 ///////////////////////////////////////////////////////////////////////////////
553 // CookieTreeHostNode, public: 553 // CookieTreeHostNode, public:
554 554
555 // static 555 // static
556 base::string16 CookieTreeHostNode::TitleForUrl(const GURL& url) { 556 base::string16 CookieTreeHostNode::TitleForUrl(const GURL& url) {
557 const std::string file_origin_node_name( 557 const std::string file_origin_node_name(
558 std::string(chrome::kFileScheme) + content::kStandardSchemeSeparator); 558 std::string(content::kFileScheme) + content::kStandardSchemeSeparator);
559 return base::UTF8ToUTF16(url.SchemeIsFile() ? file_origin_node_name 559 return base::UTF8ToUTF16(url.SchemeIsFile() ? file_origin_node_name
560 : url.host()); 560 : url.host());
561 } 561 }
562 562
563 CookieTreeHostNode::CookieTreeHostNode(const GURL& url) 563 CookieTreeHostNode::CookieTreeHostNode(const GURL& url)
564 : CookieTreeNode(TitleForUrl(url)), 564 : CookieTreeNode(TitleForUrl(url)),
565 cookies_child_(NULL), 565 cookies_child_(NULL),
566 databases_child_(NULL), 566 databases_child_(NULL),
567 local_storages_child_(NULL), 567 local_storages_child_(NULL),
568 session_storages_child_(NULL), 568 session_storages_child_(NULL),
569 appcaches_child_(NULL), 569 appcaches_child_(NULL),
570 indexed_dbs_child_(NULL), 570 indexed_dbs_child_(NULL),
571 file_systems_child_(NULL), 571 file_systems_child_(NULL),
572 quota_child_(NULL), 572 quota_child_(NULL),
573 server_bound_certs_child_(NULL), 573 server_bound_certs_child_(NULL),
574 flash_lso_child_(NULL), 574 flash_lso_child_(NULL),
575 url_(url), 575 url_(url),
576 canonicalized_host_(CanonicalizeHost(url)) {} 576 canonicalized_host_(CanonicalizeHost(url)) {}
577 577
578 CookieTreeHostNode::~CookieTreeHostNode() {} 578 CookieTreeHostNode::~CookieTreeHostNode() {}
579 579
580 const std::string CookieTreeHostNode::GetHost() const { 580 const std::string CookieTreeHostNode::GetHost() const {
581 const std::string file_origin_node_name( 581 const std::string file_origin_node_name(
582 std::string(chrome::kFileScheme) + content::kStandardSchemeSeparator); 582 std::string(content::kFileScheme) + content::kStandardSchemeSeparator);
583 return url_.SchemeIsFile() ? file_origin_node_name : url_.host(); 583 return url_.SchemeIsFile() ? file_origin_node_name : url_.host();
584 } 584 }
585 585
586 CookieTreeNode::DetailedInfo CookieTreeHostNode::GetDetailedInfo() const { 586 CookieTreeNode::DetailedInfo CookieTreeHostNode::GetDetailedInfo() const {
587 return DetailedInfo().InitHost(); 587 return DetailedInfo().InitHost();
588 } 588 }
589 589
590 CookieTreeCookiesNode* CookieTreeHostNode::GetOrCreateCookiesNode() { 590 CookieTreeCookiesNode* CookieTreeHostNode::GetOrCreateCookiesNode() {
591 if (cookies_child_) 591 if (cookies_child_)
592 return cookies_child_; 592 return cookies_child_;
(...skipping 738 matching lines...) Expand 10 before | Expand all | Expand 10 after
1331 1331
1332 void CookiesTreeModel::NotifyObserverEndBatch() { 1332 void CookiesTreeModel::NotifyObserverEndBatch() {
1333 // Only notify the observers if this is the outermost call to EndBatch() if 1333 // Only notify the observers if this is the outermost call to EndBatch() if
1334 // called in a nested manner. 1334 // called in a nested manner.
1335 if (--batch_update_ == 0) { 1335 if (--batch_update_ == 0) {
1336 FOR_EACH_OBSERVER(Observer, 1336 FOR_EACH_OBSERVER(Observer,
1337 cookies_observer_list_, 1337 cookies_observer_list_,
1338 TreeModelEndBatch(this)); 1338 TreeModelEndBatch(this));
1339 } 1339 }
1340 } 1340 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698