OLD | NEW |
(Empty) | |
| 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. |
| 4 |
| 5 #ifndef CONTENT_BROWSER_TRANSITION_REQUEST_MANAGER_H_ |
| 6 #define CONTENT_BROWSER_TRANSITION_REQUEST_MANAGER_H_ |
| 7 |
| 8 #include <set> |
| 9 #include <utility> |
| 10 |
| 11 #include "base/basictypes.h" |
| 12 |
| 13 template <typename T> |
| 14 struct DefaultSingletonTraits; |
| 15 |
| 16 namespace content { |
| 17 |
| 18 // TransitionRequestManager is used to handle bookkeeping for transition |
| 19 // requests and responses. |
| 20 // |
| 21 // TransitionRequestManager is a singleton and should only be accessed on the IO |
| 22 // thread. |
| 23 // |
| 24 class TransitionRequestManager { |
| 25 public: |
| 26 // Returns the singleton instance. |
| 27 static TransitionRequestManager* GetInstance(); |
| 28 |
| 29 // Returns whether the RenderFrameHost specified by the given IDs currently |
| 30 // has a pending transition request. If so, we will have to delay the |
| 31 // response until the embedder resumes the request. |
| 32 bool HasPendingTransitionRequest(int process_id, int render_frame_id); |
| 33 |
| 34 // Sets whether the RenderFrameHost specified by the given IDs currently has a |
| 35 // pending transition request. |
| 36 void SetHasPendingTransitionRequest(int process_id, |
| 37 int render_frame_id, |
| 38 bool has_pending); |
| 39 |
| 40 private: |
| 41 friend struct DefaultSingletonTraits<TransitionRequestManager>; |
| 42 typedef std::set<std::pair<int, int> > RenderFrameSet; |
| 43 |
| 44 TransitionRequestManager(); |
| 45 ~TransitionRequestManager(); |
| 46 |
| 47 // Set of (render_process_host_id, render_frame_id) pairs of all |
| 48 // RenderFrameHosts that have pending transition requests. Used to pass |
| 49 // information to the CrossSiteResourceHandler without doing a round-trip |
| 50 // between IO->UI->IO threads. |
| 51 RenderFrameSet pending_transition_frames_; |
| 52 |
| 53 DISALLOW_COPY_AND_ASSIGN(TransitionRequestManager); |
| 54 }; |
| 55 |
| 56 } // namespace content |
| 57 |
| 58 #endif // CONTENT_BROWSER_TRANSITION_REQUEST_MANAGER_H_ |
OLD | NEW |