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

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

Issue 10698053: Breaks compile on Linux Aura (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 5 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/platform_util.h" 15 #include "chrome/browser/platform_util.h"
16 #include "chrome/browser/profiles/profile.h" 16 #include "chrome/browser/profiles/profile.h"
17 #include "chrome/browser/ui/browser.h" 17 #include "chrome/browser/ui/browser.h"
18 #include "chrome/browser/ui/browser_list.h" 18 #include "chrome/browser/ui/browser_list.h"
19 #include "chrome/browser/ui/chrome_select_file_policy.h"
20 #include "content/public/browser/notification_details.h" 19 #include "content/public/browser/notification_details.h"
21 #include "content/public/browser/notification_source.h" 20 #include "content/public/browser/notification_source.h"
22 #include "content/public/browser/notification_types.h" 21 #include "content/public/browser/notification_types.h"
23 #include "content/public/browser/render_view_host.h" 22 #include "content/public/browser/render_view_host.h"
24 #include "content/public/browser/render_widget_host_view.h" 23 #include "content/public/browser/render_widget_host_view.h"
25 #include "content/public/browser/web_contents.h" 24 #include "content/public/browser/web_contents.h"
26 #include "content/public/common/file_chooser_params.h" 25 #include "content/public/common/file_chooser_params.h"
27 #include "grit/generated_resources.h" 26 #include "grit/generated_resources.h"
28 #include "net/base/mime_util.h" 27 #include "net/base/mime_util.h"
29 #include "ui/base/dialogs/selected_file_info.h" 28 #include "ui/base/dialogs/selected_file_info.h"
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 364
366 void FileSelectHelper::RunFileChooserOnUIThread( 365 void FileSelectHelper::RunFileChooserOnUIThread(
367 const FileChooserParams& params) { 366 const FileChooserParams& params) {
368 if (!render_view_host_ || !web_contents_) { 367 if (!render_view_host_ || !web_contents_) {
369 // If the renderer was destroyed before we started, just cancel the 368 // If the renderer was destroyed before we started, just cancel the
370 // operation. 369 // operation.
371 RunFileChooserEnd(); 370 RunFileChooserEnd();
372 return; 371 return;
373 } 372 }
374 373
375 select_file_dialog_ = SelectFileDialog::Create( 374 if (!select_file_dialog_.get())
376 this, new ChromeSelectFilePolicy(web_contents_)); 375 select_file_dialog_ = SelectFileDialog::Create(this);
377 376
378 switch (params.mode) { 377 switch (params.mode) {
379 case FileChooserParams::Open: 378 case FileChooserParams::Open:
380 dialog_type_ = SelectFileDialog::SELECT_OPEN_FILE; 379 dialog_type_ = SelectFileDialog::SELECT_OPEN_FILE;
381 break; 380 break;
382 case FileChooserParams::OpenMultiple: 381 case FileChooserParams::OpenMultiple:
383 dialog_type_ = SelectFileDialog::SELECT_OPEN_MULTI_FILE; 382 dialog_type_ = SelectFileDialog::SELECT_OPEN_MULTI_FILE;
384 break; 383 break;
385 case FileChooserParams::OpenFolder: 384 case FileChooserParams::OpenFolder:
386 dialog_type_ = SelectFileDialog::SELECT_FOLDER; 385 dialog_type_ = SelectFileDialog::SELECT_FOLDER;
(...skipping 12 matching lines...) Expand all
399 gfx::NativeWindow owning_window = 398 gfx::NativeWindow owning_window =
400 platform_util::GetTopLevel(render_view_host_->GetView()->GetNativeView()); 399 platform_util::GetTopLevel(render_view_host_->GetView()->GetNativeView());
401 400
402 select_file_dialog_->SelectFile( 401 select_file_dialog_->SelectFile(
403 dialog_type_, 402 dialog_type_,
404 params.title, 403 params.title,
405 default_file_name, 404 default_file_name,
406 select_file_types_.get(), 405 select_file_types_.get(),
407 select_file_types_.get() ? 1 : 0, // 1-based index. 406 select_file_types_.get() ? 1 : 0, // 1-based index.
408 FILE_PATH_LITERAL(""), 407 FILE_PATH_LITERAL(""),
408 web_contents_,
409 owning_window, 409 owning_window,
410 #if defined(OS_ANDROID) 410 #if defined(OS_ANDROID)
411 const_cast<content::FileChooserParams*>(&params)); 411 const_cast<content::FileChooserParams*>(&params));
412 #else 412 #else
413 NULL); 413 NULL);
414 #endif 414 #endif
415 415
416 select_file_types_.reset(); 416 select_file_types_.reset();
417 } 417 }
418 418
(...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 473 // 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). 474 // of an extension or a "/" in the case of a MIME type).
475 std::string unused; 475 std::string unused;
476 if (accept_type.length() <= 1 || 476 if (accept_type.length() <= 1 ||
477 StringToLowerASCII(accept_type) != accept_type || 477 StringToLowerASCII(accept_type) != accept_type ||
478 TrimWhitespaceASCII(accept_type, TRIM_ALL, &unused) != TRIM_NONE) { 478 TrimWhitespaceASCII(accept_type, TRIM_ALL, &unused) != TRIM_NONE) {
479 return false; 479 return false;
480 } 480 }
481 return true; 481 return true;
482 } 482 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/file_system/file_system_api.cc ('k') | chrome/browser/ui/browser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698