diff options
Diffstat (limited to 'chrome/browser/extensions/api/web_navigation')
-rw-r--r-- | chrome/browser/extensions/api/web_navigation/web_navigation_api.cc | 35 | ||||
-rw-r--r-- | chrome/browser/extensions/api/web_navigation/web_navigation_apitest.cc | 8 |
2 files changed, 25 insertions, 18 deletions
diff --git a/chrome/browser/extensions/api/web_navigation/web_navigation_api.cc b/chrome/browser/extensions/api/web_navigation/web_navigation_api.cc index a637e34..998130d 100644 --- a/chrome/browser/extensions/api/web_navigation/web_navigation_api.cc +++ b/chrome/browser/extensions/api/web_navigation/web_navigation_api.cc @@ -16,7 +16,7 @@ #include "chrome/browser/extensions/extension_tab_util.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/tab_contents/retargeting_details.h" -#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" +#include "chrome/browser/ui/tab_contents/tab_contents.h" #include "chrome/browser/view_type_utils.h" #include "chrome/common/chrome_notification_types.h" #include "chrome/common/url_constants.h" @@ -458,11 +458,10 @@ void WebNavigationEventRouter::Retargeting(const RetargetingDetails* details) { return; // If the WebContents was created as a response to an IPC from a renderer - // (and therefore doesn't yet have a wrapper), or if it isn't yet inserted + // (and therefore doesn't yet have a TabContents), or if it isn't yet inserted // into a tab strip, we need to delay the extension event until the // WebContents is fully initialized. - if ((TabContentsWrapper::GetCurrentWrapperForContents( - details->target_web_contents) == NULL) || + if (TabContents::FromWebContents(details->target_web_contents) == NULL || details->not_yet_in_tabstrip) { pending_web_contents_[details->target_web_contents] = PendingWebContents( @@ -731,14 +730,18 @@ bool GetFrameFunction::RunImpl() { result_.reset(Value::CreateNullValue()); - TabContentsWrapper* wrapper; - if (!ExtensionTabUtil::GetTabById( - tab_id, profile(), include_incognito(), NULL, NULL, &wrapper, NULL) || - !wrapper) { + TabContents* tab_contents; + if (!ExtensionTabUtil::GetTabById(tab_id, + profile(), + include_incognito(), + NULL, NULL, + &tab_contents, + NULL) || + !tab_contents) { return true; } - WebContents* web_contents = wrapper->web_contents(); + WebContents* web_contents = tab_contents->web_contents(); WebNavigationTabObserver* observer = WebNavigationTabObserver::Get(web_contents); DCHECK(observer); @@ -774,14 +777,18 @@ bool GetAllFramesFunction::RunImpl() { result_.reset(Value::CreateNullValue()); - TabContentsWrapper* wrapper; - if (!ExtensionTabUtil::GetTabById( - tab_id, profile(), include_incognito(), NULL, NULL, &wrapper, NULL) || - !wrapper) { + TabContents* tab_contents; + if (!ExtensionTabUtil::GetTabById(tab_id, + profile(), + include_incognito(), + NULL, NULL, + &tab_contents, + NULL) || + !tab_contents) { return true; } - WebContents* web_contents = wrapper->web_contents(); + WebContents* web_contents = tab_contents->web_contents(); WebNavigationTabObserver* observer = WebNavigationTabObserver::Get(web_contents); DCHECK(observer); diff --git a/chrome/browser/extensions/api/web_navigation/web_navigation_apitest.cc b/chrome/browser/extensions/api/web_navigation/web_navigation_apitest.cc index fef3a5b..1ebf8bb 100644 --- a/chrome/browser/extensions/api/web_navigation/web_navigation_apitest.cc +++ b/chrome/browser/extensions/api/web_navigation/web_navigation_apitest.cc @@ -183,7 +183,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionApiTest, WebNavigationUserAction) { ASSERT_TRUE( RunExtensionSubtest("webnavigation", "test_userAction.html")) << message_; - WebContents* tab = browser()->GetSelectedWebContents(); + WebContents* tab = browser()->GetActiveWebContents(); ui_test_utils::WaitForLoadStop(tab); ResultCatcher catcher; @@ -221,7 +221,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionApiTest, WebNavigationRequestOpenTab) { ASSERT_TRUE(RunExtensionSubtest("webnavigation", "test_requestOpenTab.html")) << message_; - WebContents* tab = browser()->GetSelectedWebContents(); + WebContents* tab = browser()->GetActiveWebContents(); ui_test_utils::WaitForLoadStop(tab); ResultCatcher catcher; @@ -258,7 +258,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionApiTest, WebNavigationTargetBlank) { ASSERT_TRUE(RunExtensionSubtest("webnavigation", "test_targetBlank.html")) << message_; - WebContents* tab = browser()->GetSelectedWebContents(); + WebContents* tab = browser()->GetActiveWebContents(); ui_test_utils::WaitForLoadStop(tab); ResultCatcher catcher; @@ -304,7 +304,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionApiTest, WebNavigationTargetBlankIncognito) { ui_test_utils::OpenURLOffTheRecord(browser()->profile(), url); WebContents* tab = browser::FindTabbedBrowser( browser()->profile()->GetOffTheRecordProfile(), false)-> - GetSelectedWebContents(); + GetActiveWebContents(); // There's a link with target=_blank on a.html. Click on it to open it in a // new tab. |