OLD | NEW |
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 #ifndef CONTENT_BROWSER_FRAME_HOST_NAVIGATION_REQUEST_H_ | 5 #ifndef CONTENT_BROWSER_FRAME_HOST_NAVIGATION_REQUEST_H_ |
6 #define CONTENT_BROWSER_FRAME_HOST_NAVIGATION_REQUEST_H_ | 6 #define CONTENT_BROWSER_FRAME_HOST_NAVIGATION_REQUEST_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 | 45 |
46 // The response started on the IO thread and is ready to be committed. This | 46 // The response started on the IO thread and is ready to be committed. This |
47 // is one of the two final states for the request. | 47 // is one of the two final states for the request. |
48 RESPONSE_STARTED, | 48 RESPONSE_STARTED, |
49 | 49 |
50 // The request failed on the IO thread and an error page should be | 50 // The request failed on the IO thread and an error page should be |
51 // displayed. This is one of the two final states for the request. | 51 // displayed. This is one of the two final states for the request. |
52 FAILED, | 52 FAILED, |
53 }; | 53 }; |
54 | 54 |
| 55 // Helper function to determine if the navigation request to |url| should be |
| 56 // sent to the network stack. |
| 57 static bool ShouldMakeNetworkRequest(const GURL& url); |
| 58 |
55 // Creates a request for a browser-intiated navigation. | 59 // Creates a request for a browser-intiated navigation. |
56 static scoped_ptr<NavigationRequest> CreateBrowserInitiated( | 60 static scoped_ptr<NavigationRequest> CreateBrowserInitiated( |
57 FrameTreeNode* frame_tree_node, | 61 FrameTreeNode* frame_tree_node, |
58 const NavigationEntryImpl& entry, | 62 const NavigationEntryImpl& entry, |
59 FrameMsg_Navigate_Type::Value navigation_type, | 63 FrameMsg_Navigate_Type::Value navigation_type, |
60 base::TimeTicks navigation_start); | 64 base::TimeTicks navigation_start); |
61 | 65 |
62 // Creates a request for a renderer-intiated navigation. | 66 // Creates a request for a renderer-intiated navigation. |
63 // Note: |body| is sent to the IO thread when calling BeginNavigation, and | 67 // Note: |body| is sent to the IO thread when calling BeginNavigation, and |
64 // should no longer be manipulated afterwards on the UI thread. | 68 // should no longer be manipulated afterwards on the UI thread. |
65 static scoped_ptr<NavigationRequest> CreateRendererInitiated( | 69 static scoped_ptr<NavigationRequest> CreateRendererInitiated( |
66 FrameTreeNode* frame_tree_node, | 70 FrameTreeNode* frame_tree_node, |
67 const CommonNavigationParams& common_params, | 71 const CommonNavigationParams& common_params, |
68 const BeginNavigationParams& begin_params, | 72 const BeginNavigationParams& begin_params, |
69 scoped_refptr<ResourceRequestBody> body); | 73 scoped_refptr<ResourceRequestBody> body); |
70 | 74 |
71 ~NavigationRequest() override; | 75 ~NavigationRequest() override; |
72 | 76 |
73 // Called on the UI thread by the Navigator to start the navigation on the IO | 77 // Called on the UI thread by the Navigator to start the navigation. Returns |
74 // thread. | 78 // whether a request was made on the IO thread. |
75 // TODO(clamy): see if ResourceRequestBody could be un-refcounted to avoid | 79 // TODO(clamy): see if ResourceRequestBody could be un-refcounted to avoid |
76 // threading subtleties. | 80 // threading subtleties. |
77 void BeginNavigation(); | 81 bool BeginNavigation(); |
78 | 82 |
79 const CommonNavigationParams& common_params() const { return common_params_; } | 83 const CommonNavigationParams& common_params() const { return common_params_; } |
80 | 84 |
81 const BeginNavigationParams& begin_params() const { return begin_params_; } | 85 const BeginNavigationParams& begin_params() const { return begin_params_; } |
82 | 86 |
83 const CommitNavigationParams& commit_params() const { return commit_params_; } | 87 const CommitNavigationParams& commit_params() const { return commit_params_; } |
84 | 88 |
85 NavigationURLLoader* loader_for_testing() const { return loader_.get(); } | 89 NavigationURLLoader* loader_for_testing() const { return loader_.get(); } |
86 | 90 |
87 NavigationState state() const { return state_; } | 91 NavigationState state() const { return state_; } |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 NavigationEntryImpl::RestoreType restore_type_; | 160 NavigationEntryImpl::RestoreType restore_type_; |
157 bool is_view_source_; | 161 bool is_view_source_; |
158 int bindings_; | 162 int bindings_; |
159 | 163 |
160 DISALLOW_COPY_AND_ASSIGN(NavigationRequest); | 164 DISALLOW_COPY_AND_ASSIGN(NavigationRequest); |
161 }; | 165 }; |
162 | 166 |
163 } // namespace content | 167 } // namespace content |
164 | 168 |
165 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_REQUEST_H_ | 169 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_REQUEST_H_ |
OLD | NEW |