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 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
318 | 318 |
319 navigation_state_.SetDocumentLoadCompleted(render_frame_host); | 319 navigation_state_.SetDocumentLoadCompleted(render_frame_host); |
320 if (!navigation_state_.CanSendEvents(render_frame_host)) | 320 if (!navigation_state_.CanSendEvents(render_frame_host)) |
321 return; | 321 return; |
322 | 322 |
323 // A new navigation might have started before the old one completed. | 323 // A new navigation might have started before the old one completed. |
324 // Ignore the old navigation completion in that case. | 324 // Ignore the old navigation completion in that case. |
325 // srcdoc iframes will report a url of about:blank, still let it through. | 325 // srcdoc iframes will report a url of about:blank, still let it through. |
326 if (navigation_state_.GetUrl(render_frame_host) != validated_url && | 326 if (navigation_state_.GetUrl(render_frame_host) != validated_url && |
327 (navigation_state_.GetUrl(render_frame_host) != | 327 (navigation_state_.GetUrl(render_frame_host) != |
328 GURL(content::kAboutSrcDocURL) || | 328 content::kAboutSrcDocURL || |
329 validated_url != GURL(url::kAboutBlankURL))) { | 329 validated_url != url::kAboutBlankURL)) { |
330 return; | 330 return; |
331 } | 331 } |
332 | 332 |
333 // The load might already have finished by the time we finished parsing. For | 333 // The load might already have finished by the time we finished parsing. For |
334 // compatibility reasons, we artifically delay the load completed signal until | 334 // compatibility reasons, we artifically delay the load completed signal until |
335 // after parsing was completed. | 335 // after parsing was completed. |
336 if (!navigation_state_.GetParsingFinished(render_frame_host)) | 336 if (!navigation_state_.GetParsingFinished(render_frame_host)) |
337 return; | 337 return; |
338 helpers::DispatchOnCompleted(web_contents(), | 338 helpers::DispatchOnCompleted(web_contents(), |
339 render_frame_host, | 339 render_frame_host, |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
562 return g_factory.Pointer(); | 562 return g_factory.Pointer(); |
563 } | 563 } |
564 | 564 |
565 void WebNavigationAPI::OnListenerAdded(const EventListenerInfo& details) { | 565 void WebNavigationAPI::OnListenerAdded(const EventListenerInfo& details) { |
566 web_navigation_event_router_.reset(new WebNavigationEventRouter( | 566 web_navigation_event_router_.reset(new WebNavigationEventRouter( |
567 Profile::FromBrowserContext(browser_context_))); | 567 Profile::FromBrowserContext(browser_context_))); |
568 EventRouter::Get(browser_context_)->UnregisterObserver(this); | 568 EventRouter::Get(browser_context_)->UnregisterObserver(this); |
569 } | 569 } |
570 | 570 |
571 } // namespace extensions | 571 } // namespace extensions |
OLD | NEW |