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

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

Issue 2688413007: Add display::GetDisplayNearestView (Closed)
Patch Set: add missing files Created 3 years, 10 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
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 <stddef.h> 7 #include <stddef.h>
8 8
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
11 11
12 #include "base/bind.h" 12 #include "base/bind.h"
13 #include "base/files/file_enumerator.h" 13 #include "base/files/file_enumerator.h"
14 #include "base/files/file_util.h" 14 #include "base/files/file_util.h"
15 #include "base/memory/ptr_util.h" 15 #include "base/memory/ptr_util.h"
16 #include "base/strings/string_split.h" 16 #include "base/strings/string_split.h"
17 #include "base/strings/string_util.h" 17 #include "base/strings/string_util.h"
18 #include "base/strings/utf_string_conversions.h" 18 #include "base/strings/utf_string_conversions.h"
19 #include "build/build_config.h" 19 #include "build/build_config.h"
20 #include "chrome/browser/browser_process.h" 20 #include "chrome/browser/browser_process.h"
21 #include "chrome/browser/platform_util.h"
22 #include "chrome/browser/profiles/profile.h" 21 #include "chrome/browser/profiles/profile.h"
23 #include "chrome/browser/profiles/profile_manager.h" 22 #include "chrome/browser/profiles/profile_manager.h"
24 #include "chrome/browser/ui/browser.h" 23 #include "chrome/browser/ui/browser.h"
25 #include "chrome/browser/ui/browser_list.h" 24 #include "chrome/browser/ui/browser_list.h"
26 #include "chrome/browser/ui/chrome_select_file_policy.h" 25 #include "chrome/browser/ui/chrome_select_file_policy.h"
27 #include "chrome/grit/generated_resources.h" 26 #include "chrome/grit/generated_resources.h"
28 #include "content/public/browser/browser_thread.h" 27 #include "content/public/browser/browser_thread.h"
29 #include "content/public/browser/notification_details.h" 28 #include "content/public/browser/notification_details.h"
30 #include "content/public/browser/notification_source.h" 29 #include "content/public/browser/notification_source.h"
31 #include "content/public/browser/notification_types.h" 30 #include "content/public/browser/notification_types.h"
32 #include "content/public/browser/render_frame_host.h" 31 #include "content/public/browser/render_frame_host.h"
33 #include "content/public/browser/render_process_host.h" 32 #include "content/public/browser/render_process_host.h"
34 #include "content/public/browser/render_view_host.h" 33 #include "content/public/browser/render_view_host.h"
35 #include "content/public/browser/render_widget_host.h" 34 #include "content/public/browser/render_widget_host.h"
36 #include "content/public/browser/render_widget_host_view.h" 35 #include "content/public/browser/render_widget_host_view.h"
37 #include "content/public/browser/storage_partition.h" 36 #include "content/public/browser/storage_partition.h"
38 #include "content/public/browser/web_contents.h" 37 #include "content/public/browser/web_contents.h"
39 #include "content/public/common/file_chooser_file_info.h" 38 #include "content/public/common/file_chooser_file_info.h"
40 #include "content/public/common/file_chooser_params.h" 39 #include "content/public/common/file_chooser_params.h"
41 #include "net/base/filename_util.h" 40 #include "net/base/filename_util.h"
42 #include "net/base/mime_util.h" 41 #include "net/base/mime_util.h"
43 #include "ui/base/l10n/l10n_util.h" 42 #include "ui/base/l10n/l10n_util.h"
43 #include "ui/gfx/view_util.h"
44 #include "ui/shell_dialogs/selected_file_info.h" 44 #include "ui/shell_dialogs/selected_file_info.h"
45 45
46 #if defined(OS_CHROMEOS) 46 #if defined(OS_CHROMEOS)
47 #include "chrome/browser/chromeos/file_manager/fileapi_util.h" 47 #include "chrome/browser/chromeos/file_manager/fileapi_util.h"
48 #include "content/public/browser/site_instance.h" 48 #include "content/public/browser/site_instance.h"
49 #endif 49 #endif
50 50
51 #if defined(FULL_SAFE_BROWSING) 51 #if defined(FULL_SAFE_BROWSING)
52 #include "chrome/browser/safe_browsing/download_protection_service.h" 52 #include "chrome/browser/safe_browsing/download_protection_service.h"
53 #include "chrome/browser/safe_browsing/safe_browsing_service.h" 53 #include "chrome/browser/safe_browsing/safe_browsing_service.h"
(...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after
584 case FileChooserParams::Save: 584 case FileChooserParams::Save:
585 dialog_type_ = ui::SelectFileDialog::SELECT_SAVEAS_FILE; 585 dialog_type_ = ui::SelectFileDialog::SELECT_SAVEAS_FILE;
586 break; 586 break;
587 default: 587 default:
588 // Prevent warning. 588 // Prevent warning.
589 dialog_type_ = ui::SelectFileDialog::SELECT_OPEN_FILE; 589 dialog_type_ = ui::SelectFileDialog::SELECT_OPEN_FILE;
590 NOTREACHED(); 590 NOTREACHED();
591 } 591 }
592 592
593 gfx::NativeWindow owning_window = 593 gfx::NativeWindow owning_window =
594 platform_util::GetTopLevel(web_contents_->GetNativeView()); 594 gfx::GetTopLevel(web_contents_->GetNativeView());
595 595
596 #if defined(OS_ANDROID) 596 #if defined(OS_ANDROID)
597 // Android needs the original MIME types and an additional capture value. 597 // Android needs the original MIME types and an additional capture value.
598 std::pair<std::vector<base::string16>, bool> accept_types = 598 std::pair<std::vector<base::string16>, bool> accept_types =
599 std::make_pair(params->accept_types, params->capture); 599 std::make_pair(params->accept_types, params->capture);
600 #endif 600 #endif
601 601
602 select_file_dialog_->SelectFile( 602 select_file_dialog_->SelectFile(
603 dialog_type_, params->title, default_file_path, select_file_types_.get(), 603 dialog_type_, params->title, default_file_path, select_file_types_.get(),
604 select_file_types_.get() && !select_file_types_->extensions.empty() 604 select_file_types_.get() && !select_file_types_->extensions.empty()
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
692 692
693 // static 693 // static
694 base::FilePath FileSelectHelper::GetSanitizedFileName( 694 base::FilePath FileSelectHelper::GetSanitizedFileName(
695 const base::FilePath& suggested_filename) { 695 const base::FilePath& suggested_filename) {
696 if (suggested_filename.empty()) 696 if (suggested_filename.empty())
697 return base::FilePath(); 697 return base::FilePath();
698 return net::GenerateFileName( 698 return net::GenerateFileName(
699 GURL(), std::string(), std::string(), suggested_filename.AsUTF8Unsafe(), 699 GURL(), std::string(), std::string(), suggested_filename.AsUTF8Unsafe(),
700 std::string(), l10n_util::GetStringUTF8(IDS_DEFAULT_DOWNLOAD_FILENAME)); 700 std::string(), l10n_util::GetStringUTF8(IDS_DEFAULT_DOWNLOAD_FILENAME));
701 } 701 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698