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

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

Issue 10916160: Upstreaming SelectFileDialog for Android (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/android/tab_android.h ('k') | chrome/browser/platform_util_android.cc » ('j') | 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 391 matching lines...) Expand 10 before | Expand all | Expand 10 after
402 NOTREACHED(); 402 NOTREACHED();
403 } 403 }
404 404
405 FilePath default_file_name = params.default_file_name.IsAbsolute() ? 405 FilePath default_file_name = params.default_file_name.IsAbsolute() ?
406 params.default_file_name : 406 params.default_file_name :
407 profile_->last_selected_directory().Append(params.default_file_name); 407 profile_->last_selected_directory().Append(params.default_file_name);
408 408
409 gfx::NativeWindow owning_window = 409 gfx::NativeWindow owning_window =
410 platform_util::GetTopLevel(render_view_host_->GetView()->GetNativeView()); 410 platform_util::GetTopLevel(render_view_host_->GetView()->GetNativeView());
411 411
412 #if defined(OS_ANDROID)
413 // Android needs the original MIME types and an additional capture value.
414 std::vector<string16> accept_types(params.accept_types);
415 accept_types.push_back(params.capture);
416 #endif
417
412 select_file_dialog_->SelectFile( 418 select_file_dialog_->SelectFile(
413 dialog_type_, 419 dialog_type_,
414 params.title, 420 params.title,
415 default_file_name, 421 default_file_name,
416 select_file_types_.get(), 422 select_file_types_.get(),
417 select_file_types_.get() && !select_file_types_->extensions.empty() ? 423 select_file_types_.get() && !select_file_types_->extensions.empty() ?
418 1 : 0, // 1-based index of default extension to show. 424 1 : 0, // 1-based index of default extension to show.
419 FILE_PATH_LITERAL(""), 425 FILE_PATH_LITERAL(""),
420 owning_window, 426 owning_window,
421 #if defined(OS_ANDROID) 427 #if defined(OS_ANDROID)
422 const_cast<content::FileChooserParams*>(&params)); 428 &accept_types);
423 #else 429 #else
424 NULL); 430 NULL);
425 #endif 431 #endif
426 432
427 select_file_types_.reset(); 433 select_file_types_.reset();
428 } 434 }
429 435
430 // This method is called when we receive the last callback from the file 436 // This method is called when we receive the last callback from the file
431 // chooser dialog. Perform any cleanup and release the reference we added 437 // chooser dialog. Perform any cleanup and release the reference we added
432 // in RunFileChooser(). 438 // in RunFileChooser().
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 // A 1 character accept type will always be invalid (either a "." in the case 490 // A 1 character accept type will always be invalid (either a "." in the case
485 // of an extension or a "/" in the case of a MIME type). 491 // of an extension or a "/" in the case of a MIME type).
486 std::string unused; 492 std::string unused;
487 if (accept_type.length() <= 1 || 493 if (accept_type.length() <= 1 ||
488 StringToLowerASCII(accept_type) != accept_type || 494 StringToLowerASCII(accept_type) != accept_type ||
489 TrimWhitespaceASCII(accept_type, TRIM_ALL, &unused) != TRIM_NONE) { 495 TrimWhitespaceASCII(accept_type, TRIM_ALL, &unused) != TRIM_NONE) {
490 return false; 496 return false;
491 } 497 }
492 return true; 498 return true;
493 } 499 }
OLDNEW
« no previous file with comments | « chrome/browser/android/tab_android.h ('k') | chrome/browser/platform_util_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698