| 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 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 376 } | 376 } |
| 377 navigation_state_.SetErrorOccurredInFrame(render_frame_host); | 377 navigation_state_.SetErrorOccurredInFrame(render_frame_host); |
| 378 } | 378 } |
| 379 | 379 |
| 380 void WebNavigationTabObserver::DidOpenRequestedURL( | 380 void WebNavigationTabObserver::DidOpenRequestedURL( |
| 381 content::WebContents* new_contents, | 381 content::WebContents* new_contents, |
| 382 content::RenderFrameHost* source_render_frame_host, | 382 content::RenderFrameHost* source_render_frame_host, |
| 383 const GURL& url, | 383 const GURL& url, |
| 384 const content::Referrer& referrer, | 384 const content::Referrer& referrer, |
| 385 WindowOpenDisposition disposition, | 385 WindowOpenDisposition disposition, |
| 386 ui::PageTransition transition) { | 386 ui::PageTransition transition, |
| 387 bool started_from_context_menu) { |
| 387 if (!navigation_state_.CanSendEvents(source_render_frame_host)) | 388 if (!navigation_state_.CanSendEvents(source_render_frame_host)) |
| 388 return; | 389 return; |
| 389 | 390 |
| 390 // We only send the onCreatedNavigationTarget if we end up creating a new | 391 // We only send the onCreatedNavigationTarget if we end up creating a new |
| 391 // window. | 392 // window. |
| 392 if (disposition != WindowOpenDisposition::SINGLETON_TAB && | 393 if (disposition != WindowOpenDisposition::SINGLETON_TAB && |
| 393 disposition != WindowOpenDisposition::NEW_FOREGROUND_TAB && | 394 disposition != WindowOpenDisposition::NEW_FOREGROUND_TAB && |
| 394 disposition != WindowOpenDisposition::NEW_BACKGROUND_TAB && | 395 disposition != WindowOpenDisposition::NEW_BACKGROUND_TAB && |
| 395 disposition != WindowOpenDisposition::NEW_POPUP && | 396 disposition != WindowOpenDisposition::NEW_POPUP && |
| 396 disposition != WindowOpenDisposition::NEW_WINDOW && | 397 disposition != WindowOpenDisposition::NEW_WINDOW && |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 587 return g_factory.Pointer(); | 588 return g_factory.Pointer(); |
| 588 } | 589 } |
| 589 | 590 |
| 590 void WebNavigationAPI::OnListenerAdded(const EventListenerInfo& details) { | 591 void WebNavigationAPI::OnListenerAdded(const EventListenerInfo& details) { |
| 591 web_navigation_event_router_.reset(new WebNavigationEventRouter( | 592 web_navigation_event_router_.reset(new WebNavigationEventRouter( |
| 592 Profile::FromBrowserContext(browser_context_))); | 593 Profile::FromBrowserContext(browser_context_))); |
| 593 EventRouter::Get(browser_context_)->UnregisterObserver(this); | 594 EventRouter::Get(browser_context_)->UnregisterObserver(this); |
| 594 } | 595 } |
| 595 | 596 |
| 596 } // namespace extensions | 597 } // namespace extensions |
| OLD | NEW |