1 // Copyright 2014 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.
5 #ifndef CONTENT_BROWSER_TRANSITION_REQUEST_MANAGER_H_
6 #define CONTENT_BROWSER_TRANSITION_REQUEST_MANAGER_H_
11 #include "base/basictypes.h"
12 #include "content/common/content_export.h"
15 struct DefaultSingletonTraits
;
19 // TransitionRequestManager is used to handle bookkeeping for transition
20 // requests and responses.
22 // TransitionRequestManager is a singleton and should only be accessed on the IO
25 class TransitionRequestManager
{
27 // Returns the singleton instance.
28 CONTENT_EXPORT
static TransitionRequestManager
* GetInstance();
30 // Returns whether the RenderFrameHost specified by the given IDs currently
31 // has a pending transition request. If so, we will have to delay the
32 // response until the embedder resumes the request.
33 bool HasPendingTransitionRequest(int process_id
, int render_frame_id
);
35 // Sets whether the RenderFrameHost specified by the given IDs currently has a
36 // pending transition request.
37 CONTENT_EXPORT
void SetHasPendingTransitionRequest(int process_id
,
42 friend struct DefaultSingletonTraits
<TransitionRequestManager
>;
43 typedef std::set
<std::pair
<int, int> > RenderFrameSet
;
45 TransitionRequestManager();
46 ~TransitionRequestManager();
48 // Set of (render_process_host_id, render_frame_id) pairs of all
49 // RenderFrameHosts that have pending transition requests. Used to pass
50 // information to the CrossSiteResourceHandler without doing a round-trip
51 // between IO->UI->IO threads.
52 RenderFrameSet pending_transition_frames_
;
54 DISALLOW_COPY_AND_ASSIGN(TransitionRequestManager
);
57 } // namespace content
59 #endif // CONTENT_BROWSER_TRANSITION_REQUEST_MANAGER_H_