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

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: extensions_unittests 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
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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 ui::PageTransition GetPageTransition() override; 97 ui::PageTransition GetPageTransition() override;
97 bool IsExternalProtocol() override; 98 bool IsExternalProtocol() override;
98 net::Error GetNetErrorCode() override; 99 net::Error GetNetErrorCode() override;
99 RenderFrameHostImpl* GetRenderFrameHost() override; 100 RenderFrameHostImpl* GetRenderFrameHost() override;
100 bool IsSamePage() override; 101 bool IsSamePage() override;
101 bool HasCommitted() override; 102 bool HasCommitted() override;
102 bool IsErrorPage() override; 103 bool IsErrorPage() override;
103 void Resume() override; 104 void Resume() override;
104 void CancelDeferredNavigation( 105 void CancelDeferredNavigation(
105 NavigationThrottle::ThrottleCheckResult result) override; 106 NavigationThrottle::ThrottleCheckResult result) override;
107 void QueueConsoleMessage(ConsoleMessageLevel level,
108 const std::string& message) override;
106 void RegisterThrottleForTesting( 109 void RegisterThrottleForTesting(
107 std::unique_ptr<NavigationThrottle> navigation_throttle) override; 110 std::unique_ptr<NavigationThrottle> navigation_throttle) override;
108 NavigationThrottle::ThrottleCheckResult CallWillStartRequestForTesting( 111 NavigationThrottle::ThrottleCheckResult CallWillStartRequestForTesting(
109 bool is_post, 112 bool is_post,
110 const Referrer& sanitized_referrer, 113 const Referrer& sanitized_referrer,
111 bool has_user_gesture, 114 bool has_user_gesture,
112 ui::PageTransition transition, 115 ui::PageTransition transition,
113 bool is_external_protocol) override; 116 bool is_external_protocol) override;
114 NavigationThrottle::ThrottleCheckResult CallWillRedirectRequestForTesting( 117 NavigationThrottle::ThrottleCheckResult CallWillRedirectRequestForTesting(
115 const GURL& new_url, 118 const GURL& new_url,
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 int pending_nav_entry_id); 263 int pending_nav_entry_id);
261 264
262 NavigationThrottle::ThrottleCheckResult CheckWillStartRequest(); 265 NavigationThrottle::ThrottleCheckResult CheckWillStartRequest();
263 NavigationThrottle::ThrottleCheckResult CheckWillRedirectRequest(); 266 NavigationThrottle::ThrottleCheckResult CheckWillRedirectRequest();
264 NavigationThrottle::ThrottleCheckResult CheckWillProcessResponse(); 267 NavigationThrottle::ThrottleCheckResult CheckWillProcessResponse();
265 268
266 // Helper function to run and reset the |complete_callback_|. This marks the 269 // Helper function to run and reset the |complete_callback_|. This marks the
267 // end of a round of NavigationThrottleChecks. 270 // end of a round of NavigationThrottleChecks.
268 void RunCompleteCallback(NavigationThrottle::ThrottleCheckResult result); 271 void RunCompleteCallback(NavigationThrottle::ThrottleCheckResult result);
269 272
273 // Outputs the messages in |console_queue_| to the relevant RenderFrameHost,
274 // in FIFO order. This method must be called after a response has been
275 // delivered for processing, and will clear out |console_queue_| as a side
276 // effect of sending the messages.
277 virtual void DumpMessagesToConsole();
278
270 // Used in tests. 279 // Used in tests.
271 State state() const { return state_; } 280 State state() const { return state_; }
272 281
273 // See NavigationHandle for a description of those member variables. 282 // See NavigationHandle for a description of those member variables.
274 GURL url_; 283 GURL url_;
275 Referrer sanitized_referrer_; 284 Referrer sanitized_referrer_;
276 bool has_user_gesture_; 285 bool has_user_gesture_;
277 ui::PageTransition transition_; 286 ui::PageTransition transition_;
278 bool is_external_protocol_; 287 bool is_external_protocol_;
279 net::Error net_error_code_; 288 net::Error net_error_code_;
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 ThrottleChecksFinishedCallback complete_callback_; 328 ThrottleChecksFinishedCallback complete_callback_;
320 329
321 // PlzNavigate 330 // PlzNavigate
322 // Manages the lifetime of a pre-created ServiceWorkerProviderHost until a 331 // Manages the lifetime of a pre-created ServiceWorkerProviderHost until a
323 // corresponding ServiceWorkerNetworkProvider is created in the renderer. 332 // corresponding ServiceWorkerNetworkProvider is created in the renderer.
324 std::unique_ptr<ServiceWorkerNavigationHandle> service_worker_handle_; 333 std::unique_ptr<ServiceWorkerNavigationHandle> service_worker_handle_;
325 334
326 // Embedder data tied to this navigation. 335 // Embedder data tied to this navigation.
327 std::unique_ptr<NavigationData> navigation_data_; 336 std::unique_ptr<NavigationData> navigation_data_;
328 337
338 // A queue of messages to be delivered to the devtools console upon commit.
339 std::queue<std::pair<ConsoleMessageLevel, const std::string>> console_queue_;
340
329 DISALLOW_COPY_AND_ASSIGN(NavigationHandleImpl); 341 DISALLOW_COPY_AND_ASSIGN(NavigationHandleImpl);
330 }; 342 };
331 343
332 } // namespace content 344 } // namespace content
333 345
334 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_HANDLE_IMPL_H_ 346 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_HANDLE_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698