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 CHECK(details->source_tab_contents->GetRenderViewType() != | 407 NOTREACHED(); |
408 content::VIEW_TYPE_TAB_CONTENTS); | |
409 return; | 408 return; |
410 } | 409 } |
411 const FrameNavigationState& frame_navigation_state = | 410 const FrameNavigationState& frame_navigation_state = |
412 tab_observer->frame_navigation_state(); | 411 tab_observer->frame_navigation_state(); |
413 | 412 |
414 if (!frame_navigation_state.CanSendEvents(details->source_frame_id)) | 413 if (!frame_navigation_state.CanSendEvents(details->source_frame_id)) |
415 return; | 414 return; |
416 | 415 |
417 // If the TabContents was created as a response to an IPC from a renderer, it | 416 // If the TabContents was created as a response to an IPC from a renderer, it |
418 // doesn't yet have a wrapper, and we need to delay the extension event until | 417 // 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... |
724 keys::kFrameIdKey, | 723 keys::kFrameIdKey, |
725 GetFrameId(navigation_state.IsMainFrame(*frame), *frame)); | 724 GetFrameId(navigation_state.IsMainFrame(*frame), *frame)); |
726 frameDict->SetBoolean( | 725 frameDict->SetBoolean( |
727 keys::kErrorOccurredKey, | 726 keys::kErrorOccurredKey, |
728 navigation_state.GetErrorOccurredInFrame(*frame)); | 727 navigation_state.GetErrorOccurredInFrame(*frame)); |
729 resultList->Append(frameDict); | 728 resultList->Append(frameDict); |
730 } | 729 } |
731 result_.reset(resultList); | 730 result_.reset(resultList); |
732 return true; | 731 return true; |
733 } | 732 } |
OLD | NEW |