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

Side by Side Diff: webkit/dom_storage/dom_storage_host.cc

Issue 10413018: Add the HasAreaOpen method to DomStorageHost. Intended for use to make event propagation less chatt… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 7 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
« no previous file with comments | « webkit/dom_storage/dom_storage_host.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "webkit/dom_storage/dom_storage_host.h" 5 #include "webkit/dom_storage/dom_storage_host.h"
6 6
7 #include "googleurl/src/gurl.h" 7 #include "googleurl/src/gurl.h"
8 #include "webkit/dom_storage/dom_storage_area.h" 8 #include "webkit/dom_storage/dom_storage_area.h"
9 #include "webkit/dom_storage/dom_storage_context.h" 9 #include "webkit/dom_storage/dom_storage_context.h"
10 #include "webkit/dom_storage/dom_storage_namespace.h" 10 #include "webkit/dom_storage/dom_storage_namespace.h"
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 bool DomStorageHost::ClearArea(int connection_id, const GURL& page_url) { 108 bool DomStorageHost::ClearArea(int connection_id, const GURL& page_url) {
109 DomStorageArea* area = GetOpenArea(connection_id); 109 DomStorageArea* area = GetOpenArea(connection_id);
110 if (!area) 110 if (!area)
111 return false; 111 return false;
112 if (!area->Clear()) 112 if (!area->Clear())
113 return false; 113 return false;
114 context_->NotifyAreaCleared(area, page_url); 114 context_->NotifyAreaCleared(area, page_url);
115 return true; 115 return true;
116 } 116 }
117 117
118 bool DomStorageHost::HasAreaOpen(
119 int namespace_id, const GURL& origin) const {
120 AreaMap::const_iterator it = connections_.begin();
121 for (; it != connections_.end(); ++it) {
122 if (namespace_id == it->second.namespace_->namespace_id() &&
123 origin == it->second.area_->origin()) {
124 return true;
125 }
126 }
127 return false;
128 }
129
118 DomStorageArea* DomStorageHost::GetOpenArea(int connection_id) { 130 DomStorageArea* DomStorageHost::GetOpenArea(int connection_id) {
119 AreaMap::iterator found = connections_.find(connection_id); 131 AreaMap::iterator found = connections_.find(connection_id);
120 if (found == connections_.end()) 132 if (found == connections_.end())
121 return NULL; 133 return NULL;
122 return found->second.area_; 134 return found->second.area_;
123 } 135 }
124 136
125 // NamespaceAndArea 137 // NamespaceAndArea
126 138
127 DomStorageHost::NamespaceAndArea::NamespaceAndArea() {} 139 DomStorageHost::NamespaceAndArea::NamespaceAndArea() {}
128 DomStorageHost::NamespaceAndArea::~NamespaceAndArea() {} 140 DomStorageHost::NamespaceAndArea::~NamespaceAndArea() {}
129 141
130 } // namespace dom_storage 142 } // namespace dom_storage
OLDNEW
« no previous file with comments | « webkit/dom_storage/dom_storage_host.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698