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

Side by Side Diff: chrome/browser/file_select_helper.cc

Issue 8909015: Implement RunFileChooser for ExtensionHost, so that file input elements work in (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/extensions/extension_host.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/file_select_helper.h" 5 #include "chrome/browser/file_select_helper.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 select_file_types_.reset( 294 select_file_types_.reset(
295 GetFileTypesFromAcceptType(params.accept_types)); 295 GetFileTypesFromAcceptType(params.accept_types));
296 296
297 BrowserThread::PostTask( 297 BrowserThread::PostTask(
298 BrowserThread::UI, FROM_HERE, 298 BrowserThread::UI, FROM_HERE,
299 base::Bind(&FileSelectHelper::RunFileChooserOnUIThread, this, params)); 299 base::Bind(&FileSelectHelper::RunFileChooserOnUIThread, this, params));
300 } 300 }
301 301
302 void FileSelectHelper::RunFileChooserOnUIThread( 302 void FileSelectHelper::RunFileChooserOnUIThread(
303 const content::FileChooserParams& params) { 303 const content::FileChooserParams& params) {
304 if (!render_view_host_ || !tab_contents_) 304 if (!render_view_host_ || !tab_contents_) {
305 // If the renderer was destroyed before we started, just cancel the
306 // operation.
307 RunFileChooserEnd();
305 return; 308 return;
309 }
306 310
307 if (!select_file_dialog_.get()) 311 if (!select_file_dialog_.get())
308 select_file_dialog_ = SelectFileDialog::Create(this); 312 select_file_dialog_ = SelectFileDialog::Create(this);
309 313
310 switch (params.mode) { 314 switch (params.mode) {
311 case content::FileChooserParams::Open: 315 case content::FileChooserParams::Open:
312 dialog_type_ = SelectFileDialog::SELECT_OPEN_FILE; 316 dialog_type_ = SelectFileDialog::SELECT_OPEN_FILE;
313 break; 317 break;
314 case content::FileChooserParams::OpenMultiple: 318 case content::FileChooserParams::OpenMultiple:
315 dialog_type_ = SelectFileDialog::SELECT_OPEN_MULTI_FILE; 319 dialog_type_ = SelectFileDialog::SELECT_OPEN_MULTI_FILE;
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 DCHECK(content::Source<TabContents>(source).ptr() == tab_contents_); 394 DCHECK(content::Source<TabContents>(source).ptr() == tab_contents_);
391 tab_contents_ = NULL; 395 tab_contents_ = NULL;
392 break; 396 break;
393 } 397 }
394 398
395 default: 399 default:
396 NOTREACHED(); 400 NOTREACHED();
397 } 401 }
398 } 402 }
399 403
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_host.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698