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 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
409 } | 409 } |
410 } | 410 } |
411 | 411 |
412 void ExtensionWebNavigationEventRouter::Retargeting( | 412 void ExtensionWebNavigationEventRouter::Retargeting( |
413 const RetargetingDetails* details) { | 413 const RetargetingDetails* details) { |
414 if (details->source_frame_id == 0) | 414 if (details->source_frame_id == 0) |
415 return; | 415 return; |
416 ExtensionWebNavigationTabObserver* tab_observer = | 416 ExtensionWebNavigationTabObserver* tab_observer = |
417 ExtensionWebNavigationTabObserver::Get(details->source_web_contents); | 417 ExtensionWebNavigationTabObserver::Get(details->source_web_contents); |
418 if (!tab_observer) { | 418 if (!tab_observer) { |
419 CHECK(details->source_web_contents->GetRenderViewHost()->delegate()-> | 419 CHECK(details->source_web_contents->GetViewType() != |
420 GetRenderViewType() != content::VIEW_TYPE_TAB_CONTENTS); | 420 content::VIEW_TYPE_TAB_CONTENTS); |
421 return; | 421 return; |
422 } | 422 } |
423 const FrameNavigationState& frame_navigation_state = | 423 const FrameNavigationState& frame_navigation_state = |
424 tab_observer->frame_navigation_state(); | 424 tab_observer->frame_navigation_state(); |
425 | 425 |
426 if (!frame_navigation_state.CanSendEvents(details->source_frame_id)) | 426 if (!frame_navigation_state.CanSendEvents(details->source_frame_id)) |
427 return; | 427 return; |
428 | 428 |
429 // If the WebContents was created as a response to an IPC from a renderer | 429 // If the WebContents was created as a response to an IPC from a renderer |
430 // (and therefore doesn't yet have a wrapper), or if it isn't yet inserted | 430 // (and therefore doesn't yet have a wrapper), or if it isn't yet inserted |
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
740 keys::kFrameIdKey, | 740 keys::kFrameIdKey, |
741 GetFrameId(navigation_state.IsMainFrame(*frame), *frame)); | 741 GetFrameId(navigation_state.IsMainFrame(*frame), *frame)); |
742 frameDict->SetBoolean( | 742 frameDict->SetBoolean( |
743 keys::kErrorOccurredKey, | 743 keys::kErrorOccurredKey, |
744 navigation_state.GetErrorOccurredInFrame(*frame)); | 744 navigation_state.GetErrorOccurredInFrame(*frame)); |
745 resultList->Append(frameDict); | 745 resultList->Append(frameDict); |
746 } | 746 } |
747 result_.reset(resultList); | 747 result_.reset(resultList); |
748 return true; | 748 return true; |
749 } | 749 } |
OLD | NEW |