| Index: chrome/browser/ui/views/select_file_dialog_extension.cc
|
| diff --git a/chrome/browser/ui/views/select_file_dialog_extension.cc b/chrome/browser/ui/views/select_file_dialog_extension.cc
|
| index a696d2ac942b2c8ee1f6e9083086994e1c4071a2..8401708f265e605276e4708fed383e65e9518fed 100644
|
| --- a/chrome/browser/ui/views/select_file_dialog_extension.cc
|
| +++ b/chrome/browser/ui/views/select_file_dialog_extension.cc
|
| @@ -27,7 +27,6 @@
|
| #include "chrome/browser/ui/browser_window.h"
|
| #include "chrome/browser/ui/chrome_select_file_policy.h"
|
| #include "chrome/browser/ui/extensions/shell_window.h"
|
| -#include "chrome/browser/ui/tab_contents/tab_contents.h"
|
| #include "chrome/browser/ui/views/extensions/extension_dialog.h"
|
| #include "content/public/browser/browser_thread.h"
|
| #include "ui/base/dialogs/selected_file_info.h"
|
| @@ -256,19 +255,19 @@ void SelectFileDialogExtension::SelectFileImpl(
|
| // The base window to associate the dialog with.
|
| BaseWindow* base_window = NULL;
|
|
|
| - // The tab contents to associate the dialog with.
|
| - const TabContents* tab = NULL;
|
| + // The web contents to associate the dialog with.
|
| + content::WebContents* web_contents = NULL;
|
|
|
| // First try to find a Browser using the supplied owner_window. If no owner
|
| // window has been supplied, this is running from a background page and should
|
| // be associated with the last active browser.
|
| - Browser* owner_browser = (owner_window ?
|
| + Browser* owner_browser = owner_window ?
|
| browser::FindBrowserWithWindow(owner_window) :
|
| - BrowserList::GetLastActive());
|
| + BrowserList::GetLastActive();
|
| if (owner_browser) {
|
| base_window = owner_browser->window();
|
| - tab = chrome::GetActiveTabContents(owner_browser);
|
| - profile_ = tab->profile();
|
| + web_contents = chrome::GetActiveWebContents(owner_browser);
|
| + profile_ = Profile::FromBrowserContext(web_contents->GetBrowserContext());
|
| } else if (owner_window) {
|
| // If an owner_window was supplied but we couldn't find a browser, this
|
| // could be for a shell window.
|
| @@ -285,7 +284,7 @@ void SelectFileDialogExtension::SelectFileImpl(
|
| owner_window);
|
| if (shell_window) {
|
| base_window = shell_window->GetBaseWindow();
|
| - tab = shell_window->tab_contents();
|
| + web_contents = shell_window->web_contents();
|
| profile_ = *i;
|
| break;
|
| }
|
| @@ -298,13 +297,11 @@ void SelectFileDialogExtension::SelectFileImpl(
|
| }
|
| DCHECK(profile_);
|
|
|
| - // Check if we have another dialog opened in the tab. It's unlikely, but
|
| - // possible. If there is no tab contents use a tab_id of 0. A dialog without
|
| - // an associated tab contents will be shown fully screen; only one at a time
|
| + // Check if we have another dialog opened for the contents. It's unlikely, but
|
| + // possible. If there is no web contents use a tab_id of -1. A dialog without
|
| + // an associated web contents will be shown full-screen; only one at a time
|
| // is allowed in this state.
|
| - int32 tab_id = tab ? SessionTabHelper::FromWebContents(tab->web_contents())->
|
| - session_id().id()
|
| - : 0;
|
| + int32 tab_id = SessionID::IdForTab(web_contents);
|
| if (PendingExists(tab_id)) {
|
| DLOG(WARNING) << "Pending dialog exists with id " << tab_id;
|
| return;
|
| @@ -337,7 +334,7 @@ void SelectFileDialogExtension::SelectFileImpl(
|
| default_extension);
|
|
|
| ExtensionDialog* dialog = ExtensionDialog::Show(file_browser_url,
|
| - base_window, profile_, tab->web_contents(),
|
| + base_window, profile_, web_contents,
|
| kFileManagerWidth, kFileManagerHeight,
|
| #if defined(USE_AURA)
|
| file_manager_util::GetTitleFromType(type),
|
|
|