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

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

Issue 10667026: Start consolidating cross-port file selection code into ui/base/dialogs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 6 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
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"
11 #include "base/platform_file.h" 11 #include "base/platform_file.h"
12 #include "base/string_split.h" 12 #include "base/string_split.h"
13 #include "base/string_util.h" 13 #include "base/string_util.h"
14 #include "base/utf_string_conversions.h" 14 #include "base/utf_string_conversions.h"
15 #include "chrome/browser/chrome_select_file_policy.h"
15 #include "chrome/browser/platform_util.h" 16 #include "chrome/browser/platform_util.h"
16 #include "chrome/browser/profiles/profile.h" 17 #include "chrome/browser/profiles/profile.h"
17 #include "chrome/browser/ui/browser.h" 18 #include "chrome/browser/ui/browser.h"
18 #include "chrome/browser/ui/browser_list.h" 19 #include "chrome/browser/ui/browser_list.h"
19 #include "content/public/browser/notification_details.h" 20 #include "content/public/browser/notification_details.h"
20 #include "content/public/browser/notification_source.h" 21 #include "content/public/browser/notification_source.h"
21 #include "content/public/browser/notification_types.h" 22 #include "content/public/browser/notification_types.h"
22 #include "content/public/browser/render_view_host.h" 23 #include "content/public/browser/render_view_host.h"
23 #include "content/public/browser/render_widget_host_view.h" 24 #include "content/public/browser/render_widget_host_view.h"
24 #include "content/public/browser/web_contents.h" 25 #include "content/public/browser/web_contents.h"
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 gfx::NativeWindow owning_window = 399 gfx::NativeWindow owning_window =
399 platform_util::GetTopLevel(render_view_host_->GetView()->GetNativeView()); 400 platform_util::GetTopLevel(render_view_host_->GetView()->GetNativeView());
400 401
401 select_file_dialog_->SelectFile( 402 select_file_dialog_->SelectFile(
402 dialog_type_, 403 dialog_type_,
403 params.title, 404 params.title,
404 default_file_name, 405 default_file_name,
405 select_file_types_.get(), 406 select_file_types_.get(),
406 select_file_types_.get() ? 1 : 0, // 1-based index. 407 select_file_types_.get() ? 1 : 0, // 1-based index.
407 FILE_PATH_LITERAL(""), 408 FILE_PATH_LITERAL(""),
408 web_contents_, 409 ChromeSelectFilePolicy::DisplayInfobarCallback(web_contents_),
409 owning_window, 410 owning_window,
410 #if defined(OS_ANDROID) 411 #if defined(OS_ANDROID)
411 const_cast<content::FileChooserParams*>(&params)); 412 const_cast<content::FileChooserParams*>(&params));
412 #else 413 #else
413 NULL); 414 NULL);
414 #endif 415 #endif
415 416
416 select_file_types_.reset(); 417 select_file_types_.reset();
417 } 418 }
418 419
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
473 // A 1 character accept type will always be invalid (either a "." in the case 474 // A 1 character accept type will always be invalid (either a "." in the case
474 // of an extension or a "/" in the case of a MIME type). 475 // of an extension or a "/" in the case of a MIME type).
475 std::string unused; 476 std::string unused;
476 if (accept_type.length() <= 1 || 477 if (accept_type.length() <= 1 ||
477 StringToLowerASCII(accept_type) != accept_type || 478 StringToLowerASCII(accept_type) != accept_type ||
478 TrimWhitespaceASCII(accept_type, TRIM_ALL, &unused) != TRIM_NONE) { 479 TrimWhitespaceASCII(accept_type, TRIM_ALL, &unused) != TRIM_NONE) {
479 return false; 480 return false;
480 } 481 }
481 return true; 482 return true;
482 } 483 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698