Chromium Code Reviews| Index: chrome/browser/extensions/api/web_navigation/web_navigation_api.cc |
| diff --git a/chrome/browser/extensions/api/web_navigation/web_navigation_api.cc b/chrome/browser/extensions/api/web_navigation/web_navigation_api.cc |
| index aa6c568538fcbefa86173414d18b4e8aa8d898da..12b125349c3e6371fc83214722a76ad409abdc7f 100644 |
| --- a/chrome/browser/extensions/api/web_navigation/web_navigation_api.cc |
| +++ b/chrome/browser/extensions/api/web_navigation/web_navigation_api.cc |
| @@ -122,11 +122,8 @@ void WebNavigationEventRouter::TabReplacedAt( |
| DCHECK(GetViewType(old_contents) != VIEW_TYPE_TAB_CONTENTS); |
| return; |
| } |
| - const FrameNavigationState& frame_navigation_state = |
| - tab_observer->frame_navigation_state(); |
| - |
| - if (!frame_navigation_state.IsValidUrl(old_contents->GetURL()) || |
| - !frame_navigation_state.IsValidUrl(new_contents->GetURL())) |
| + if (!FrameNavigationState::IsValidUrl(old_contents->GetURL()) || |
| + !FrameNavigationState::IsValidUrl(new_contents->GetURL())) |
| return; |
| helpers::DispatchOnTabReplaced(old_contents, profile_, new_contents); |
| @@ -256,11 +253,7 @@ void WebNavigationTabObserver::RenderFrameDeleted( |
| content::RenderFrameHost* render_frame_host) { |
| if (navigation_state_.CanSendEvents(render_frame_host) && |
| !navigation_state_.GetNavigationCompleted(render_frame_host)) { |
| - helpers::DispatchOnErrorOccurred( |
| - web_contents(), |
| - render_frame_host, |
| - navigation_state_.GetUrl(render_frame_host), |
| - net::ERR_ABORTED); |
| + DispatchErrorToHelper(render_frame_host, net::ERR_ABORTED); |
| navigation_state_.SetErrorOccurredInFrame(render_frame_host); |
| } |
| } |
| @@ -358,13 +351,8 @@ void WebNavigationTabObserver::DidFailProvisionalLoad( |
| << "render_frame_host=" << render_frame_host |
| << ", frame_num=" << render_frame_host->GetRoutingID() |
| << ", url=" << validated_url << ")"; |
| - if (navigation_state_.CanSendEvents(render_frame_host)) { |
| - helpers::DispatchOnErrorOccurred( |
| - web_contents(), |
| - render_frame_host, |
| - navigation_state_.GetUrl(render_frame_host), |
| - error_code); |
| - } |
| + if (navigation_state_.CanSendEvents(render_frame_host)) |
| + DispatchErrorToHelper(render_frame_host, error_code); |
| navigation_state_.SetErrorOccurredInFrame(render_frame_host); |
| } |
| @@ -436,13 +424,8 @@ void WebNavigationTabObserver::DidFailLoad( |
| // that weren't reguarly loaded. |
| if (!navigation_state_.IsValidFrame(render_frame_host)) |
| return; |
| - if (navigation_state_.CanSendEvents(render_frame_host)) { |
| - helpers::DispatchOnErrorOccurred( |
| - web_contents(), |
| - render_frame_host, |
| - navigation_state_.GetUrl(render_frame_host), |
| - error_code); |
| - } |
| + if (navigation_state_.CanSendEvents(render_frame_host)) |
| + DispatchErrorToHelper(render_frame_host, error_code); |
| navigation_state_.SetErrorOccurredInFrame(render_frame_host); |
| } |
| @@ -488,6 +471,14 @@ void WebNavigationTabObserver::WebContentsDestroyed() { |
| registrar_.RemoveAll(); |
| } |
| +void WebNavigationTabObserver::DispatchErrorToHelper( |
|
nasko
2015/05/14 17:00:41
First of all, it is unrelated to the change you ar
|
| + content::RenderFrameHost* render_frame_host, |
| + int error_code) { |
| + helpers::DispatchOnErrorOccurred(web_contents(), render_frame_host, |
| + navigation_state_.GetUrl(render_frame_host), |
| + error_code); |
| +} |
| + |
| // See also NavigationController::IsURLInPageNavigation. |
| bool WebNavigationTabObserver::IsReferenceFragmentNavigation( |
| content::RenderFrameHost* render_frame_host, |