| 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/extension_webnavigation_api.h" | 7 #include "chrome/browser/extensions/extension_webnavigation_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 539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 550 default: | 550 default: |
| 551 NOTREACHED(); | 551 NOTREACHED(); |
| 552 } | 552 } |
| 553 } | 553 } |
| 554 | 554 |
| 555 void ExtensionWebNavigationTabObserver::DidStartProvisionalLoadForFrame( | 555 void ExtensionWebNavigationTabObserver::DidStartProvisionalLoadForFrame( |
| 556 int64 frame_id, | 556 int64 frame_id, |
| 557 bool is_main_frame, | 557 bool is_main_frame, |
| 558 const GURL& validated_url, | 558 const GURL& validated_url, |
| 559 bool is_error_page, | 559 bool is_error_page, |
| 560 RenderViewHost* render_view_host) { | 560 content::RenderViewHost* render_view_host) { |
| 561 // Ignore navigations of sub frames, if the main frame isn't committed yet. | 561 // Ignore navigations of sub frames, if the main frame isn't committed yet. |
| 562 // This might happen if a sub frame triggers a navigation for both the main | 562 // This might happen if a sub frame triggers a navigation for both the main |
| 563 // frame and itself. Since the sub frame is about to be deleted, and there's | 563 // frame and itself. Since the sub frame is about to be deleted, and there's |
| 564 // no way for an extension to tell that these navigations belong to an old | 564 // no way for an extension to tell that these navigations belong to an old |
| 565 // frame, we just suppress the events here. | 565 // frame, we just suppress the events here. |
| 566 int64 main_frame_id = navigation_state_.GetMainFrameID(); | 566 int64 main_frame_id = navigation_state_.GetMainFrameID(); |
| 567 if (!is_main_frame && | 567 if (!is_main_frame && |
| 568 !navigation_state_.GetNavigationCommitted(main_frame_id)) { | 568 !navigation_state_.GetNavigationCommitted(main_frame_id)) { |
| 569 return; | 569 return; |
| 570 } | 570 } |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 798 keys::kFrameIdKey, | 798 keys::kFrameIdKey, |
| 799 GetFrameId(navigation_state.IsMainFrame(*frame), *frame)); | 799 GetFrameId(navigation_state.IsMainFrame(*frame), *frame)); |
| 800 frameDict->SetBoolean( | 800 frameDict->SetBoolean( |
| 801 keys::kErrorOccurredKey, | 801 keys::kErrorOccurredKey, |
| 802 navigation_state.GetErrorOccurredInFrame(*frame)); | 802 navigation_state.GetErrorOccurredInFrame(*frame)); |
| 803 resultList->Append(frameDict); | 803 resultList->Append(frameDict); |
| 804 } | 804 } |
| 805 result_.reset(resultList); | 805 result_.reset(resultList); |
| 806 return true; | 806 return true; |
| 807 } | 807 } |
| OLD | NEW |