Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(476)

Unified Diff: chrome/browser/extensions/extension_file_browser_private_api.cc

Issue 7830024: CrOS - Fix file picker to route callbacks using TabContents (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/ui/views/extensions/extension_dialog.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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,
« no previous file with comments | « no previous file | chrome/browser/ui/views/extensions/extension_dialog.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698