Index: chrome/browser/extensions/api/identity/web_auth_flow.cc |
diff --git a/chrome/browser/extensions/api/identity/web_auth_flow.cc b/chrome/browser/extensions/api/identity/web_auth_flow.cc |
index 6aa3289e3ddd62cd7d4b68349dd404eada669263..9639bbf5319ee8682505b659e1de47daaaa40998 100644 |
--- a/chrome/browser/extensions/api/identity/web_auth_flow.cc |
+++ b/chrome/browser/extensions/api/identity/web_auth_flow.cc |
@@ -22,6 +22,7 @@ |
#include "components/guest_view/browser/guest_view_base.h" |
#include "content/public/browser/navigation_details.h" |
#include "content/public/browser/navigation_entry.h" |
+#include "content/public/browser/navigation_handle.h" |
#include "content/public/browser/notification_details.h" |
#include "content/public/browser/notification_service.h" |
#include "content/public/browser/notification_source.h" |
@@ -33,6 +34,7 @@ |
#include "extensions/browser/app_window/app_window.h" |
#include "extensions/browser/event_router.h" |
#include "extensions/browser/extension_system.h" |
+#include "net/http/http_response_headers.h" |
#include "url/gurl.h" |
using content::RenderViewHost; |
@@ -177,31 +179,6 @@ void WebAuthFlow::RenderProcessGone(base::TerminationStatus status) { |
delegate_->OnAuthFlowFailure(WebAuthFlow::WINDOW_CLOSED); |
} |
-void WebAuthFlow::DidStartProvisionalLoadForFrame( |
- content::RenderFrameHost* render_frame_host, |
- const GURL& validated_url, |
- bool is_error_page, |
- bool is_iframe_srcdoc) { |
- if (!render_frame_host->GetParent()) |
- BeforeUrlLoaded(validated_url); |
-} |
- |
-void WebAuthFlow::DidFailProvisionalLoad( |
- content::RenderFrameHost* render_frame_host, |
- const GURL& validated_url, |
- int error_code, |
- const base::string16& error_description, |
- bool was_ignored_by_handler) { |
- TRACE_EVENT_ASYNC_STEP_PAST1("identity", |
Michael Courage
2016/09/22 16:25:36
would be nice to keep the error tracing in the new
yzshen1
2016/09/22 18:07:52
I removed it because this doesn't have a correspon
|
- "WebAuthFlow", |
- this, |
- "DidFailProvisionalLoad", |
- "error_code", |
- error_code); |
- if (delegate_) |
- delegate_->OnAuthFlowFailure(LOAD_FAILED); |
-} |
- |
void WebAuthFlow::DidGetRedirectForResourceRequest( |
const content::ResourceRedirectDetails& details) { |
BeforeUrlLoaded(details.new_url); |
@@ -217,10 +194,20 @@ void WebAuthFlow::DidStopLoading() { |
AfterUrlLoaded(); |
} |
-void WebAuthFlow::DidNavigateMainFrame( |
- const content::LoadCommittedDetails& details, |
- const content::FrameNavigateParams& params) { |
- if (delegate_ && details.http_status_code >= 400) |
+void WebAuthFlow::DidStartNavigation( |
+ content::NavigationHandle* navigation_handle) { |
+ if (navigation_handle->IsInMainFrame()) |
+ BeforeUrlLoaded(navigation_handle->GetURL()); |
yzshen1
2016/09/16 22:32:44
One question:
It seems the original code doesn't c
clamy
2016/09/19 10:02:54
It is possible to have 2 navigation sin the main f
yzshen1
2016/09/19 15:32:56
Thanks for the info! I will also wait for the WebA
Michael Courage
2016/09/19 19:11:43
At the time I wrote this code I didn't have a grea
|
+} |
+ |
+void WebAuthFlow::DidFinishNavigation( |
+ content::NavigationHandle* navigation_handle) { |
+ bool failed = |
+ navigation_handle->GetNetErrorCode() != net::OK || |
clamy
2016/09/19 10:02:54
This seems like it would trigger for a subframe na
yzshen1
2016/09/19 15:32:56
It seems this is what the original code did. But w
|
+ (navigation_handle->IsInMainFrame() && |
+ navigation_handle->GetResponseHeaders()->response_code() >= 400); |
+ |
+ if (failed && delegate_) |
delegate_->OnAuthFlowFailure(LOAD_FAILED); |
} |