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 // Implements the Chrome Extensions WebNavigation API. | 5 // Implements the Chrome Extensions WebNavigation API. |
6 | 6 |
7 #include "chrome/browser/extensions/api/web_navigation/web_navigation_api.h" | 7 #include "chrome/browser/extensions/api/web_navigation/web_navigation_api.h" |
8 | 8 |
9 #include "base/json/json_writer.h" | 9 #include "base/json/json_writer.h" |
10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
(...skipping 709 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
720 return; | 720 return; |
721 navigation_state_.SetNavigationCompleted(frame_id); | 721 navigation_state_.SetNavigationCompleted(frame_id); |
722 DCHECK_EQ(navigation_state_.GetUrl(frame_id), validated_url); | 722 DCHECK_EQ(navigation_state_.GetUrl(frame_id), validated_url); |
723 DCHECK_EQ(navigation_state_.IsMainFrame(frame_id), is_main_frame); | 723 DCHECK_EQ(navigation_state_.IsMainFrame(frame_id), is_main_frame); |
724 DispatchOnCompleted(web_contents(), | 724 DispatchOnCompleted(web_contents(), |
725 validated_url, | 725 validated_url, |
726 is_main_frame, | 726 is_main_frame, |
727 frame_id); | 727 frame_id); |
728 } | 728 } |
729 | 729 |
| 730 void WebNavigationTabObserver::DidFailLoad( |
| 731 int64 frame_id, |
| 732 const GURL& validated_url, |
| 733 bool is_main_frame, |
| 734 int error_code, |
| 735 const string16& error_description) { |
| 736 if (!navigation_state_.CanSendEvents(frame_id)) |
| 737 return; |
| 738 navigation_state_.SetErrorOccurredInFrame(frame_id); |
| 739 DispatchOnErrorOccurred( |
| 740 web_contents(), validated_url, frame_id, is_main_frame, error_code); |
| 741 } |
| 742 |
730 void WebNavigationTabObserver::DidOpenRequestedURL( | 743 void WebNavigationTabObserver::DidOpenRequestedURL( |
731 WebContents* new_contents, | 744 WebContents* new_contents, |
732 const GURL& url, | 745 const GURL& url, |
733 const content::Referrer& referrer, | 746 const content::Referrer& referrer, |
734 WindowOpenDisposition disposition, | 747 WindowOpenDisposition disposition, |
735 content::PageTransition transition, | 748 content::PageTransition transition, |
736 int64 source_frame_id) { | 749 int64 source_frame_id) { |
737 if (!navigation_state_.CanSendEvents(source_frame_id)) | 750 if (!navigation_state_.CanSendEvents(source_frame_id)) |
738 return; | 751 return; |
739 | 752 |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
869 frame->frame_id = GetFrameId(navigation_state.IsMainFrame(frame_id), | 882 frame->frame_id = GetFrameId(navigation_state.IsMainFrame(frame_id), |
870 frame_id); | 883 frame_id); |
871 frame->error_occurred = navigation_state.GetErrorOccurredInFrame(frame_id); | 884 frame->error_occurred = navigation_state.GetErrorOccurredInFrame(frame_id); |
872 result_list.push_back(frame); | 885 result_list.push_back(frame); |
873 } | 886 } |
874 SetResult(GetAllFrames::Result::Create(result_list)); | 887 SetResult(GetAllFrames::Result::Create(result_list)); |
875 return true; | 888 return true; |
876 } | 889 } |
877 | 890 |
878 } // namespace extensions | 891 } // namespace extensions |
OLD | NEW |