Index: content/browser/transition_request_manager.cc |
diff --git a/content/browser/transition_request_manager.cc b/content/browser/transition_request_manager.cc |
index 133dc3c5bea7fa8d2fb4c1c128770363168e9661..d15e1c5838272d14f864554d3d4f16de9ffccfa0 100644 |
--- a/content/browser/transition_request_manager.cc |
+++ b/content/browser/transition_request_manager.cc |
@@ -72,6 +72,12 @@ bool EnumerateLinkHeaders( |
namespace content { |
+TransitionLayerData::TransitionLayerData() { |
+} |
+ |
+TransitionLayerData::~TransitionLayerData() { |
+} |
+ |
void TransitionRequestManager::ParseTransitionStylesheetsFromHeaders( |
const scoped_refptr<net::HttpResponseHeaders>& headers, |
std::vector<GURL>& entering_stylesheets, |
@@ -93,28 +99,63 @@ void TransitionRequestManager::ParseTransitionStylesheetsFromHeaders( |
} |
} |
+TransitionRequestManager::TransitionRequestData::TransitionRequestData() { |
+} |
+ |
+TransitionRequestManager::TransitionRequestData::~TransitionRequestData() { |
+} |
+ |
+void TransitionRequestManager::TransitionRequestData::AddEntry( |
+ const std::string& origin, |
+ const std::string& css_selector, |
+ const std::string& markup) { |
+ allowed_entries_.push_back(AllowedEntry(origin, css_selector, markup)); |
+} |
+ |
+bool TransitionRequestManager::TransitionRequestData::FindEntry( |
+ const GURL& request_url, |
+ TransitionLayerData* transition_data) { |
+ DCHECK(!allowed_entries_.empty()); |
+ DCHECK(transition_data); |
+ // FIXME(oysteine): Add CSP check to validate the origin and the request_url. |
nasko
2014/08/04 13:36:48
Please add this check before committing the code.
oystein (OOO til 10th of July)
2014/08/05 19:02:48
I would really prefer if that could be done in a f
nasko
2014/08/06 10:58:48
Yes, adding a CHECK to ensure this code is not exe
oystein (OOO til 10th of July)
2014/08/06 22:36:19
Done.
|
+ const AllowedEntry& allowed_entry = allowed_entries_[0]; |
+ transition_data->markup = allowed_entry.markup; |
+ transition_data->css_selector = allowed_entry.css_selector; |
+ return true; |
+} |
+ |
bool TransitionRequestManager::HasPendingTransitionRequest( |
- int process_id, |
- int render_frame_id) { |
- DCHECK_CURRENTLY_ON(BrowserThread::IO); |
+ int renderer_id, |
+ int render_frame_id, |
+ const GURL& request_url, |
+ TransitionLayerData* transition_data) { |
nasko
2014/08/04 13:36:48
nit: no need for empty line
oystein (OOO til 10th of July)
2014/08/05 19:02:48
Done.
|
- std::pair<int, int> key(process_id, render_frame_id); |
- return (pending_transition_frames_.find(key) != |
- pending_transition_frames_.end()); |
+ DCHECK_CURRENTLY_ON(BrowserThread::IO); |
+ DCHECK(transition_data); |
nasko
2014/08/04 13:36:47
What happens in release builds if transition_data
oystein (OOO til 10th of July)
2014/08/05 19:02:48
We'll crash; it should never be NULL. Should this
nasko
2014/08/06 10:58:48
It should be a CHECK, if and only if a compromised
oystein (OOO til 10th of July)
2014/08/06 22:36:19
Done. Yeah if a renderer is compromised it could s
|
+ std::pair<int, int> key(renderer_id, render_frame_id); |
+ RenderFrameRequestDataMap::iterator iter = |
+ pending_transition_frames_.find(key); |
+ return iter != pending_transition_frames_.end() && |
+ iter->second.FindEntry(request_url, transition_data); |
} |
-void TransitionRequestManager::SetHasPendingTransitionRequest( |
- int process_id, |
+void TransitionRequestManager::AddPendingTransitionRequestData( |
+ int renderer_id, |
int render_frame_id, |
- bool has_pending) { |
+ const std::string& origin, |
+ const std::string& css_selector, |
+ const std::string& markup) { |
DCHECK_CURRENTLY_ON(BrowserThread::IO); |
- std::pair<int, int> key(process_id, render_frame_id); |
- if (has_pending) { |
- pending_transition_frames_.insert(key); |
- } else { |
- pending_transition_frames_.erase(key); |
- } |
+ std::pair<int, int> key(renderer_id, render_frame_id); |
+ pending_transition_frames_[key].AddEntry(origin, css_selector, markup); |
+} |
+ |
+void TransitionRequestManager::ClearPendingTransitionRequestData( |
+ int renderer_id, int render_frame_id) { |
+ DCHECK_CURRENTLY_ON(BrowserThread::IO); |
+ std::pair<int, int> key(renderer_id, render_frame_id); |
+ pending_transition_frames_.erase(key); |
} |
TransitionRequestManager::TransitionRequestManager() { |