OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/extensions/api/identity/web_auth_flow.h" | 5 #include "chrome/browser/extensions/api/identity/web_auth_flow.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/base64.h" | 9 #include "base/base64.h" |
10 #include "base/location.h" | 10 #include "base/location.h" |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 void WebAuthFlow::DidFinishNavigation( | 205 void WebAuthFlow::DidFinishNavigation( |
206 content::NavigationHandle* navigation_handle) { | 206 content::NavigationHandle* navigation_handle) { |
207 bool failed = false; | 207 bool failed = false; |
208 | 208 |
209 if (navigation_handle->GetNetErrorCode() != net::OK) { | 209 if (navigation_handle->GetNetErrorCode() != net::OK) { |
210 failed = true; | 210 failed = true; |
211 TRACE_EVENT_ASYNC_STEP_PAST1("identity", "WebAuthFlow", this, | 211 TRACE_EVENT_ASYNC_STEP_PAST1("identity", "WebAuthFlow", this, |
212 "DidFinishNavigationFailure", "error_code", | 212 "DidFinishNavigationFailure", "error_code", |
213 navigation_handle->GetNetErrorCode()); | 213 navigation_handle->GetNetErrorCode()); |
214 } else if (navigation_handle->IsInMainFrame() && | 214 } else if (navigation_handle->IsInMainFrame() && |
| 215 navigation_handle->GetResponseHeaders() && |
215 navigation_handle->GetResponseHeaders()->response_code() >= 400) { | 216 navigation_handle->GetResponseHeaders()->response_code() >= 400) { |
216 failed = true; | 217 failed = true; |
217 TRACE_EVENT_ASYNC_STEP_PAST1( | 218 TRACE_EVENT_ASYNC_STEP_PAST1( |
218 "identity", "WebAuthFlow", this, "DidFinishNavigationFailure", | 219 "identity", "WebAuthFlow", this, "DidFinishNavigationFailure", |
219 "response_code", | 220 "response_code", |
220 navigation_handle->GetResponseHeaders()->response_code()); | 221 navigation_handle->GetResponseHeaders()->response_code()); |
221 } | 222 } |
222 | 223 |
223 if (failed && delegate_) | 224 if (failed && delegate_) |
224 delegate_->OnAuthFlowFailure(LOAD_FAILED); | 225 delegate_->OnAuthFlowFailure(LOAD_FAILED); |
225 } | 226 } |
226 | 227 |
227 } // namespace extensions | 228 } // namespace extensions |
OLD | NEW |