| 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/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
| 10 #include "chrome/browser/chrome_notification_types.h" | 10 #include "chrome/browser/chrome_notification_types.h" |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 if (!tab_observer) { | 153 if (!tab_observer) { |
| 154 // If you hit this DCHECK(), please add reproduction steps to | 154 // If you hit this DCHECK(), please add reproduction steps to |
| 155 // http://crbug.com/109464. | 155 // http://crbug.com/109464. |
| 156 DCHECK(GetViewType(details->source_web_contents) != VIEW_TYPE_TAB_CONTENTS); | 156 DCHECK(GetViewType(details->source_web_contents) != VIEW_TYPE_TAB_CONTENTS); |
| 157 return; | 157 return; |
| 158 } | 158 } |
| 159 const FrameNavigationState& frame_navigation_state = | 159 const FrameNavigationState& frame_navigation_state = |
| 160 tab_observer->frame_navigation_state(); | 160 tab_observer->frame_navigation_state(); |
| 161 | 161 |
| 162 content::RenderFrameHost* frame_host = content::RenderFrameHost::FromID( | 162 content::RenderFrameHost* frame_host = content::RenderFrameHost::FromID( |
| 163 details->source_web_contents->GetRenderProcessHost()->GetID(), | 163 details->source_render_process_id, details->source_render_frame_id); |
| 164 details->source_render_frame_id); | |
| 165 if (!frame_navigation_state.CanSendEvents(frame_host)) | 164 if (!frame_navigation_state.CanSendEvents(frame_host)) |
| 166 return; | 165 return; |
| 167 | 166 |
| 168 // If the WebContents isn't yet inserted into a tab strip, we need to delay | 167 // If the WebContents isn't yet inserted into a tab strip, we need to delay |
| 169 // the extension event until the WebContents is fully initialized. | 168 // the extension event until the WebContents is fully initialized. |
| 170 if (details->not_yet_in_tabstrip) { | 169 if (details->not_yet_in_tabstrip) { |
| 171 pending_web_contents_[details->target_web_contents] = | 170 pending_web_contents_[details->target_web_contents] = |
| 172 PendingWebContents(details->source_web_contents, | 171 PendingWebContents(details->source_web_contents, |
| 173 frame_host, | 172 frame_host, |
| 174 details->target_web_contents, | 173 details->target_web_contents, |
| (...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 577 return g_factory.Pointer(); | 576 return g_factory.Pointer(); |
| 578 } | 577 } |
| 579 | 578 |
| 580 void WebNavigationAPI::OnListenerAdded(const EventListenerInfo& details) { | 579 void WebNavigationAPI::OnListenerAdded(const EventListenerInfo& details) { |
| 581 web_navigation_event_router_.reset(new WebNavigationEventRouter( | 580 web_navigation_event_router_.reset(new WebNavigationEventRouter( |
| 582 Profile::FromBrowserContext(browser_context_))); | 581 Profile::FromBrowserContext(browser_context_))); |
| 583 EventRouter::Get(browser_context_)->UnregisterObserver(this); | 582 EventRouter::Get(browser_context_)->UnregisterObserver(this); |
| 584 } | 583 } |
| 585 | 584 |
| 586 } // namespace extensions | 585 } // namespace extensions |
| OLD | NEW |