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

Side by Side Diff: content/browser/transition_request_manager.cc

Issue 689123003: Revert of Navigation transitions (web to native app): Pass data after starting provisional load ... (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/transition_request_manager.h" 5 #include "content/browser/transition_request_manager.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/memory/singleton.h" 8 #include "base/memory/singleton.h"
9 #include "base/metrics/field_trial.h" 9 #include "base/metrics/field_trial.h"
10 #include "base/strings/string_split.h" 10 #include "base/strings/string_split.h"
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 TransitionLayerData::TransitionLayerData() { 79 TransitionLayerData::TransitionLayerData() {
80 } 80 }
81 81
82 TransitionLayerData::~TransitionLayerData() { 82 TransitionLayerData::~TransitionLayerData() {
83 } 83 }
84 84
85 TransitionRequestManager::TransitionRequestData::AllowedEntry::AllowedEntry( 85 TransitionRequestManager::TransitionRequestData::AllowedEntry::AllowedEntry(
86 const std::string& allowed_destination_host_pattern, 86 const std::string& allowed_destination_host_pattern,
87 const std::string& css_selector, 87 const std::string& css_selector,
88 const std::string& markup, 88 const std::string& markup,
89 const std::vector<TransitionElement>& elements) 89 const std::vector<std::string>& names,
90 const std::vector<gfx::Rect>& rects)
90 : allowed_destination_host_pattern(allowed_destination_host_pattern), 91 : allowed_destination_host_pattern(allowed_destination_host_pattern),
91 css_selector(css_selector), 92 css_selector(css_selector),
92 markup(markup), 93 markup(markup),
93 elements(elements) { 94 names(names),
95 rects(rects) {
94 } 96 }
95 97
96 TransitionRequestManager::TransitionRequestData::AllowedEntry::~AllowedEntry() { 98 TransitionRequestManager::TransitionRequestData::AllowedEntry::~AllowedEntry() {
97 } 99 }
98 100
99 void TransitionRequestManager::ParseTransitionStylesheetsFromHeaders( 101 void TransitionRequestManager::ParseTransitionStylesheetsFromHeaders(
100 const scoped_refptr<net::HttpResponseHeaders>& headers, 102 const scoped_refptr<net::HttpResponseHeaders>& headers,
101 std::vector<GURL>& entering_stylesheets, 103 std::vector<GURL>& entering_stylesheets,
102 const GURL& resolve_address) { 104 const GURL& resolve_address) {
103 if (headers.get() == NULL) 105 if (headers.get() == NULL)
(...skipping 16 matching lines...) Expand all
120 TransitionRequestManager::TransitionRequestData::TransitionRequestData() { 122 TransitionRequestManager::TransitionRequestData::TransitionRequestData() {
121 } 123 }
122 124
123 TransitionRequestManager::TransitionRequestData::~TransitionRequestData() { 125 TransitionRequestManager::TransitionRequestData::~TransitionRequestData() {
124 } 126 }
125 127
126 void TransitionRequestManager::TransitionRequestData::AddEntry( 128 void TransitionRequestManager::TransitionRequestData::AddEntry(
127 const std::string& allowed_destination_host_pattern, 129 const std::string& allowed_destination_host_pattern,
128 const std::string& css_selector, 130 const std::string& css_selector,
129 const std::string& markup, 131 const std::string& markup,
130 const std::vector<TransitionElement>& elements) { 132 const std::vector<std::string>& names,
133 const std::vector<gfx::Rect>& rects) {
131 allowed_entries_.push_back(AllowedEntry(allowed_destination_host_pattern, 134 allowed_entries_.push_back(AllowedEntry(allowed_destination_host_pattern,
132 css_selector, 135 css_selector,
133 markup, 136 markup,
134 elements)); 137 names,
138 rects));
135 } 139 }
136 140
137 bool TransitionRequestManager::TransitionRequestData::FindEntry( 141 bool TransitionRequestManager::TransitionRequestData::FindEntry(
138 const GURL& request_url, 142 const GURL& request_url,
139 TransitionLayerData* transition_data) { 143 TransitionLayerData* transition_data) {
140 DCHECK(!allowed_entries_.empty()); 144 DCHECK(!allowed_entries_.empty());
141 CHECK(transition_data); 145 CHECK(transition_data);
142 // TODO(oysteine): Add CSP check to validate the host pattern and the 146 // TODO(oysteine): Add CSP check to validate the host pattern and the
143 // request_url. Must be done before this feature is moved out from the flag. 147 // request_url. Must be done before this feature is moved out from the flag.
144 CHECK(CommandLine::ForCurrentProcess()->HasSwitch( 148 CHECK(CommandLine::ForCurrentProcess()->HasSwitch(
145 switches::kEnableExperimentalWebPlatformFeatures) || 149 switches::kEnableExperimentalWebPlatformFeatures) ||
146 base::FieldTrialList::FindFullName("NavigationTransitions") == 150 base::FieldTrialList::FindFullName("NavigationTransitions") ==
147 "Enabled"); 151 "Enabled");
148 152
149 const AllowedEntry& allowed_entry = allowed_entries_[0]; 153 const AllowedEntry& allowed_entry = allowed_entries_[0];
150 transition_data->markup = allowed_entry.markup; 154 transition_data->markup = allowed_entry.markup;
151 transition_data->css_selector = allowed_entry.css_selector; 155 transition_data->css_selector = allowed_entry.css_selector;
152 transition_data->elements = allowed_entry.elements; 156 transition_data->names = allowed_entry.names;
157 transition_data->rects = allowed_entry.rects;
153 return true; 158 return true;
154 } 159 }
155 160
156 bool TransitionRequestManager::GetPendingTransitionRequest( 161 bool TransitionRequestManager::HasPendingTransitionRequest(
157 int render_process_id, 162 int render_process_id,
158 int render_frame_id, 163 int render_frame_id,
159 const GURL& request_url, 164 const GURL& request_url,
160 TransitionLayerData* transition_data) { 165 TransitionLayerData* transition_data) {
161 DCHECK_CURRENTLY_ON(BrowserThread::IO); 166 DCHECK_CURRENTLY_ON(BrowserThread::IO);
162 DCHECK(transition_data); 167 DCHECK(transition_data);
163 std::pair<int, int> key(render_process_id, render_frame_id); 168 std::pair<int, int> key(render_process_id, render_frame_id);
164 RenderFrameRequestDataMap::iterator iter = 169 RenderFrameRequestDataMap::iterator iter =
165 pending_transition_frames_.find(key); 170 pending_transition_frames_.find(key);
166 return iter != pending_transition_frames_.end() && 171 return iter != pending_transition_frames_.end() &&
167 iter->second.FindEntry(request_url, transition_data); 172 iter->second.FindEntry(request_url, transition_data);
168 } 173 }
169 174
170 void TransitionRequestManager::AddPendingTransitionRequestData( 175 void TransitionRequestManager::AddPendingTransitionRequestData(
171 int render_process_id, 176 int render_process_id,
172 int render_frame_id, 177 int render_frame_id,
173 const std::string& allowed_destination_host_pattern, 178 const std::string& allowed_destination_host_pattern,
174 const std::string& css_selector, 179 const std::string& css_selector,
175 const std::string& markup, 180 const std::string& markup,
176 const std::vector<TransitionElement>& elements) { 181 const std::vector<std::string>& names,
182 const std::vector<gfx::Rect>& rects) {
177 DCHECK_CURRENTLY_ON(BrowserThread::IO); 183 DCHECK_CURRENTLY_ON(BrowserThread::IO);
178 184
179 std::pair<int, int> key(render_process_id, render_frame_id); 185 std::pair<int, int> key(render_process_id, render_frame_id);
180 pending_transition_frames_[key].AddEntry( 186 pending_transition_frames_[key].AddEntry(
181 allowed_destination_host_pattern, css_selector, markup, elements); 187 allowed_destination_host_pattern, css_selector, markup, names, rects);
182 } 188 }
183 189
184 void TransitionRequestManager::AddPendingTransitionRequestDataForTesting( 190 void TransitionRequestManager::AddPendingTransitionRequestDataForTesting(
185 int render_process_id, 191 int render_process_id,
186 int render_frame_id) { 192 int render_frame_id) {
187 DCHECK_CURRENTLY_ON(BrowserThread::IO); 193 DCHECK_CURRENTLY_ON(BrowserThread::IO);
188 194
189 std::pair<int, int> key(render_process_id, render_frame_id); 195 std::pair<int, int> key(render_process_id, render_frame_id);
190 pending_transition_frames_[key].AddEntry( 196 pending_transition_frames_[key].AddEntry(
191 "*", /* allowed_destination_host_pattern */ 197 "*", /* allowed_destination_host_pattern */
192 "", /* css_selector */ 198 "", /* css_selector */
193 "", /* markup */ 199 "", /* markup */
194 std::vector<TransitionElement>()); /* elements */ 200 std::vector<std::string>(), /* names */
201 std::vector<gfx::Rect>()); /* rects */
195 } 202 }
196 203
197 void TransitionRequestManager::ClearPendingTransitionRequestData( 204 void TransitionRequestManager::ClearPendingTransitionRequestData(
198 int render_process_id, int render_frame_id) { 205 int render_process_id, int render_frame_id) {
199 DCHECK_CURRENTLY_ON(BrowserThread::IO); 206 DCHECK_CURRENTLY_ON(BrowserThread::IO);
200 std::pair<int, int> key(render_process_id, render_frame_id); 207 std::pair<int, int> key(render_process_id, render_frame_id);
201 pending_transition_frames_.erase(key); 208 pending_transition_frames_.erase(key);
202 } 209 }
203 210
204 TransitionRequestManager::TransitionRequestManager() { 211 TransitionRequestManager::TransitionRequestManager() {
205 } 212 }
206 213
207 TransitionRequestManager::~TransitionRequestManager() { 214 TransitionRequestManager::~TransitionRequestManager() {
208 } 215 }
209 216
210 // static 217 // static
211 TransitionRequestManager* TransitionRequestManager::GetInstance() { 218 TransitionRequestManager* TransitionRequestManager::GetInstance() {
212 return Singleton<TransitionRequestManager>::get(); 219 return Singleton<TransitionRequestManager>::get();
213 } 220 }
214 221
215 } // namespace content 222 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/transition_request_manager.h ('k') | content/browser/web_contents/web_contents_android.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698