Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(333)

Unified Diff: content/browser/transition_request_manager.cc

Issue 435833002: Navigation transitions: Plumb data from the outgoing renderer to the incoming renderer (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Review fixes Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..304106e9b1dad04e110291d9ea41a61333fdbe94 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,62 @@ 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.
Charlie Reis 2014/08/05 20:07:20 nit: We use TODO(username): in the Chrome repo.
oystein (OOO til 10th of July) 2014/08/05 20:50:53 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) {
+ int render_process_id,
+ int render_frame_id,
+ const GURL& request_url,
+ TransitionLayerData* transition_data) {
DCHECK_CURRENTLY_ON(BrowserThread::IO);
-
- std::pair<int, int> key(process_id, render_frame_id);
- return (pending_transition_frames_.find(key) !=
- pending_transition_frames_.end());
+ DCHECK(transition_data);
+ std::pair<int, int> key(render_process_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 render_process_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(render_process_id, render_frame_id);
+ pending_transition_frames_[key].AddEntry(origin, css_selector, markup);
+}
+
+void TransitionRequestManager::ClearPendingTransitionRequestData(
+ int render_process_id, int render_frame_id) {
+ DCHECK_CURRENTLY_ON(BrowserThread::IO);
+ std::pair<int, int> key(render_process_id, render_frame_id);
+ pending_transition_frames_.erase(key);
}
TransitionRequestManager::TransitionRequestManager() {

Powered by Google App Engine
This is Rietveld 408576698