diff options
author | nasko@chromium.org <nasko@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-12-13 01:57:36 +0000 |
---|---|---|
committer | nasko@chromium.org <nasko@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-12-13 01:57:36 +0000 |
commit | dc97e7509bb873ec405b4e6310ec17372f18ca0f (patch) | |
tree | 735186176554ba72370e4f02bb5c92d535d3dcf5 | |
parent | 504bf9c23553b47cb482826aaee272f30d95bab0 (diff) | |
download | chromium_src-dc97e7509bb873ec405b4e6310ec17372f18ca0f.zip chromium_src-dc97e7509bb873ec405b4e6310ec17372f18ca0f.tar.gz chromium_src-dc97e7509bb873ec405b4e6310ec17372f18ca0f.tar.bz2 |
Removing "Application Data" dialog related code.
This is removal of the code added in https://chromiumcodereview.appspot.com/10636019
BUG=159507
Review URL: https://chromiumcodereview.appspot.com/11469032
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@172770 0039d316-1c4b-4281-b951-d872f2087c98
19 files changed, 95 insertions, 469 deletions
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd index 595ecb9..a8e71cc 100644 --- a/chrome/app/generated_resources.grd +++ b/chrome/app/generated_resources.grd @@ -8507,9 +8507,6 @@ The following plug-in is unresponsive: <ph name="PLUGIN_NAME">$1 <message name="IDS_COOKIES_SHOW_COOKIES_BUTTON" desc="A button in the Content Settings dialog for showing cookies and other stored site data."> All cookies and site data... </message> - <message name="IDS_COOKIES_SHOW_APP_COOKIES_BUTTON" desc="A button in the Content Settings dialog for showing apps cookies and other stored data."> - Application data... - </message> <message name="IDS_HANDLERS_MANAGE" desc="The label on the button that launches the exceptions management page for a given content type"> Manage handlers... </message> @@ -11141,9 +11138,6 @@ experiment id: "<ph name="EXPERIMENT_ID">$5<ex>ar1</ex></ph>" <message name="IDS_COOKIES_WEBSITE_PERMISSIONS_WINDOW_TITLE" desc="The title of the redesigned Cookies Window that lets you manage cookies, storage quota for websites and other permissions per-website"> Cookies and site data </message> - <message name="IDS_APP_COOKIES_WEBSITE_PERMISSIONS_WINDOW_TITLE" desc="The title of the redesigned Cookies Window that lets you manage cookies, storage quota for websites and other permissions per-website, for each isolated app"> - App cookies and data - </message> <message name="IDS_COOKIES_SEARCH_COOKIES" desc="Placeholder text shown in the search box in the Cookies Window"> Search cookies </message> diff --git a/chrome/browser/browsing_data/cookies_tree_model.cc b/chrome/browser/browsing_data/cookies_tree_model.cc index ba0e7ad..f4ece7c 100644 --- a/chrome/browser/browsing_data/cookies_tree_model.cc +++ b/chrome/browser/browsing_data/cookies_tree_model.cc @@ -53,10 +53,6 @@ struct HostNodeComparator { const CookieTreeHostNode* rtn = static_cast<const CookieTreeHostNode*>(rhs); - if (ltn->app_id() != rtn->app_id()) { - return (ltn->app_name() < rtn->app_name()); - } - // We want to order by registry controlled domain, so we would get // google.com, ad.google.com, www.google.com, // microsoft.com, ad.microsoft.com. CanonicalizeHost transforms the origins @@ -149,7 +145,7 @@ LocalDataContainer* GetLocalDataContainerForNode(CookieTreeNode* node) { node->parent()->parent()); CHECK_EQ(host->GetDetailedInfo().node_type, CookieTreeNode::DetailedInfo::TYPE_HOST); - return node->GetModel()->GetLocalDataContainer(host->app_id()); + return node->GetModel()->data_container(); } } // namespace @@ -175,12 +171,8 @@ CookieTreeNode::DetailedInfo& CookieTreeNode::DetailedInfo::Init( return *this; } -CookieTreeNode::DetailedInfo& CookieTreeNode::DetailedInfo::InitHost( - const std::string& app_id, - const std::string& app_name) { +CookieTreeNode::DetailedInfo& CookieTreeNode::DetailedInfo::InitHost() { Init(TYPE_HOST); - this->app_name = app_name; - this->app_id = app_id; return *this; } @@ -478,9 +470,7 @@ CookieTreeQuotaNode::~CookieTreeQuotaNode() {} void CookieTreeQuotaNode::DeleteStoredObjects() { // Calling this function may cause unexpected over-quota state of origin. // However, it'll caused no problem, just prevent usage growth of the origin. - CookieTreeHostNode* app = static_cast<CookieTreeHostNode*>(parent()); - LocalDataContainer* container = GetModel()->GetLocalDataContainer( - app->app_id()); + LocalDataContainer* container = GetModel()->data_container(); if (container) { container->quota_helper_->RevokeHostQuota(quota_info_->host); @@ -528,18 +518,16 @@ CookieTreeRootNode::CookieTreeRootNode(CookiesTreeModel* model) CookieTreeRootNode::~CookieTreeRootNode() {} CookieTreeHostNode* CookieTreeRootNode::GetOrCreateHostNode( - const GURL& url, - const std::string& app_id, - const std::string& app_name) { + const GURL& url) { scoped_ptr<CookieTreeHostNode> host_node( - new CookieTreeHostNode(url, app_id, app_name)); + new CookieTreeHostNode(url)); // First see if there is an existing match. std::vector<CookieTreeNode*>::iterator host_node_iterator = std::lower_bound(children().begin(), children().end(), host_node.get(), HostNodeComparator()); if (host_node_iterator != children().end() && - CookieTreeHostNode::TitleForUrl(url, app_id, app_name) == + CookieTreeHostNode::TitleForUrl(url) == (*host_node_iterator)->GetTitle()) return static_cast<CookieTreeHostNode*>(*host_node_iterator); // Node doesn't exist, insert the new one into the (ordered) children. @@ -562,25 +550,14 @@ CookieTreeNode::DetailedInfo CookieTreeRootNode::GetDetailedInfo() const { // static string16 CookieTreeHostNode::TitleForUrl( - const GURL& url, - const std::string& app_id, - const std::string& app_name) { - std::string title; + const GURL& url) { const std::string file_origin_node_name( std::string(chrome::kFileScheme) + content::kStandardSchemeSeparator); - // Only prepend the app name, if the app id is not an empty string. - if (!app_id.empty()) { - title = app_name; - title.append(", "); - } - title.append(url.SchemeIsFile() ? file_origin_node_name : url.host()); - return UTF8ToUTF16(title); + return UTF8ToUTF16(url.SchemeIsFile() ? file_origin_node_name : url.host()); } -CookieTreeHostNode::CookieTreeHostNode(const GURL& url, - const std::string& app_id, - const std::string& name) - : CookieTreeNode(TitleForUrl(url, app_id, name)), +CookieTreeHostNode::CookieTreeHostNode(const GURL& url) + : CookieTreeNode(TitleForUrl(url)), cookies_child_(NULL), databases_child_(NULL), local_storages_child_(NULL), @@ -591,8 +568,6 @@ CookieTreeHostNode::CookieTreeHostNode(const GURL& url, quota_child_(NULL), server_bound_certs_child_(NULL), flash_lso_child_(NULL), - app_id_(app_id), - app_name_(name), url_(url), canonicalized_host_(CanonicalizeHost(url)) {} @@ -605,7 +580,7 @@ const std::string CookieTreeHostNode::GetHost() const { } CookieTreeNode::DetailedInfo CookieTreeHostNode::GetDetailedInfo() const { - return DetailedInfo().InitHost(app_id_, app_name_); + return DetailedInfo().InitHost(); } CookieTreeCookiesNode* CookieTreeHostNode::GetOrCreateCookiesNode() { @@ -845,8 +820,7 @@ void CookieTreeFlashLSONode::DeleteStoredObjects() { CookieTreeHostNode* host = static_cast<CookieTreeHostNode*>(parent()); CHECK_EQ(host->GetDetailedInfo().node_type, CookieTreeNode::DetailedInfo::TYPE_HOST); - LocalDataContainer* container = - GetModel()->GetLocalDataContainer(host->app_id()); + LocalDataContainer* container = GetModel()->data_container(); CHECK(container); container->flash_lso_helper_->DeleteFlashLSOsForSite(domain_); @@ -880,23 +854,19 @@ void CookiesTreeModel::ScopedBatchUpdateNotifier::StartBatchUpdate() { /////////////////////////////////////////////////////////////////////////////// // CookiesTreeModel, public: CookiesTreeModel::CookiesTreeModel( - const ContainerMap& apps_map, + LocalDataContainer* data_container, ExtensionSpecialStoragePolicy* special_storage_policy, bool group_by_cookie_source) : ALLOW_THIS_IN_INITIALIZER_LIST(ui::TreeNodeModel<CookieTreeNode>( new CookieTreeRootNode(this))), - app_data_map_(apps_map), + data_container_(data_container), special_storage_policy_(special_storage_policy), group_by_cookie_source_(group_by_cookie_source), batch_update_(0) { - for (ContainerMap::const_iterator it = apps_map.begin(); - it != apps_map.end(); ++it) { - it->second->Init(this); - } + data_container_->Init(this); } CookiesTreeModel::~CookiesTreeModel() { - STLDeleteValues(&app_data_map_); } /////////////////////////////////////////////////////////////////////////////// @@ -975,20 +945,15 @@ void CookiesTreeModel::UpdateSearchResults(const string16& filter) { for (int i = num_children - 1; i >= 0; --i) delete Remove(root, root->GetChild(i)); - for (ContainerMap::iterator app_iterator = app_data_map_.begin(); - app_iterator != app_data_map_.end(); ++app_iterator ) { - LocalDataContainer* container = app_iterator->second; - - PopulateCookieInfoWithFilter(container, ¬ifier, filter); - PopulateDatabaseInfoWithFilter(container, ¬ifier, filter); - PopulateLocalStorageInfoWithFilter(container, ¬ifier, filter); - PopulateSessionStorageInfoWithFilter(container, ¬ifier, filter); - PopulateAppCacheInfoWithFilter(container, ¬ifier, filter); - PopulateIndexedDBInfoWithFilter(container, ¬ifier, filter); - PopulateFileSystemInfoWithFilter(container, ¬ifier, filter); - PopulateQuotaInfoWithFilter(container, ¬ifier, filter); - PopulateServerBoundCertInfoWithFilter(container, ¬ifier, filter); - } + PopulateCookieInfoWithFilter(data_container(), ¬ifier, filter); + PopulateDatabaseInfoWithFilter(data_container(), ¬ifier, filter); + PopulateLocalStorageInfoWithFilter(data_container(), ¬ifier, filter); + PopulateSessionStorageInfoWithFilter(data_container(), ¬ifier, filter); + PopulateAppCacheInfoWithFilter(data_container(), ¬ifier, filter); + PopulateIndexedDBInfoWithFilter(data_container(), ¬ifier, filter); + PopulateFileSystemInfoWithFilter(data_container(), ¬ifier, filter); + PopulateQuotaInfoWithFilter(data_container(), ¬ifier, filter); + PopulateServerBoundCertInfoWithFilter(data_container(), ¬ifier, filter); } const ExtensionSet* CookiesTreeModel::ExtensionsProtectingNode( @@ -1087,9 +1052,7 @@ void CookiesTreeModel::PopulateAppCacheInfoWithFilter( string16 host_node_name = UTF8ToUTF16(origin->first.host()); if (filter.empty() || (host_node_name.find(filter) != string16::npos)) { - CookieTreeHostNode* host_node = - root->GetOrCreateHostNode(origin->first, container->app_id(), - container->app_name()); + CookieTreeHostNode* host_node = root->GetOrCreateHostNode(origin->first); CookieTreeAppCachesNode* appcaches_node = host_node->GetOrCreateAppCachesNode(); @@ -1124,11 +1087,9 @@ void CookiesTreeModel::PopulateCookieInfoWithFilter( GURL source(source_string); if (!filter.size() || - (CookieTreeHostNode::TitleForUrl(source, container->app_id(), - container->app_name()).find(filter) != string16::npos)) { - CookieTreeHostNode* host_node = - root->GetOrCreateHostNode(source, container->app_id(), - container->app_name()); + (CookieTreeHostNode::TitleForUrl(source).find(filter) != + string16::npos)) { + CookieTreeHostNode* host_node = root->GetOrCreateHostNode(source); CookieTreeCookiesNode* cookies_node = host_node->GetOrCreateCookiesNode(); CookieTreeCookieNode* new_cookie = new CookieTreeCookieNode(it); @@ -1154,11 +1115,9 @@ void CookiesTreeModel::PopulateDatabaseInfoWithFilter( GURL origin(database_info->origin); if (!filter.size() || - (CookieTreeHostNode::TitleForUrl(origin, container->app_id(), - container->app_name()).find(filter) != string16::npos)) { - CookieTreeHostNode* host_node = - root->GetOrCreateHostNode(origin, container->app_id(), - container->app_name()); + (CookieTreeHostNode::TitleForUrl(origin).find(filter) != + string16::npos)) { + CookieTreeHostNode* host_node = root->GetOrCreateHostNode(origin); CookieTreeDatabasesNode* databases_node = host_node->GetOrCreateDatabasesNode(); databases_node->AddDatabaseNode( @@ -1184,11 +1143,9 @@ void CookiesTreeModel::PopulateLocalStorageInfoWithFilter( const GURL& origin(local_storage_info->origin_url); if (!filter.size() || - (CookieTreeHostNode::TitleForUrl(origin, container->app_id(), - container->app_name()).find(filter) != std::string::npos)) { - CookieTreeHostNode* host_node = - root->GetOrCreateHostNode(origin, container->app_id(), - container->app_name()); + (CookieTreeHostNode::TitleForUrl(origin).find(filter) != + std::string::npos)) { + CookieTreeHostNode* host_node = root->GetOrCreateHostNode(origin); CookieTreeLocalStoragesNode* local_storages_node = host_node->GetOrCreateLocalStoragesNode(); local_storages_node->AddLocalStorageNode( @@ -1214,11 +1171,9 @@ void CookiesTreeModel::PopulateSessionStorageInfoWithFilter( const GURL& origin = session_storage_info->origin_url; if (!filter.size() || - (CookieTreeHostNode::TitleForUrl(origin, container->app_id(), - container->app_name()).find(filter) != string16::npos)) { - CookieTreeHostNode* host_node = - root->GetOrCreateHostNode(origin, container->app_id(), - container->app_name()); + (CookieTreeHostNode::TitleForUrl(origin).find(filter) != + string16::npos)) { + CookieTreeHostNode* host_node = root->GetOrCreateHostNode(origin); CookieTreeSessionStoragesNode* session_storages_node = host_node->GetOrCreateSessionStoragesNode(); session_storages_node->AddSessionStorageNode( @@ -1244,11 +1199,9 @@ void CookiesTreeModel::PopulateIndexedDBInfoWithFilter( const GURL& origin = indexed_db_info->origin; if (!filter.size() || - (CookieTreeHostNode::TitleForUrl(origin, container->app_id(), - container->app_name()).find(filter) != string16::npos)) { - CookieTreeHostNode* host_node = - root->GetOrCreateHostNode(origin, container->app_id(), - container->app_name()); + (CookieTreeHostNode::TitleForUrl(origin).find(filter) != + string16::npos)) { + CookieTreeHostNode* host_node = root->GetOrCreateHostNode(origin); CookieTreeIndexedDBsNode* indexed_dbs_node = host_node->GetOrCreateIndexedDBsNode(); indexed_dbs_node->AddIndexedDBNode( @@ -1279,14 +1232,9 @@ void CookiesTreeModel::PopulateServerBoundCertInfoWithFilter( content::kStandardSchemeSeparator + cert_info->server_identifier() + "/"); } - string16 title = CookieTreeHostNode::TitleForUrl(origin, - container->app_id(), - container->app_name()); - + string16 title = CookieTreeHostNode::TitleForUrl(origin); if (!filter.size() || title.find(filter) != string16::npos) { - CookieTreeHostNode* host_node = - root->GetOrCreateHostNode(origin, container->app_id(), - container->app_name()); + CookieTreeHostNode* host_node = root->GetOrCreateHostNode(origin); CookieTreeServerBoundCertsNode* server_bound_certs_node = host_node->GetOrCreateServerBoundCertsNode(); server_bound_certs_node->AddServerBoundCertNode( @@ -1312,11 +1260,9 @@ void CookiesTreeModel::PopulateFileSystemInfoWithFilter( GURL origin(file_system_info->origin); if (!filter.size() || - (CookieTreeHostNode::TitleForUrl(origin, container->app_id(), - container->app_name()).find(filter) != string16::npos)) { - CookieTreeHostNode* host_node = - root->GetOrCreateHostNode(origin, container->app_id(), - container->app_name()); + (CookieTreeHostNode::TitleForUrl(origin).find(filter) != + string16::npos)) { + CookieTreeHostNode* host_node = root->GetOrCreateHostNode(origin); CookieTreeFileSystemsNode* file_systems_node = host_node->GetOrCreateFileSystemsNode(); file_systems_node->AddFileSystemNode( @@ -1341,9 +1287,7 @@ void CookiesTreeModel::PopulateQuotaInfoWithFilter( if (!filter.size() || (UTF8ToUTF16(quota_info->host).find(filter) != string16::npos)) { CookieTreeHostNode* host_node = - root->GetOrCreateHostNode(GURL("http://" + quota_info->host), - container->app_id(), - container->app_name()); + root->GetOrCreateHostNode(GURL("http://" + quota_info->host)); host_node->UpdateOrCreateQuotaNode(quota_info); } } @@ -1366,9 +1310,7 @@ void CookiesTreeModel::PopulateFlashLSOInfoWithFilter( if (!filter_utf8.size() || it->find(filter_utf8) != std::string::npos) { // Create a fake origin for GetOrCreateHostNode(). GURL origin("http://" + *it); - CookieTreeHostNode* host_node = - root->GetOrCreateHostNode(origin, container->app_id(), - container->app_name()); + CookieTreeHostNode* host_node = root->GetOrCreateHostNode(origin); host_node->GetOrCreateFlashLSONode(*it); } } @@ -1392,9 +1334,3 @@ void CookiesTreeModel::NotifyObserverEndBatch() { TreeModelEndBatch(this)); } } - -LocalDataContainer* CookiesTreeModel::GetLocalDataContainer( - const std::string& app_id) { - LocalDataContainer* container = app_data_map_[app_id]; - return container; -} diff --git a/chrome/browser/browsing_data/cookies_tree_model.h b/chrome/browser/browsing_data/cookies_tree_model.h index c98ec07..76735f5 100644 --- a/chrome/browser/browsing_data/cookies_tree_model.h +++ b/chrome/browser/browsing_data/cookies_tree_model.h @@ -97,8 +97,7 @@ class CookieTreeNode : public ui::TreeNode<CookieTreeNode> { ~DetailedInfo(); DetailedInfo& Init(NodeType type); - DetailedInfo& InitHost(const std::string& app_id, - const std::string& app_name); + DetailedInfo& InitHost(); DetailedInfo& InitCookie(const net::CanonicalCookie* cookie); DetailedInfo& InitDatabase( const BrowsingDataDatabaseHelper::DatabaseInfo* database_info); @@ -120,8 +119,6 @@ class CookieTreeNode : public ui::TreeNode<CookieTreeNode> { const net::ServerBoundCertStore::ServerBoundCert* server_bound_cert); DetailedInfo& InitFlashLSO(const std::string& flash_lso_domain); - std::string app_name; - std::string app_id; NodeType node_type; GURL origin; const net::CanonicalCookie* cookie; @@ -167,9 +164,7 @@ class CookieTreeRootNode : public CookieTreeNode { explicit CookieTreeRootNode(CookiesTreeModel* model); virtual ~CookieTreeRootNode(); - CookieTreeHostNode* GetOrCreateHostNode(const GURL& url, - const std::string& app_id, - const std::string& app_name); + CookieTreeHostNode* GetOrCreateHostNode(const GURL& url); // CookieTreeNode methods: virtual CookiesTreeModel* GetModel() const OVERRIDE; @@ -185,13 +180,9 @@ class CookieTreeRootNode : public CookieTreeNode { class CookieTreeHostNode : public CookieTreeNode { public: // Returns the host node's title to use for a given URL. - static string16 TitleForUrl(const GURL& url, - const std::string& app_id, - const std::string& app_name); + static string16 TitleForUrl(const GURL& url); - explicit CookieTreeHostNode(const GURL& url, - const std::string& app_id, - const std::string& app_name); + explicit CookieTreeHostNode(const GURL& url); virtual ~CookieTreeHostNode(); // CookieTreeNode methods: @@ -220,8 +211,6 @@ class CookieTreeHostNode : public CookieTreeNode { // True if a content exception can be created for this origin. bool CanCreateContentException() const; - const std::string& app_id() const { return app_id_; } - const std::string& app_name() const { return app_name_; } const std::string GetHost() const; private: @@ -241,9 +230,6 @@ class CookieTreeHostNode : public CookieTreeNode { CookieTreeServerBoundCertsNode* server_bound_certs_child_; CookieTreeFlashLSONode* flash_lso_child_; - std::string app_id_; - std::string app_name_; - // The URL for which this node was initially created. GURL url_; @@ -598,7 +584,7 @@ class CookieTreeFlashLSONode : public CookieTreeNode { // CookiesTreeModel ----------------------------------------------------------- class CookiesTreeModel : public ui::TreeNodeModel<CookieTreeNode> { public: - CookiesTreeModel(const ContainerMap& apps_map, + CookiesTreeModel(LocalDataContainer* data_container, ExtensionSpecialStoragePolicy* special_storage_policy, bool group_by_cookie_source); virtual ~CookiesTreeModel(); @@ -679,7 +665,9 @@ class CookiesTreeModel : public ui::TreeNodeModel<CookieTreeNode> { void PopulateFlashLSOInfo(LocalDataContainer* container); BrowsingDataCookieHelper* GetCookieHelper(const std::string& app_id); - LocalDataContainer* GetLocalDataContainer(const std::string& app_id); + LocalDataContainer* data_container() { + return data_container_.get(); + } private: enum CookieIconIndex { @@ -725,7 +713,7 @@ class CookiesTreeModel : public ui::TreeNodeModel<CookieTreeNode> { // Map of app ids to LocalDataContainer objects to use when retrieving // locally stored data. - ContainerMap app_data_map_; + scoped_ptr<LocalDataContainer> data_container_; // The extension special storage policy; see ExtensionsProtectingNode() above. scoped_refptr<ExtensionSpecialStoragePolicy> special_storage_policy_; diff --git a/chrome/browser/browsing_data/cookies_tree_model_unittest.cc b/chrome/browser/browsing_data/cookies_tree_model_unittest.cc index a7123f4..7f725a0 100644 --- a/chrome/browser/browsing_data/cookies_tree_model_unittest.cc +++ b/chrome/browser/browsing_data/cookies_tree_model_unittest.cc @@ -74,12 +74,6 @@ class CookiesTreeModelTest : public testing::Test { mock_browsing_data_flash_lso_helper_ = new MockBrowsingDataFlashLSOHelper(profile_.get()); - // It is fine to reuse the profile request context for the app, since - // the mock cookie helper maintains its own list internally and doesn't - // really use the request context. Same is true for the rest. - mock_browsing_data_cookie_helper_app_ = - new MockBrowsingDataCookieHelper(profile_->GetRequestContext()); - scoped_refptr<CookieSettings> cookie_settings = new CookieSettings(profile_->GetHostContentSettingsMap(), profile_->GetPrefs()); @@ -100,12 +94,8 @@ class CookiesTreeModelTest : public testing::Test { message_loop_.RunUntilIdle(); } - scoped_ptr<CookiesTreeModel> CreateCookiesTreeModelWithInitialSample( - bool add_app) { - ContainerMap containers_map; - - containers_map[std::string()] = new LocalDataContainer( - "Drive-By-Web", std::string(), + scoped_ptr<CookiesTreeModel> CreateCookiesTreeModelWithInitialSample() { + LocalDataContainer* container = new LocalDataContainer( mock_browsing_data_cookie_helper_, mock_browsing_data_database_helper_, mock_browsing_data_local_storage_helper_, @@ -117,17 +107,8 @@ class CookiesTreeModelTest : public testing::Test { mock_browsing_data_server_bound_cert_helper_, mock_browsing_data_flash_lso_helper_); - if (add_app) { - std::string app_id = "some-random-id"; - // The cookie helper is mandatory, the rest can be NULL. - containers_map[app_id] = new LocalDataContainer( - "Isolated App", app_id, - mock_browsing_data_cookie_helper_app_, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - } - CookiesTreeModel* cookies_model = - new CookiesTreeModel(containers_map, + new CookiesTreeModel(container, special_storage_policy_, false); mock_browsing_data_cookie_helper_-> @@ -157,16 +138,6 @@ class CookiesTreeModelTest : public testing::Test { mock_browsing_data_flash_lso_helper_->AddFlashLSODomain("xyz.com"); mock_browsing_data_flash_lso_helper_->Notify(); - if (add_app) { - mock_browsing_data_cookie_helper_app_-> - AddCookieSamples(GURL("http://app-origin1"), "Z=1"); - mock_browsing_data_cookie_helper_app_-> - AddCookieSamples(GURL("http://app-origin2"), "Y=1"); - mock_browsing_data_cookie_helper_app_-> - AddCookieSamples(GURL("http://app-origin3"), "X=1"); - mock_browsing_data_cookie_helper_app_->Notify(); - } - { SCOPED_TRACE("Initial State 3 cookies, 2 databases, 2 local storages, " "2 session storages, 2 indexed DBs, 3 filesystems, " @@ -191,17 +162,8 @@ class CookiesTreeModelTest : public testing::Test { // sbc1 -> sbcerts -> sbc1, // sbc2 -> sbcerts -> sbc2. // xyz.com -> flash_lsos - if (!add_app) { - EXPECT_EQ(53, cookies_model->GetRoot()->GetTotalNodeCount()); - EXPECT_EQ("A,B,C", GetDisplayedCookies(cookies_model)); - } else { - // Once we add the app, we have 9 more nodes: - // app-origin1 -> cookies -> z, - // app-origin2 -> cookies -> y, - // app-origin3 -> cookies -> x, - EXPECT_EQ(62, cookies_model->GetRoot()->GetTotalNodeCount()); - EXPECT_EQ("A,B,C,Z,Y,X", GetDisplayedCookies(cookies_model)); - } + EXPECT_EQ(53, cookies_model->GetRoot()->GetTotalNodeCount()); + EXPECT_EQ("A,B,C", GetDisplayedCookies(cookies_model)); EXPECT_EQ("db1,db2", GetDisplayedDatabases(cookies_model)); EXPECT_EQ("http://host1:1/,http://host2:2/", GetDisplayedLocalStorages(cookies_model)); @@ -405,16 +367,12 @@ class CookiesTreeModelTest : public testing::Test { scoped_refptr<MockBrowsingDataFlashLSOHelper> mock_browsing_data_flash_lso_helper_; - // App helpers. - scoped_refptr<MockBrowsingDataCookieHelper> - mock_browsing_data_cookie_helper_app_; - scoped_refptr<ExtensionSpecialStoragePolicy> special_storage_policy_; }; TEST_F(CookiesTreeModelTest, RemoveAll) { scoped_ptr<CookiesTreeModel> cookies_model( - CreateCookiesTreeModelWithInitialSample(false)); + CreateCookiesTreeModelWithInitialSample()); // Reset the selection of the first row. { @@ -471,7 +429,7 @@ TEST_F(CookiesTreeModelTest, RemoveAll) { TEST_F(CookiesTreeModelTest, Remove) { scoped_ptr<CookiesTreeModel> cookies_model( - CreateCookiesTreeModelWithInitialSample(false)); + CreateCookiesTreeModelWithInitialSample()); // Children start out arranged as follows: // @@ -734,7 +692,7 @@ TEST_F(CookiesTreeModelTest, Remove) { TEST_F(CookiesTreeModelTest, RemoveCookiesNode) { scoped_ptr<CookiesTreeModel> cookies_model( - CreateCookiesTreeModelWithInitialSample(false)); + CreateCookiesTreeModelWithInitialSample()); DeleteStoredObjects( cookies_model->GetRoot()->GetChild(0)->GetChild(0)); @@ -798,7 +756,7 @@ TEST_F(CookiesTreeModelTest, RemoveCookiesNode) { TEST_F(CookiesTreeModelTest, RemoveCookieNode) { scoped_ptr<CookiesTreeModel> cookies_model( - CreateCookiesTreeModelWithInitialSample(false)); + CreateCookiesTreeModelWithInitialSample()); DeleteStoredObjects( cookies_model->GetRoot()->GetChild(1)->GetChild(0)); @@ -861,10 +819,7 @@ TEST_F(CookiesTreeModelTest, RemoveCookieNode) { } TEST_F(CookiesTreeModelTest, RemoveSingleCookieNode) { - ContainerMap container_map; - - container_map[std::string()] = new LocalDataContainer( - "Drive-By-Web", std::string(), + LocalDataContainer* container = new LocalDataContainer( mock_browsing_data_cookie_helper_, mock_browsing_data_database_helper_, mock_browsing_data_local_storage_helper_, @@ -875,7 +830,7 @@ TEST_F(CookiesTreeModelTest, RemoveSingleCookieNode) { mock_browsing_data_quota_helper_, mock_browsing_data_server_bound_cert_helper_, mock_browsing_data_flash_lso_helper_); - CookiesTreeModel cookies_model(container_map, special_storage_policy_, false); + CookiesTreeModel cookies_model(container, special_storage_policy_, false); mock_browsing_data_cookie_helper_-> AddCookieSamples(GURL("http://foo1"), "A=1"); @@ -952,10 +907,7 @@ TEST_F(CookiesTreeModelTest, RemoveSingleCookieNode) { } TEST_F(CookiesTreeModelTest, RemoveSingleCookieNodeOf3) { - ContainerMap container_map; - - container_map[std::string()] = new LocalDataContainer( - "Drive-By-Web", std::string(), + LocalDataContainer* container = new LocalDataContainer( mock_browsing_data_cookie_helper_, mock_browsing_data_database_helper_, mock_browsing_data_local_storage_helper_, @@ -966,7 +918,7 @@ TEST_F(CookiesTreeModelTest, RemoveSingleCookieNodeOf3) { mock_browsing_data_quota_helper_, mock_browsing_data_server_bound_cert_helper_, mock_browsing_data_flash_lso_helper_); - CookiesTreeModel cookies_model(container_map, special_storage_policy_,false); + CookiesTreeModel cookies_model(container, special_storage_policy_,false); mock_browsing_data_cookie_helper_-> AddCookieSamples(GURL("http://foo1"), "A=1"); @@ -1046,10 +998,7 @@ TEST_F(CookiesTreeModelTest, RemoveSingleCookieNodeOf3) { } TEST_F(CookiesTreeModelTest, RemoveSecondOrigin) { - ContainerMap container_map; - - container_map[std::string()] = new LocalDataContainer( - "Drive-By-Web", std::string(), + LocalDataContainer* container = new LocalDataContainer( mock_browsing_data_cookie_helper_, mock_browsing_data_database_helper_, mock_browsing_data_local_storage_helper_, @@ -1060,7 +1009,7 @@ TEST_F(CookiesTreeModelTest, RemoveSecondOrigin) { mock_browsing_data_quota_helper_, mock_browsing_data_server_bound_cert_helper_, mock_browsing_data_flash_lso_helper_); - CookiesTreeModel cookies_model(container_map, special_storage_policy_,false); + CookiesTreeModel cookies_model(container, special_storage_policy_,false); mock_browsing_data_cookie_helper_-> AddCookieSamples(GURL("http://foo1"), "A=1"); @@ -1091,10 +1040,7 @@ TEST_F(CookiesTreeModelTest, RemoveSecondOrigin) { } TEST_F(CookiesTreeModelTest, OriginOrdering) { - ContainerMap container_map; - - container_map[std::string()] = new LocalDataContainer( - "Drive-By-Web", std::string(), + LocalDataContainer* container = new LocalDataContainer( mock_browsing_data_cookie_helper_, mock_browsing_data_database_helper_, mock_browsing_data_local_storage_helper_, @@ -1105,7 +1051,7 @@ TEST_F(CookiesTreeModelTest, OriginOrdering) { mock_browsing_data_quota_helper_, mock_browsing_data_server_bound_cert_helper_, mock_browsing_data_flash_lso_helper_); - CookiesTreeModel cookies_model(container_map, special_storage_policy_, false); + CookiesTreeModel cookies_model(container, special_storage_policy_, false); mock_browsing_data_cookie_helper_-> AddCookieSamples(GURL("http://a.foo2.com"), "A=1"); @@ -1141,12 +1087,7 @@ TEST_F(CookiesTreeModelTest, OriginOrdering) { TEST_F(CookiesTreeModelTest, ContentSettings) { GURL host("http://xyz.com/"); - std::string name = "Drive-By-Web"; - std::string browser_id; - ContainerMap container_map; - - container_map[browser_id] = new LocalDataContainer( - name, browser_id, + LocalDataContainer* container = new LocalDataContainer( mock_browsing_data_cookie_helper_, mock_browsing_data_database_helper_, mock_browsing_data_local_storage_helper_, @@ -1157,7 +1098,7 @@ TEST_F(CookiesTreeModelTest, ContentSettings) { mock_browsing_data_quota_helper_, mock_browsing_data_server_bound_cert_helper_, mock_browsing_data_flash_lso_helper_); - CookiesTreeModel cookies_model(container_map, special_storage_policy_, false); + CookiesTreeModel cookies_model(container, special_storage_policy_, false); mock_browsing_data_cookie_helper_->AddCookieSamples(host, "A=1"); mock_browsing_data_cookie_helper_->Notify(); @@ -1172,7 +1113,7 @@ TEST_F(CookiesTreeModelTest, ContentSettings) { CookieTreeRootNode* root = static_cast<CookieTreeRootNode*>(cookies_model.GetRoot()); CookieTreeHostNode* origin = - root->GetOrCreateHostNode(host, browser_id, name); + root->GetOrCreateHostNode(host); EXPECT_EQ(1, origin->child_count()); EXPECT_TRUE(origin->CanCreateContentException()); @@ -1197,19 +1138,9 @@ TEST_F(CookiesTreeModelTest, ContentSettings) { EXPECT_TRUE(cookie_settings->IsCookieSessionOnly(host)); } -TEST_F(CookiesTreeModelTest, AppOriginTitle) { - scoped_ptr<CookiesTreeModel> cookies_model( - CreateCookiesTreeModelWithInitialSample(true)); - - EXPECT_EQ(ASCIIToUTF16("Isolated App, app-origin1"), - cookies_model->GetRoot()->GetChild(17)->GetTitle()); - EXPECT_EQ(ASCIIToUTF16("Isolated App, app-origin2"), - cookies_model->GetRoot()->GetChild(18)->GetTitle()); -} - TEST_F(CookiesTreeModelTest, FileSystemFilter) { scoped_ptr<CookiesTreeModel> cookies_model( - CreateCookiesTreeModelWithInitialSample(false)); + CreateCookiesTreeModelWithInitialSample()); cookies_model->UpdateSearchResults(ASCIIToUTF16("fshost1")); EXPECT_EQ("http://fshost1:1/", @@ -1229,10 +1160,7 @@ TEST_F(CookiesTreeModelTest, FileSystemFilter) { } TEST_F(CookiesTreeModelTest, CookiesFilter) { - ContainerMap container_map; - - container_map[std::string()] = new LocalDataContainer( - "Drive-By-Web", std::string(), + LocalDataContainer* container = new LocalDataContainer( mock_browsing_data_cookie_helper_, mock_browsing_data_database_helper_, mock_browsing_data_local_storage_helper_, @@ -1243,7 +1171,7 @@ TEST_F(CookiesTreeModelTest, CookiesFilter) { mock_browsing_data_quota_helper_, mock_browsing_data_server_bound_cert_helper_, mock_browsing_data_flash_lso_helper_); - CookiesTreeModel cookies_model(container_map, special_storage_policy_, false); + CookiesTreeModel cookies_model(container, special_storage_policy_, false); mock_browsing_data_cookie_helper_-> AddCookieSamples(GURL("http://123.com"), "A=1"); diff --git a/chrome/browser/browsing_data/local_data_container.cc b/chrome/browser/browsing_data/local_data_container.cc index ca0abfa..e645069 100644 --- a/chrome/browser/browsing_data/local_data_container.cc +++ b/chrome/browser/browsing_data/local_data_container.cc @@ -16,8 +16,6 @@ // LocalDataContainer, public: LocalDataContainer::LocalDataContainer( - const std::string& app_name, - const std::string& app_id, BrowsingDataCookieHelper* cookie_helper, BrowsingDataDatabaseHelper* database_helper, BrowsingDataLocalStorageHelper* local_storage_helper, @@ -28,9 +26,7 @@ LocalDataContainer::LocalDataContainer( BrowsingDataQuotaHelper* quota_helper, BrowsingDataServerBoundCertHelper* server_bound_cert_helper, BrowsingDataFlashLSOHelper* flash_lso_helper) - : app_name_(app_name), - app_id_(app_id), - appcache_helper_(appcache_helper), + : appcache_helper_(appcache_helper), cookie_helper_(cookie_helper), database_helper_(database_helper), local_storage_helper_(local_storage_helper), diff --git a/chrome/browser/browsing_data/local_data_container.h b/chrome/browser/browsing_data/local_data_container.h index b0b2fd7..0ad4512 100644 --- a/chrome/browser/browsing_data/local_data_container.h +++ b/chrome/browser/browsing_data/local_data_container.h @@ -34,7 +34,6 @@ class CanonicalCookie; // Friendly typedefs for the multiple types of lists used in the model. namespace { -typedef std::map<std::string, LocalDataContainer*> ContainerMap; typedef std::list<net::CanonicalCookie> CookieList; typedef std::list<BrowsingDataDatabaseHelper::DatabaseInfo> DatabaseInfoList; typedef std::list<BrowsingDataLocalStorageHelper::LocalStorageInfo> @@ -61,8 +60,6 @@ typedef std::vector<std::string> FlashLSODomainList; class LocalDataContainer { public: LocalDataContainer( - const std::string& app_name, - const std::string& app_id, BrowsingDataCookieHelper* cookie_helper, BrowsingDataDatabaseHelper* database_helper, BrowsingDataLocalStorageHelper* local_storage_helper, @@ -79,9 +76,6 @@ class LocalDataContainer { // The delegate passed in is called back to deliver the updates. void Init(CookiesTreeModel* delegate); - const std::string& app_name() { return app_name_; } - const std::string& app_id() { return app_id_; } - private: friend class CookiesTreeModel; friend class CookieTreeAppCacheNode; @@ -111,10 +105,6 @@ class LocalDataContainer { void OnServerBoundCertModelInfoLoaded(const ServerBoundCertList& cert_list); void OnFlashLSOInfoLoaded(const FlashLSODomainList& domains); - // The app name and id, to which this container object is for. - std::string app_name_; - std::string app_id_; - // Pointers to the helper objects, needed to retreive all the types of locally // stored data. scoped_refptr<BrowsingDataAppCacheHelper> appcache_helper_; diff --git a/chrome/browser/content_settings/local_shared_objects_container.cc b/chrome/browser/content_settings/local_shared_objects_container.cc index 05564de..2ec10fe 100644 --- a/chrome/browser/content_settings/local_shared_objects_container.cc +++ b/chrome/browser/content_settings/local_shared_objects_container.cc @@ -183,9 +183,7 @@ size_t LocalSharedObjectsContainer::GetObjectCountForDomain( scoped_ptr<CookiesTreeModel> LocalSharedObjectsContainer::CreateCookiesTreeModel() const { - ContainerMap apps_map; - apps_map[std::string()] = new LocalDataContainer( - std::string(), std::string(), + LocalDataContainer* container = new LocalDataContainer( cookies()->Clone(), databases()->Clone(), local_storages()->Clone(), @@ -197,5 +195,5 @@ LocalSharedObjectsContainer::CreateCookiesTreeModel() const { server_bound_certs()->Clone(), NULL); - return make_scoped_ptr(new CookiesTreeModel(apps_map, NULL, true)); + return make_scoped_ptr(new CookiesTreeModel(container, NULL, true)); } diff --git a/chrome/browser/resources/options/cookies_list.js b/chrome/browser/resources/options/cookies_list.js index 4904aed..f6d964c 100644 --- a/chrome/browser/resources/options/cookies_list.js +++ b/chrome/browser/resources/options/cookies_list.js @@ -146,11 +146,6 @@ cr.define('options', function() { this.infoChild.className = 'cookie-details'; this.infoChild.hidden = true; - if (this.origin.data.appId) { - this.siteChild.classList.add('app-cookie-site'); - this.itemsChild.classList.add('app-cookie-items'); - } - var remove = this.ownerDocument.createElement('button'); remove.textContent = loadTimeData.getString('remove_cookie'); remove.onclick = this.removeCookie_.bind(this); diff --git a/chrome/browser/resources/options/cookies_view.css b/chrome/browser/resources/options/cookies_view.css index 99d24e8..ab7a62c 100644 --- a/chrome/browser/resources/options/cookies_view.css +++ b/chrome/browser/resources/options/cookies_view.css @@ -196,17 +196,3 @@ list.cookie-list > .deletable-item[selected] .cookie-details { .cookie-details-value { word-wrap: break-word; } - - -/* Styles specific to the app cookies window */ -#app-cookies-site-column { - width: 20em; -} - -.app-cookie-site { - width: 20em; -} - -.app-cookie-items { - -webkit-margin-start: 20em; -} diff --git a/chrome/browser/resources/options/cookies_view.js b/chrome/browser/resources/options/cookies_view.js index f42b1f5..fec6311 100644 --- a/chrome/browser/resources/options/cookies_view.js +++ b/chrome/browser/resources/options/cookies_view.js @@ -99,10 +99,6 @@ cr.define('options', function() { if (!this.visible) return; - // Inform the CookiesViewHandler whether we are operating in regular - // cookies dialog or the apps one. - chrome.send('setViewContext', [this.isAppContext()]); - chrome.send('reloadCookies'); if (!this.initialized_) { @@ -114,10 +110,6 @@ cr.define('options', function() { this.pageDiv.querySelector('.cookies-search-box').focus(); }, - - isAppContext: function() { - return false; - }, }; // CookiesViewHandler callbacks. diff --git a/chrome/browser/resources/options/cookies_view_app.html b/chrome/browser/resources/options/cookies_view_app.html deleted file mode 100644 index d28e8be..0000000 --- a/chrome/browser/resources/options/cookies_view_app.html +++ /dev/null @@ -1,26 +0,0 @@ -<div id="app-cookies-view-page" class="page cookies-view-page" hidden> - <div class="close-button"></div> - <h1 i18n-content="appCookiesViewPage"></h1> - <div class="content-area cookies-list-content-area"> - <div class="cookies-column-headers"> - <div id="app-cookies-site-column" class="cookies-site-column"> - <h3 i18n-content="cookie_domain"></h3> - </div> - <div class="cookies-data-column"> - <h3 i18n-content="cookie_local_data"></h3> - </div> - <div class="cookies-header-controls"> - <button class="remove-all-cookies-button" - i18n-content="remove_all_cookie"></button> - <input class="cookies-search-box" type="search" - i18n-values="placeholder:search_cookies" incremental> - </div> - </div> - <list id="app-cookies-list" class="cookies-list"></list> - </div> - <div class="action-area"> - <div class="button-strip"> - <button class="cookies-view-overlay-confirm" i18n-content="done"></button> - </div> - </div> -</div> diff --git a/chrome/browser/resources/options/cookies_view_app.js b/chrome/browser/resources/options/cookies_view_app.js deleted file mode 100644 index b9ee641..0000000 --- a/chrome/browser/resources/options/cookies_view_app.js +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) 2012 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. - -cr.define('options', function() { - - ///////////////////////////////////////////////////////////////////////////// - // CookiesViewApp class: - - /** - * Encapsulated handling of app cookies and other data page. It - * derives from the regular CookiesView. - * @constructor - */ - function CookiesViewApp(model) { - options.OptionsPage.call(this, 'app-cookies', - loadTimeData.getString('cookiesViewPageTabTitle'), - 'app-cookies-view-page'); - } - - cr.addSingletonGetter(CookiesViewApp); - - CookiesViewApp.prototype = { - __proto__: options.CookiesView.prototype, - - isAppContext: function() { - return true; - }, - }; - - // CookiesViewHandler callbacks. - CookiesViewApp.onTreeItemAdded = function(args) { - $('app-cookies-list').addByParentId(args[0], args[1], args[2]); - }; - - CookiesViewApp.onTreeItemRemoved = function(args) { - $('app-cookies-list').removeByParentId(args[0], args[1], args[2]); - }; - - CookiesViewApp.loadChildren = function(args) { - $('app-cookies-list').loadChildren(args[0], args[1]); - }; - - // Export - return { - CookiesViewApp: CookiesViewApp - }; -}); diff --git a/chrome/browser/resources/options/options.html b/chrome/browser/resources/options/options.html index 703c2de..ebe6910 100644 --- a/chrome/browser/resources/options/options.html +++ b/chrome/browser/resources/options/options.html @@ -125,7 +125,6 @@ <include src="autofill_edit_creditcard_overlay.html"> <include src="content_settings_exceptions_area.html"> <include src="cookies_view.html"> - <include src="cookies_view_app.html"> <include src="handler_options.html"> <include src="language_add_language_overlay.html"> <if expr="not is_macosx"> diff --git a/chrome/browser/resources/options/options.js b/chrome/browser/resources/options/options.js index 34906d5..a98ff65 100644 --- a/chrome/browser/resources/options/options.js +++ b/chrome/browser/resources/options/options.js @@ -13,7 +13,6 @@ var ConfirmDialog = options.ConfirmDialog; var ContentSettingsExceptionsArea = options.contentSettings.ContentSettingsExceptionsArea; var ContentSettings = options.ContentSettings; -var CookiesViewApp = options.CookiesViewApp; var CookiesView = options.CookiesView; var EditDictionaryOverlay = cr.IsMac ? null : options.EditDictionaryOverlay; var FactoryResetOverlay = options.FactoryResetOverlay; @@ -118,9 +117,6 @@ function load() { ContentSettings.getInstance(), [$('privacyContentSettingsButton'), $('show-cookies-button')]); - OptionsPage.registerOverlay(CookiesViewApp.getInstance(), - ContentSettings.getInstance(), - [$('privacyContentSettingsButton')]); if (!cr.isMac) { OptionsPage.registerOverlay(EditDictionaryOverlay.getInstance(), LanguageOptions.getInstance(), diff --git a/chrome/browser/resources/options/options_bundle.js b/chrome/browser/resources/options/options_bundle.js index e2c305f..7fab323 100644 --- a/chrome/browser/resources/options/options_bundle.js +++ b/chrome/browser/resources/options/options_bundle.js @@ -71,7 +71,6 @@ <include src="content_settings_ui.js"></include> <include src="cookies_list.js"></include> <include src="cookies_view.js"></include> -<include src="cookies_view_app.js"></include> <include src="factory_reset_overlay.js"></include> <include src="managed_user_settings.js"></include> <include src="font_settings.js"></include> diff --git a/chrome/browser/ui/webui/cookies_tree_model_util.cc b/chrome/browser/ui/webui/cookies_tree_model_util.cc index 06be300..ba0440e 100644 --- a/chrome/browser/ui/webui/cookies_tree_model_util.cc +++ b/chrome/browser/ui/webui/cookies_tree_model_util.cc @@ -26,8 +26,6 @@ const char kKeyIcon[] = "icon"; const char kKeyType[] = "type"; const char kKeyHasChildren[] = "hasChildren"; -const char kKeyAppId[] = "appId"; - const char kKeyAppsProtectingThis[] = "appsProtectingThis"; const char kKeyName[] = "name"; const char kKeyContent[] = "content"; @@ -98,7 +96,6 @@ bool CookiesTreeModelUtil::GetCookieTreeNodeDictionary( switch (node.GetDetailedInfo().node_type) { case CookieTreeNode::DetailedInfo::TYPE_HOST: { dict->SetString(kKeyType, "origin"); - dict->SetString(kKeyAppId, node.GetDetailedInfo().app_id); #if defined(OS_MACOSX) dict->SetString(kKeyIcon, "chrome://theme/IDR_BOOKMARK_BAR_FOLDER"); #endif diff --git a/chrome/browser/ui/webui/options/content_settings_handler.cc b/chrome/browser/ui/webui/options/content_settings_handler.cc index 185a194..799785e 100644 --- a/chrome/browser/ui/webui/options/content_settings_handler.cc +++ b/chrome/browser/ui/webui/options/content_settings_handler.cc @@ -350,7 +350,6 @@ void ContentSettingsHandler::GetLocalizedValues( { "cookies_clear_when_close", IDS_COOKIES_CLEAR_WHEN_CLOSE_CHKBOX }, { "cookies_lso_clear_when_close", IDS_COOKIES_LSO_CLEAR_WHEN_CLOSE_CHKBOX }, { "cookies_show_cookies", IDS_COOKIES_SHOW_COOKIES_BUTTON }, - { "cookies_show_app_cookies", IDS_COOKIES_SHOW_APP_COOKIES_BUTTON }, { "flash_storage_settings", IDS_FLASH_STORAGE_SETTINGS }, { "flash_storage_url", IDS_FLASH_STORAGE_URL }, // Image filter. diff --git a/chrome/browser/ui/webui/options/cookies_view_handler.cc b/chrome/browser/ui/webui/options/cookies_view_handler.cc index 254a1f5..a75e250 100644 --- a/chrome/browser/ui/webui/options/cookies_view_handler.cc +++ b/chrome/browser/ui/webui/options/cookies_view_handler.cc @@ -10,8 +10,6 @@ #include "base/bind_helpers.h" #include "base/utf_string_conversions.h" #include "base/values.h" -#include "chrome/common/extensions/extension.h" -#include "chrome/common/extensions/extension_set.h" #include "chrome/browser/browsing_data/browsing_data_appcache_helper.h" #include "chrome/browser/browsing_data/browsing_data_cookie_helper.h" #include "chrome/browser/browsing_data/browsing_data_database_helper.h" @@ -21,8 +19,6 @@ #include "chrome/browser/browsing_data/browsing_data_local_storage_helper.h" #include "chrome/browser/browsing_data/browsing_data_quota_helper.h" #include "chrome/browser/browsing_data/browsing_data_server_bound_cert_helper.h" -#include "chrome/browser/extensions/extension_service.h" -#include "chrome/browser/extensions/extension_system.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/webui/cookies_tree_model_util.h" #include "content/public/browser/browser_context.h" @@ -41,7 +37,6 @@ namespace options { CookiesViewHandler::CookiesViewHandler() : batch_update_(false), - app_context_(false), model_util_(new CookiesTreeModelUtil) { } @@ -109,8 +104,6 @@ void CookiesViewHandler::GetLocalizedValues( RegisterStrings(localized_strings, resources, arraysize(resources)); RegisterTitle(localized_strings, "cookiesViewPage", IDS_COOKIES_WEBSITE_PERMISSIONS_WINDOW_TITLE); - RegisterTitle(localized_strings, "appCookiesViewPage", - IDS_APP_COOKIES_WEBSITE_PERMISSIONS_WINDOW_TITLE); } void CookiesViewHandler::RegisterMessages() { @@ -126,9 +119,6 @@ void CookiesViewHandler::RegisterMessages() { web_ui()->RegisterMessageCallback("loadCookie", base::Bind(&CookiesViewHandler::LoadChildren, base::Unretained(this))); - web_ui()->RegisterMessageCallback("setViewContext", - base::Bind(&CookiesViewHandler::SetViewContext, - base::Unretained(this))); web_ui()->RegisterMessageCallback("reloadCookies", base::Bind(&CookiesViewHandler::ReloadCookies, base::Unretained(this))); @@ -146,8 +136,7 @@ void CookiesViewHandler::TreeNodesAdded(ui::TreeModel* model, CookieTreeNode* parent_node = tree_model->AsNode(parent); ListValue* children = new ListValue; - model_util_->GetChildNodeList(parent_node, start, count, - children); + model_util_->GetChildNodeList(parent_node, start, count, children); ListValue args; args.Append(parent == tree_model->GetRoot() ? @@ -155,8 +144,7 @@ void CookiesViewHandler::TreeNodesAdded(ui::TreeModel* model, new base::StringValue(model_util_->GetTreeNodeId(parent_node))); args.Append(new base::FundamentalValue(start)); args.Append(children); - web_ui()->CallJavascriptFunction( - GetCallback("onTreeItemAdded", tree_model), args); + web_ui()->CallJavascriptFunction("CookiesView.onTreeItemAdded", args); } void CookiesViewHandler::TreeNodesRemoved(ui::TreeModel* model, @@ -176,8 +164,7 @@ void CookiesViewHandler::TreeNodesRemoved(ui::TreeModel* model, tree_model->AsNode(parent)))); args.Append(new base::FundamentalValue(start)); args.Append(new base::FundamentalValue(count)); - web_ui()->CallJavascriptFunction( - GetCallback("onTreeItemRemoved", tree_model), args); + web_ui()->CallJavascriptFunction("CookiesView.onTreeItemRemoved", args); } void CookiesViewHandler::TreeModelBeginBatch(CookiesTreeModel* model) { @@ -193,17 +180,15 @@ void CookiesViewHandler::TreeModelEndBatch(CookiesTreeModel* model) { } void CookiesViewHandler::EnsureCookiesTreeModelCreated() { - if (!app_context_ && !cookies_tree_model_.get()) { + if (!cookies_tree_model_.get()) { Profile* profile = Profile::FromWebUI(web_ui()); - ContainerMap apps_map; content::StoragePartition* storage_partition = content::BrowserContext::GetDefaultStoragePartition(profile); content::IndexedDBContext* indexed_db_context = storage_partition->GetIndexedDBContext(); fileapi::FileSystemContext* file_system_context = storage_partition->GetFileSystemContext(); - apps_map[std::string()] = new LocalDataContainer( - "Site Data", std::string(), + LocalDataContainer* container = new LocalDataContainer( new BrowsingDataCookieHelper(profile->GetRequestContext()), new BrowsingDataDatabaseHelper(profile), new BrowsingDataLocalStorageHelper(profile), @@ -215,48 +200,11 @@ void CookiesViewHandler::EnsureCookiesTreeModelCreated() { BrowsingDataServerBoundCertHelper::Create(profile), BrowsingDataFlashLSOHelper::Create(profile)); cookies_tree_model_.reset( - new CookiesTreeModel(apps_map, + new CookiesTreeModel(container, profile->GetExtensionSpecialStoragePolicy(), false)); cookies_tree_model_->AddCookiesTreeObserver(this); } - - if (app_context_ && !app_cookies_tree_model_.get()) { - Profile* profile = Profile::FromWebUI(web_ui()); - ContainerMap apps_map; - const ExtensionService* service = profile->GetExtensionService(); - if (!service) - return; - - ExtensionProcessManager* process_manager = - extensions::ExtensionSystem::Get(profile)->process_manager(); - if (!process_manager) - return; - - const ExtensionSet* extensions = service->extensions(); - for (ExtensionSet::const_iterator it = extensions->begin(); - it != extensions->end(); ++it) { - if ((*it)->is_storage_isolated()) { - content::StoragePartition* storage_partition = - content::BrowserContext::GetStoragePartitionForSite(profile, - (*it)->url()); - net::URLRequestContextGetter* context_getter = - storage_partition->GetURLRequestContext(); - // TODO(nasko): When new types of storage are isolated, add the - // appropriate browsing data helper objects to the constructor. - // For now, just cookies are isolated, so other parameters are NULL. - apps_map[(*it)->id()] = new LocalDataContainer( - (*it)->name(), (*it)->id(), - new BrowsingDataCookieHelper(context_getter), - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - } - } - app_cookies_tree_model_.reset( - new CookiesTreeModel(apps_map, - profile->GetExtensionSpecialStoragePolicy(), - false)); - app_cookies_tree_model_->AddCookiesTreeObserver(this); - } } void CookiesViewHandler::UpdateSearchResults(const ListValue* args) { @@ -266,12 +214,12 @@ void CookiesViewHandler::UpdateSearchResults(const ListValue* args) { EnsureCookiesTreeModelCreated(); - GetTreeModel()->UpdateSearchResults(query); + cookies_tree_model_->UpdateSearchResults(query); } void CookiesViewHandler::RemoveAll(const ListValue* args) { EnsureCookiesTreeModelCreated(); - GetTreeModel()->DeleteAllStoredObjects(); + cookies_tree_model_->DeleteAllStoredObjects(); } void CookiesViewHandler::Remove(const ListValue* args) { @@ -282,9 +230,9 @@ void CookiesViewHandler::Remove(const ListValue* args) { EnsureCookiesTreeModelCreated(); const CookieTreeNode* node = model_util_->GetTreeNodeFromPath( - GetTreeModel()->GetRoot(), node_path); + cookies_tree_model_->GetRoot(), node_path); if (node) - GetTreeModel()->DeleteCookieNode(const_cast<CookieTreeNode*>(node)); + cookies_tree_model_->DeleteCookieNode(const_cast<CookieTreeNode*>(node)); } void CookiesViewHandler::LoadChildren(const ListValue* args) { @@ -295,7 +243,7 @@ void CookiesViewHandler::LoadChildren(const ListValue* args) { EnsureCookiesTreeModelCreated(); const CookieTreeNode* node = model_util_->GetTreeNodeFromPath( - GetTreeModel()->GetRoot(), node_path); + cookies_tree_model_->GetRoot(), node_path); if (node) SendChildren(node); } @@ -306,42 +254,18 @@ void CookiesViewHandler::SendChildren(const CookieTreeNode* parent) { children); ListValue args; - args.Append(parent == GetTreeModel()->GetRoot() ? + args.Append(parent == cookies_tree_model_->GetRoot() ? Value::CreateNullValue() : new base::StringValue(model_util_->GetTreeNodeId(parent))); args.Append(children); - web_ui()->CallJavascriptFunction( - GetCallback("loadChildren", GetTreeModel()), args); -} - -void CookiesViewHandler::SetViewContext(const base::ListValue* args) { - bool app_context = false; - if (args->GetBoolean(0, &app_context)) - app_context_ = app_context; + web_ui()->CallJavascriptFunction("CookiesView.loadChildren", args); } void CookiesViewHandler::ReloadCookies(const base::ListValue* args) { cookies_tree_model_.reset(); - app_cookies_tree_model_.reset(); EnsureCookiesTreeModelCreated(); } -CookiesTreeModel* CookiesViewHandler::GetTreeModel() { - CookiesTreeModel* model = app_context_ ? - app_cookies_tree_model_.get() : cookies_tree_model_.get(); - DCHECK(model); - return model; -} - -std::string CookiesViewHandler::GetCallback( - std::string method, CookiesTreeModel* model) { - std::string callback("CookiesView"); - - if (model == app_cookies_tree_model_) - callback.append("App"); - return callback.append(".").append(method); -} - } // namespace options diff --git a/chrome/browser/ui/webui/options/cookies_view_handler.h b/chrome/browser/ui/webui/options/cookies_view_handler.h index f4d539f..f902310 100644 --- a/chrome/browser/ui/webui/options/cookies_view_handler.h +++ b/chrome/browser/ui/webui/options/cookies_view_handler.h @@ -60,33 +60,16 @@ class CookiesViewHandler : public OptionsPageUIHandler, // update the WebUI. void SendChildren(const CookieTreeNode* parent); - // Set the context in which this view is used - regular cookies window or - // the apps cookies window. - void SetViewContext(const base::ListValue* args); - // Reloads the CookiesTreeModel and passes the nodes to // 'CookiesView.loadChildren' to update the WebUI. void ReloadCookies(const base::ListValue* args); - // Return the proper callback string, depending on whether the model is - // in regular cookies mode or apps cookies mode. - std::string GetCallback(std::string method, CookiesTreeModel* model); - - // Return the proper tree model, depending on the context in which the - // view operates. - CookiesTreeModel* GetTreeModel(); - // The Cookies Tree model scoped_ptr<CookiesTreeModel> cookies_tree_model_; - scoped_ptr<CookiesTreeModel> app_cookies_tree_model_; // Flag to indicate whether there is a batch update in progress. bool batch_update_; - // A flag to indicate which view is active - the apps dialog or the regular - // cookies one. This will cause different JavaScript functions to be called. - bool app_context_; - scoped_ptr<CookiesTreeModelUtil> model_util_; DISALLOW_COPY_AND_ASSIGN(CookiesViewHandler); |