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

Side by Side Diff: content/browser/frame_host/navigation_handle_impl.h

Issue 2101323002: Add 'NavigationHandle::QueueConsoleMessage'. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: -public Created 4 years, 5 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 unified diff | Download patch
« no previous file with comments | « no previous file | content/browser/frame_host/navigation_handle_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 #ifndef CONTENT_BROWSER_FRAME_HOST_NAVIGATION_HANDLE_IMPL_H_ 5 #ifndef CONTENT_BROWSER_FRAME_HOST_NAVIGATION_HANDLE_IMPL_H_
6 #define CONTENT_BROWSER_FRAME_HOST_NAVIGATION_HANDLE_IMPL_H_ 6 #define CONTENT_BROWSER_FRAME_HOST_NAVIGATION_HANDLE_IMPL_H_
7 7
8 #include "content/public/browser/navigation_handle.h" 8 #include "content/public/browser/navigation_handle.h"
9 9
10 #include <stddef.h> 10 #include <stddef.h>
11 11
12 #include "base/callback.h" 12 #include "base/callback.h"
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "base/memory/ref_counted.h" 14 #include "base/memory/ref_counted.h"
15 #include "base/memory/scoped_vector.h" 15 #include "base/memory/scoped_vector.h"
16 #include "content/browser/frame_host/frame_tree_node.h" 16 #include "content/browser/frame_host/frame_tree_node.h"
17 #include "content/browser/frame_host/render_frame_host_impl.h" 17 #include "content/browser/frame_host/render_frame_host_impl.h"
18 #include "content/common/content_export.h" 18 #include "content/common/content_export.h"
19 #include "content/public/browser/navigation_data.h" 19 #include "content/public/browser/navigation_data.h"
20 #include "content/public/browser/navigation_throttle.h" 20 #include "content/public/browser/navigation_throttle.h"
21 #include "content/public/common/console_message_level.h"
21 #include "url/gurl.h" 22 #include "url/gurl.h"
22 23
23 struct FrameHostMsg_DidCommitProvisionalLoad_Params; 24 struct FrameHostMsg_DidCommitProvisionalLoad_Params;
24 25
25 namespace content { 26 namespace content {
26 27
27 class NavigatorDelegate; 28 class NavigatorDelegate;
28 class ResourceRequestBodyImpl; 29 class ResourceRequestBodyImpl;
29 class ServiceWorkerContextWrapper; 30 class ServiceWorkerContextWrapper;
30 class ServiceWorkerNavigationHandle; 31 class ServiceWorkerNavigationHandle;
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 bool same_page, 227 bool same_page,
227 RenderFrameHostImpl* render_frame_host); 228 RenderFrameHostImpl* render_frame_host);
228 229
229 // Called during commit. Takes ownership of the embedder's NavigationData 230 // Called during commit. Takes ownership of the embedder's NavigationData
230 // instance. This NavigationData may have been cloned prior to being added 231 // instance. This NavigationData may have been cloned prior to being added
231 // here. 232 // here.
232 void set_navigation_data(std::unique_ptr<NavigationData> navigation_data) { 233 void set_navigation_data(std::unique_ptr<NavigationData> navigation_data) {
233 navigation_data_ = std::move(navigation_data); 234 navigation_data_ = std::move(navigation_data);
234 } 235 }
235 236
237 // Adds a console message to the NavigationHandle's message queue. Messages
238 // queued before the navigation is ready to commit will be delivered to the
239 // final RenderFrameHost upon commit. Messages queued after the navigation has
240 // committed will be delivered immediately.
clamy 2016/06/29 11:07:28 The navigation commit corresponds to the destructi
241 void QueueConsoleMessage(ConsoleMessageLevel level,
nasko 2016/06/28 22:25:46 bikeshed: AppendConsoleMessage? Queue to me implie
242 const std::string& message);
243
236 private: 244 private:
237 friend class NavigationHandleImplTest; 245 friend class NavigationHandleImplTest;
238 246
239 // Used to track the state the navigation is currently in. 247 // Used to track the state the navigation is currently in.
240 enum State { 248 enum State {
241 INITIAL = 0, 249 INITIAL = 0,
242 WILL_SEND_REQUEST, 250 WILL_SEND_REQUEST,
243 DEFERRING_START, 251 DEFERRING_START,
244 WILL_REDIRECT_REQUEST, 252 WILL_REDIRECT_REQUEST,
245 DEFERRING_REDIRECT, 253 DEFERRING_REDIRECT,
(...skipping 14 matching lines...) Expand all
260 int pending_nav_entry_id); 268 int pending_nav_entry_id);
261 269
262 NavigationThrottle::ThrottleCheckResult CheckWillStartRequest(); 270 NavigationThrottle::ThrottleCheckResult CheckWillStartRequest();
263 NavigationThrottle::ThrottleCheckResult CheckWillRedirectRequest(); 271 NavigationThrottle::ThrottleCheckResult CheckWillRedirectRequest();
264 NavigationThrottle::ThrottleCheckResult CheckWillProcessResponse(); 272 NavigationThrottle::ThrottleCheckResult CheckWillProcessResponse();
265 273
266 // Helper function to run and reset the |complete_callback_|. This marks the 274 // Helper function to run and reset the |complete_callback_|. This marks the
267 // end of a round of NavigationThrottleChecks. 275 // end of a round of NavigationThrottleChecks.
268 void RunCompleteCallback(NavigationThrottle::ThrottleCheckResult result); 276 void RunCompleteCallback(NavigationThrottle::ThrottleCheckResult result);
269 277
278 // Outputs the messages in |console_queue_| to the relevant RenderFrameHost,
279 // in FIFO order. This method must be called after a response has been
280 // delivered for processing, and will clear out |console_queue_| as a side
281 // effect of sending the messages.
282 virtual void DumpMessagesToConsole();
clamy 2016/06/29 11:07:28 Why virtual?
283
270 // Used in tests. 284 // Used in tests.
271 State state() const { return state_; } 285 State state() const { return state_; }
272 286
273 // See NavigationHandle for a description of those member variables. 287 // See NavigationHandle for a description of those member variables.
274 GURL url_; 288 GURL url_;
275 Referrer sanitized_referrer_; 289 Referrer sanitized_referrer_;
276 bool has_user_gesture_; 290 bool has_user_gesture_;
277 ui::PageTransition transition_; 291 ui::PageTransition transition_;
278 bool is_external_protocol_; 292 bool is_external_protocol_;
279 net::Error net_error_code_; 293 net::Error net_error_code_;
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 ThrottleChecksFinishedCallback complete_callback_; 333 ThrottleChecksFinishedCallback complete_callback_;
320 334
321 // PlzNavigate 335 // PlzNavigate
322 // Manages the lifetime of a pre-created ServiceWorkerProviderHost until a 336 // Manages the lifetime of a pre-created ServiceWorkerProviderHost until a
323 // corresponding ServiceWorkerNetworkProvider is created in the renderer. 337 // corresponding ServiceWorkerNetworkProvider is created in the renderer.
324 std::unique_ptr<ServiceWorkerNavigationHandle> service_worker_handle_; 338 std::unique_ptr<ServiceWorkerNavigationHandle> service_worker_handle_;
325 339
326 // Embedder data tied to this navigation. 340 // Embedder data tied to this navigation.
327 std::unique_ptr<NavigationData> navigation_data_; 341 std::unique_ptr<NavigationData> navigation_data_;
328 342
343 // A queue of messages to be delivered to the devtools console upon commit.
344 std::queue<std::pair<ConsoleMessageLevel, const std::string>> console_queue_;
345
329 DISALLOW_COPY_AND_ASSIGN(NavigationHandleImpl); 346 DISALLOW_COPY_AND_ASSIGN(NavigationHandleImpl);
330 }; 347 };
331 348
332 } // namespace content 349 } // namespace content
333 350
334 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_HANDLE_IMPL_H_ 351 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_HANDLE_IMPL_H_
OLDNEW
« no previous file with comments | « no previous file | content/browser/frame_host/navigation_handle_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698