1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #include "content/browser/cross_site_request_manager.h" 6 7 #include "base/memory/singleton.h" 8 9 namespace content { 10 11 bool CrossSiteRequestManager::HasPendingCrossSiteRequest(int renderer_id, 12 int render_view_id) { 13 base::AutoLock lock(lock_); 14 15 std::pair<int, int> key(renderer_id, render_view_id); 16 return pending_cross_site_views_.find(key) != 17 pending_cross_site_views_.end(); 18 } 19 20 void CrossSiteRequestManager::SetHasPendingCrossSiteRequest(int renderer_id, 21 int render_view_id, 22 bool has_pending) { 23 base::AutoLock lock(lock_); 24 25 std::pair<int, int> key(renderer_id, render_view_id); 26 if (has_pending) { 27 pending_cross_site_views_.insert(key); 28 } else { 29 pending_cross_site_views_.erase(key); 30 } 31 } 32 33 CrossSiteRequestManager::CrossSiteRequestManager() {} 34 35 CrossSiteRequestManager::~CrossSiteRequestManager() {} 36 37 // static 38 CrossSiteRequestManager* CrossSiteRequestManager::GetInstance() { 39 return Singleton<CrossSiteRequestManager>::get(); 40 } 41 42 } // namespace content 43