Index: chrome/browser/extensions/extension_file_browser_private_api.cc |
diff --git a/chrome/browser/extensions/extension_file_browser_private_api.cc b/chrome/browser/extensions/extension_file_browser_private_api.cc |
index 2cd65da083177b01e0b0484afcc2b369ffd44fc7..206d5bf882d1a62d2be85607772a8a7a54bab009 100644 |
--- a/chrome/browser/extensions/extension_file_browser_private_api.cc |
+++ b/chrome/browser/extensions/extension_file_browser_private_api.cc |
@@ -907,23 +907,21 @@ FileBrowserFunction::~FileBrowserFunction() { |
} |
int32 FileBrowserFunction::GetTabId() const { |
- int32 tab_id = 0; |
if (!dispatcher()) { |
- NOTREACHED(); |
- return tab_id; |
+ LOG(WARNING) << "No dispatcher"; |
+ return 0; |
} |
- |
- // TODO(jamescook): This is going to fail when we switch to tab-modal |
- // dialogs. Figure out a way to find which SelectFileDialog::Listener |
- // to call from inside these extension FileBrowserFunctions. |
- Browser* browser = |
- const_cast<FileBrowserFunction*>(this)->GetCurrentBrowser(); |
- if (browser) { |
- TabContents* contents = browser->GetSelectedTabContents(); |
- if (contents) |
- tab_id = ExtensionTabUtil::GetTabId(contents); |
+ if (!dispatcher()->delegate()) { |
+ LOG(WARNING) << "No delegate"; |
+ return 0; |
+ } |
+ TabContents* tab_contents = |
+ dispatcher()->delegate()->GetAssociatedTabContents(); |
+ if (!tab_contents) { |
+ LOG(WARNING) << "No associated tab contents"; |
+ return 0; |
} |
- return tab_id; |
+ return ExtensionTabUtil::GetTabId(tab_contents); |
} |
// GetFileSystemRootPathOnFileThread can only be called from the file thread, |