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

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

Issue 2682193002: Convert NavigationController unit and browser tests to use the new navigation callbacks. (Closed)
Patch Set: merge Created 3 years, 10 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 <memory> 12 #include <memory>
13 #include <string> 13 #include <string>
14 #include <utility> 14 #include <utility>
15 #include <vector> 15 #include <vector>
16 16
17 #include "base/callback.h" 17 #include "base/callback.h"
18 #include "base/macros.h" 18 #include "base/macros.h"
19 #include "base/memory/ref_counted.h" 19 #include "base/memory/ref_counted.h"
20 #include "base/memory/scoped_vector.h" 20 #include "base/memory/scoped_vector.h"
21 #include "content/browser/frame_host/frame_tree_node.h" 21 #include "content/browser/frame_host/frame_tree_node.h"
22 #include "content/browser/frame_host/render_frame_host_impl.h" 22 #include "content/browser/frame_host/render_frame_host_impl.h"
23 #include "content/common/content_export.h" 23 #include "content/common/content_export.h"
24 #include "content/public/browser/global_request_id.h" 24 #include "content/public/browser/global_request_id.h"
25 #include "content/public/browser/navigation_data.h" 25 #include "content/public/browser/navigation_data.h"
26 #include "content/public/browser/navigation_throttle.h" 26 #include "content/public/browser/navigation_throttle.h"
27 #include "content/public/browser/navigation_type.h"
27 #include "content/public/browser/ssl_status.h" 28 #include "content/public/browser/ssl_status.h"
28 #include "content/public/common/request_context_type.h" 29 #include "content/public/common/request_context_type.h"
29 #include "third_party/WebKit/public/platform/WebMixedContentContextType.h" 30 #include "third_party/WebKit/public/platform/WebMixedContentContextType.h"
30 #include "url/gurl.h" 31 #include "url/gurl.h"
31 32
32 struct FrameHostMsg_DidCommitProvisionalLoad_Params; 33 struct FrameHostMsg_DidCommitProvisionalLoad_Params;
33 34
34 namespace content { 35 namespace content {
35 36
36 class AppCacheNavigationHandle; 37 class AppCacheNavigationHandle;
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 void ReadyToCommitNavigation(RenderFrameHostImpl* render_frame_host); 283 void ReadyToCommitNavigation(RenderFrameHostImpl* render_frame_host);
283 284
284 // Called when the navigation was committed in |render_frame_host|. This will 285 // Called when the navigation was committed in |render_frame_host|. This will
285 // update the |state_|. 286 // update the |state_|.
286 // |did_replace_entry| is true if the committed entry has replaced the 287 // |did_replace_entry| is true if the committed entry has replaced the
287 // existing one. A non-user initiated redirect causes such replacement. 288 // existing one. A non-user initiated redirect causes such replacement.
288 void DidCommitNavigation( 289 void DidCommitNavigation(
289 const FrameHostMsg_DidCommitProvisionalLoad_Params& params, 290 const FrameHostMsg_DidCommitProvisionalLoad_Params& params,
290 bool did_replace_entry, 291 bool did_replace_entry,
291 const GURL& previous_url, 292 const GURL& previous_url,
293 NavigationType navigation_type,
292 RenderFrameHostImpl* render_frame_host); 294 RenderFrameHostImpl* render_frame_host);
293 295
294 // Called during commit. Takes ownership of the embedder's NavigationData 296 // Called during commit. Takes ownership of the embedder's NavigationData
295 // instance. This NavigationData may have been cloned prior to being added 297 // instance. This NavigationData may have been cloned prior to being added
296 // here. 298 // here.
297 void set_navigation_data(std::unique_ptr<NavigationData> navigation_data) { 299 void set_navigation_data(std::unique_ptr<NavigationData> navigation_data) {
298 navigation_data_ = std::move(navigation_data); 300 navigation_data_ = std::move(navigation_data);
299 } 301 }
300 302
301 SSLStatus ssl_status() { return ssl_status_; } 303 SSLStatus ssl_status() { return ssl_status_; }
302 304
303 // Called when the navigation is transferred to a different renderer. 305 // Called when the navigation is transferred to a different renderer.
304 void Transfer(); 306 void Transfer();
305 307
306 NavigationUIData* navigation_ui_data() const { 308 NavigationUIData* navigation_ui_data() const {
307 return navigation_ui_data_.get(); 309 return navigation_ui_data_.get();
308 } 310 }
309 311
310 const GURL& base_url() { return base_url_; } 312 const GURL& base_url() { return base_url_; }
311 313
312 void set_searchable_form_url(const GURL& url) { searchable_form_url_ = url; } 314 void set_searchable_form_url(const GURL& url) { searchable_form_url_ = url; }
313 void set_searchable_form_encoding(const std::string& encoding) { 315 void set_searchable_form_encoding(const std::string& encoding) {
314 searchable_form_encoding_ = encoding; 316 searchable_form_encoding_ = encoding;
315 } 317 }
316 318
319 NavigationType navigation_type() {
320 DCHECK_GE(state_, DID_COMMIT);
321 return navigation_type_;
322 }
323
317 void set_response_headers_for_testing( 324 void set_response_headers_for_testing(
318 scoped_refptr<net::HttpResponseHeaders> response_headers) { 325 scoped_refptr<net::HttpResponseHeaders> response_headers) {
319 response_headers_ = response_headers; 326 response_headers_ = response_headers;
320 } 327 }
321 328
322 private: 329 private:
323 friend class NavigationHandleImplTest; 330 friend class NavigationHandleImplTest;
324 331
325 // Used to track the state the navigation is currently in. 332 // Used to track the state the navigation is currently in.
326 enum State { 333 enum State {
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
474 481
475 // Stores the reload type, or NONE if it's not a reload. 482 // Stores the reload type, or NONE if it's not a reload.
476 ReloadType reload_type_; 483 ReloadType reload_type_;
477 484
478 GURL searchable_form_url_; 485 GURL searchable_form_url_;
479 std::string searchable_form_encoding_; 486 std::string searchable_form_encoding_;
480 487
481 GURL previous_url_; 488 GURL previous_url_;
482 GURL base_url_; 489 GURL base_url_;
483 net::HostPortPair socket_address_; 490 net::HostPortPair socket_address_;
491 NavigationType navigation_type_;
484 492
485 base::WeakPtrFactory<NavigationHandleImpl> weak_factory_; 493 base::WeakPtrFactory<NavigationHandleImpl> weak_factory_;
486 494
487 DISALLOW_COPY_AND_ASSIGN(NavigationHandleImpl); 495 DISALLOW_COPY_AND_ASSIGN(NavigationHandleImpl);
488 }; 496 };
489 497
490 } // namespace content 498 } // namespace content
491 499
492 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_HANDLE_IMPL_H_ 500 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_HANDLE_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698