OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
397 } | 397 } |
398 } | 398 } |
399 | 399 |
400 void ExtensionWebNavigationEventRouter::Retargeting( | 400 void ExtensionWebNavigationEventRouter::Retargeting( |
401 const content::RetargetingDetails* details) { | 401 const content::RetargetingDetails* details) { |
402 if (details->source_frame_id == 0) | 402 if (details->source_frame_id == 0) |
403 return; | 403 return; |
404 ExtensionWebNavigationTabObserver* tab_observer = | 404 ExtensionWebNavigationTabObserver* tab_observer = |
405 ExtensionWebNavigationTabObserver::Get(details->source_tab_contents); | 405 ExtensionWebNavigationTabObserver::Get(details->source_tab_contents); |
406 if (!tab_observer) { | 406 if (!tab_observer) { |
407 NOTREACHED(); | 407 CHECK(details->source_tab_contents->GetRenderViewType() != |
| 408 content::VIEW_TYPE_TAB_CONTENTS); |
408 return; | 409 return; |
409 } | 410 } |
410 const FrameNavigationState& frame_navigation_state = | 411 const FrameNavigationState& frame_navigation_state = |
411 tab_observer->frame_navigation_state(); | 412 tab_observer->frame_navigation_state(); |
412 | 413 |
413 if (!frame_navigation_state.CanSendEvents(details->source_frame_id)) | 414 if (!frame_navigation_state.CanSendEvents(details->source_frame_id)) |
414 return; | 415 return; |
415 | 416 |
416 // If the TabContents was created as a response to an IPC from a renderer, it | 417 // If the TabContents was created as a response to an IPC from a renderer, it |
417 // doesn't yet have a wrapper, and we need to delay the extension event until | 418 // doesn't yet have a wrapper, and we need to delay the extension event until |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
723 keys::kFrameIdKey, | 724 keys::kFrameIdKey, |
724 GetFrameId(navigation_state.IsMainFrame(*frame), *frame)); | 725 GetFrameId(navigation_state.IsMainFrame(*frame), *frame)); |
725 frameDict->SetBoolean( | 726 frameDict->SetBoolean( |
726 keys::kErrorOccurredKey, | 727 keys::kErrorOccurredKey, |
727 navigation_state.GetErrorOccurredInFrame(*frame)); | 728 navigation_state.GetErrorOccurredInFrame(*frame)); |
728 resultList->Append(frameDict); | 729 resultList->Append(frameDict); |
729 } | 730 } |
730 result_.reset(resultList); | 731 result_.reset(resultList); |
731 return true; | 732 return true; |
732 } | 733 } |
OLD | NEW |