Commit 12342df8 authored by kinaba@chromium.org's avatar kinaba@chromium.org

Stop setting invalid value to the |tab_id| field of fileBrowserHandler API.

Since the very long long ago when we have moved file manager out of tabs
to a separate app window, it didn't have any tab_id associated,
and the existing code always assigned an invalid value (-1).

This CL removes the useless code. Since the field is defined to
be optional, it doesn't change the interface of the API.

BUG=312519

Review URL: https://codereview.chromium.org/101323002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@238376 0039d316-1c4b-4281-b951-d872f2087c98
parent e7f4d10d
...@@ -89,12 +89,10 @@ bool FileBrowserPrivateExecuteTaskFunction::RunImpl() { ...@@ -89,12 +89,10 @@ bool FileBrowserPrivateExecuteTaskFunction::RunImpl() {
file_urls.push_back(url); file_urls.push_back(url);
} }
const int32 tab_id = file_manager::util::GetTabId(dispatcher());
return file_manager::file_tasks::ExecuteFileTask( return file_manager::file_tasks::ExecuteFileTask(
GetProfile(), GetProfile(),
source_url(), source_url(),
extension_->id(), extension_->id(),
tab_id,
task, task,
file_urls, file_urls,
base::Bind(&FileBrowserPrivateExecuteTaskFunction::OnTaskExecuted, this)); base::Bind(&FileBrowserPrivateExecuteTaskFunction::OnTaskExecuted, this));
......
...@@ -235,12 +235,6 @@ content::WebContents* GetWebContents(ExtensionFunctionDispatcher* dispatcher) { ...@@ -235,12 +235,6 @@ content::WebContents* GetWebContents(ExtensionFunctionDispatcher* dispatcher) {
return web_contents; return web_contents;
} }
int32 GetTabId(ExtensionFunctionDispatcher* dispatcher) {
content::WebContents* web_contents = GetWebContents(dispatcher);
return web_contents ?
extensions::ExtensionTabUtil::GetTabId(web_contents) : 0;
}
base::FilePath GetLocalPathFromURL( base::FilePath GetLocalPathFromURL(
content::RenderViewHost* render_view_host, content::RenderViewHost* render_view_host,
Profile* profile, Profile* profile,
......
...@@ -48,10 +48,6 @@ void VolumeInfoToVolumeMetadata( ...@@ -48,10 +48,6 @@ void VolumeInfoToVolumeMetadata(
// NULL on error. // NULL on error.
content::WebContents* GetWebContents(ExtensionFunctionDispatcher* dispatcher); content::WebContents* GetWebContents(ExtensionFunctionDispatcher* dispatcher);
// Returns the ID of the tab associated with the dispatcher. Returns 0 on
// error.
int32 GetTabId(ExtensionFunctionDispatcher* dispatcher);
// Returns the local FilePath associated with |url|. If the file isn't of the // Returns the local FilePath associated with |url|. If the file isn't of the
// type FileSystemBackend handles, returns an empty // type FileSystemBackend handles, returns an empty
// FilePath. |render_view_host| and |profile| are needed to obtain the // FilePath. |render_view_host| and |profile| are needed to obtain the
......
...@@ -162,7 +162,6 @@ class FileBrowserHandlerExecutor { ...@@ -162,7 +162,6 @@ class FileBrowserHandlerExecutor {
public: public:
FileBrowserHandlerExecutor(Profile* profile, FileBrowserHandlerExecutor(Profile* profile,
const Extension* extension, const Extension* extension,
int32 tab_id,
const std::string& action_id); const std::string& action_id);
// Executes the task for each file. |done| will be run with the result. // Executes the task for each file. |done| will be run with the result.
...@@ -208,7 +207,6 @@ class FileBrowserHandlerExecutor { ...@@ -208,7 +207,6 @@ class FileBrowserHandlerExecutor {
Profile* profile_; Profile* profile_;
scoped_refptr<const Extension> extension_; scoped_refptr<const Extension> extension_;
int32 tab_id_;
const std::string action_id_; const std::string action_id_;
file_tasks::FileTaskFinishedCallback done_; file_tasks::FileTaskFinishedCallback done_;
base::WeakPtrFactory<FileBrowserHandlerExecutor> weak_ptr_factory_; base::WeakPtrFactory<FileBrowserHandlerExecutor> weak_ptr_factory_;
...@@ -277,11 +275,9 @@ FileBrowserHandlerExecutor::SetupFileAccessPermissions( ...@@ -277,11 +275,9 @@ FileBrowserHandlerExecutor::SetupFileAccessPermissions(
FileBrowserHandlerExecutor::FileBrowserHandlerExecutor( FileBrowserHandlerExecutor::FileBrowserHandlerExecutor(
Profile* profile, Profile* profile,
const Extension* extension, const Extension* extension,
int32 tab_id,
const std::string& action_id) const std::string& action_id)
: profile_(profile), : profile_(profile),
extension_(extension), extension_(extension),
tab_id_(tab_id),
action_id_(action_id), action_id_(action_id),
weak_ptr_factory_(this) { weak_ptr_factory_(this) {
} }
...@@ -404,8 +400,6 @@ void FileBrowserHandlerExecutor::SetupPermissionsAndDispatchEvent( ...@@ -404,8 +400,6 @@ void FileBrowserHandlerExecutor::SetupPermissionsAndDispatchEvent(
file_def->SetBoolean("fileIsDirectory", iter->is_directory); file_def->SetBoolean("fileIsDirectory", iter->is_directory);
} }
details->SetInteger("tab_id", tab_id_);
scoped_ptr<extensions::Event> event(new extensions::Event( scoped_ptr<extensions::Event> event(new extensions::Event(
"fileBrowserHandler.onExecute", event_args.Pass())); "fileBrowserHandler.onExecute", event_args.Pass()));
event->restrict_to_browser_context = profile_; event->restrict_to_browser_context = profile_;
...@@ -472,7 +466,6 @@ bool OpenFilesWithBrowser(Profile* profile, ...@@ -472,7 +466,6 @@ bool OpenFilesWithBrowser(Profile* profile,
bool ExecuteFileBrowserHandler( bool ExecuteFileBrowserHandler(
Profile* profile, Profile* profile,
const Extension* extension, const Extension* extension,
int32 tab_id,
const std::string& action_id, const std::string& action_id,
const std::vector<FileSystemURL>& file_urls, const std::vector<FileSystemURL>& file_urls,
const file_tasks::FileTaskFinishedCallback& done) { const file_tasks::FileTaskFinishedCallback& done) {
...@@ -488,7 +481,7 @@ bool ExecuteFileBrowserHandler( ...@@ -488,7 +481,7 @@ bool ExecuteFileBrowserHandler(
// The executor object will be self deleted on completion. // The executor object will be self deleted on completion.
(new FileBrowserHandlerExecutor( (new FileBrowserHandlerExecutor(
profile, extension, tab_id, action_id))->Execute(file_urls, done); profile, extension, action_id))->Execute(file_urls, done);
return true; return true;
} }
......
...@@ -56,7 +56,6 @@ FileBrowserHandlerList FindFileBrowserHandlers( ...@@ -56,7 +56,6 @@ FileBrowserHandlerList FindFileBrowserHandlers(
bool ExecuteFileBrowserHandler( bool ExecuteFileBrowserHandler(
Profile* profile, Profile* profile,
const extensions::Extension* extension, const extensions::Extension* extension,
int32 tab_id,
const std::string& action_id, const std::string& action_id,
const std::vector<fileapi::FileSystemURL>& file_urls, const std::vector<fileapi::FileSystemURL>& file_urls,
const file_tasks::FileTaskFinishedCallback& done); const file_tasks::FileTaskFinishedCallback& done);
......
...@@ -266,7 +266,6 @@ bool ParseTaskID(const std::string& task_id, TaskDescriptor* task) { ...@@ -266,7 +266,6 @@ bool ParseTaskID(const std::string& task_id, TaskDescriptor* task) {
bool ExecuteFileTask(Profile* profile, bool ExecuteFileTask(Profile* profile,
const GURL& source_url, const GURL& source_url,
const std::string& app_id, const std::string& app_id,
int32 tab_id,
const TaskDescriptor& task, const TaskDescriptor& task,
const std::vector<FileSystemURL>& file_urls, const std::vector<FileSystemURL>& file_urls,
const FileTaskFinishedCallback& done) { const FileTaskFinishedCallback& done) {
...@@ -296,7 +295,6 @@ bool ExecuteFileTask(Profile* profile, ...@@ -296,7 +295,6 @@ bool ExecuteFileTask(Profile* profile,
return file_browser_handlers::ExecuteFileBrowserHandler( return file_browser_handlers::ExecuteFileBrowserHandler(
profile, profile,
extension, extension,
tab_id,
task.action_id, task.action_id,
file_urls, file_urls,
done); done);
......
...@@ -237,8 +237,6 @@ typedef base::Callback<void(bool success)> FileTaskFinishedCallback; ...@@ -237,8 +237,6 @@ typedef base::Callback<void(bool success)> FileTaskFinishedCallback;
// profile - The profile used for making this function call. // profile - The profile used for making this function call.
// app_id - The ID of the app requesting the file task execution. // app_id - The ID of the app requesting the file task execution.
// source_url - The source URL which originates this function call. // source_url - The source URL which originates this function call.
// tab_id - The ID of the tab which originates this function call.
// This can be 0 if no tab is associated.
// task - See the comment at TaskDescriptor struct. // task - See the comment at TaskDescriptor struct.
// file_urls - URLs of the target files. // file_urls - URLs of the target files.
// done - The callback which will be called on completion. // done - The callback which will be called on completion.
...@@ -247,7 +245,6 @@ typedef base::Callback<void(bool success)> FileTaskFinishedCallback; ...@@ -247,7 +245,6 @@ typedef base::Callback<void(bool success)> FileTaskFinishedCallback;
bool ExecuteFileTask(Profile* profile, bool ExecuteFileTask(Profile* profile,
const GURL& source_url, const GURL& source_url,
const std::string& app_id, const std::string& app_id,
int32 tab_id,
const TaskDescriptor& task, const TaskDescriptor& task,
const std::vector<fileapi::FileSystemURL>& file_urls, const std::vector<fileapi::FileSystemURL>& file_urls,
const FileTaskFinishedCallback& done); const FileTaskFinishedCallback& done);
......
...@@ -98,7 +98,6 @@ void ExecuteFileTaskForUrl(Profile* profile, ...@@ -98,7 +98,6 @@ void ExecuteFileTaskForUrl(Profile* profile,
profile, profile,
source_url, source_url,
kFileManagerAppId, kFileManagerAppId,
0, // no tab id
task, task,
urls, urls,
file_tasks::FileTaskFinishedCallback()); file_tasks::FileTaskFinishedCallback());
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment