summaryrefslogtreecommitdiffstats
path: root/chrome/browser/cross_site_request_manager.cc
blob: d12e9a4192ad8d61477bd4bdef6eebc8e48331da (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// Copyright (c) 2006-2008 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.

#include "chrome/browser/cross_site_request_manager.h"

#include "base/singleton.h"

bool CrossSiteRequestManager::HasPendingCrossSiteRequest(int renderer_id,
                                                         int render_view_id) {
  AutoLock lock(lock_);

  std::pair<int, int> key(renderer_id, render_view_id);
  return pending_cross_site_views_.find(key) !=
      pending_cross_site_views_.end();
}

void CrossSiteRequestManager::SetHasPendingCrossSiteRequest(int renderer_id,
                                                            int render_view_id,
                                                            bool has_pending) {
  AutoLock lock(lock_);

  std::pair<int, int> key(renderer_id, render_view_id);
  if (has_pending) {
    pending_cross_site_views_.insert(key);
  } else {
    pending_cross_site_views_.erase(key);
  }
}

CrossSiteRequestManager::CrossSiteRequestManager() {}

CrossSiteRequestManager::~CrossSiteRequestManager() {}

// static
CrossSiteRequestManager* CrossSiteRequestManager::GetInstance() {
  return Singleton<CrossSiteRequestManager>::get();
}