1diff --git chrome/browser/ui/BUILD.gn chrome/browser/ui/BUILD.gn 2index 5c150b1b020e..acd30a6f485d 100644 3--- chrome/browser/ui/BUILD.gn 4+++ chrome/browser/ui/BUILD.gn 5@@ -12,6 +12,7 @@ import("//build/config/features.gni") 6 import("//build/config/linux/gtk/gtk.gni") 7 import("//build/config/ozone.gni") 8 import("//build/config/ui.gni") 9+import("//cef/libcef/features/features.gni") 10 import("//chrome/browser/buildflags.gni") 11 import("//chrome/common/features.gni") 12 import("//chromeos/assistant/assistant.gni") 13@@ -335,6 +336,10 @@ static_library("ui") { 14 "//build/config/compiler:wexit_time_destructors", 15 ] 16 17+ if (enable_cef) { 18+ configs += [ "//cef/libcef/features:config" ] 19+ } 20+ 21 # Since browser and browser_ui actually depend on each other, 22 # we must omit the dependency from browser_ui to browser. 23 # However, this means browser_ui and browser should more or less 24@@ -357,6 +362,7 @@ static_library("ui") { 25 "//build:branding_buildflags", 26 "//build:chromeos_buildflags", 27 "//cc/paint", 28+ "//cef/libcef/features", 29 "//chrome:extra_resources", 30 "//chrome:resources", 31 "//chrome:strings", 32@@ -1609,6 +1615,7 @@ static_library("ui") { 33 "//components/page_load_metrics/browser", 34 "//components/performance_manager:site_data_proto", 35 "//components/printing/browser", 36+ "//components/printing/common:mojo_interfaces", 37 "//components/profile_metrics", 38 "//components/reading_list/features:flags", 39 "//components/safe_browsing/core/common:safe_browsing_policy_handler", 40diff --git chrome/browser/ui/webui/net_export_ui.cc chrome/browser/ui/webui/net_export_ui.cc 41index a12ad7b5e7eb..9dba0f664231 100644 42--- chrome/browser/ui/webui/net_export_ui.cc 43+++ chrome/browser/ui/webui/net_export_ui.cc 44@@ -21,6 +21,7 @@ 45 #include "base/strings/string_util.h" 46 #include "base/strings/utf_string_conversions.h" 47 #include "base/values.h" 48+#include "cef/libcef/features/runtime.h" 49 #include "chrome/browser/browser_process.h" 50 #include "chrome/browser/download/download_prefs.h" 51 #include "chrome/browser/net/net_export_helper.h" 52@@ -44,6 +45,10 @@ 53 #include "net/log/net_log_capture_mode.h" 54 #include "ui/shell_dialogs/select_file_dialog.h" 55 56+#if BUILDFLAG(ENABLE_CEF) 57+#include "cef/libcef/browser/alloy/alloy_browser_host_impl.h" 58+#endif 59+ 60 #if defined(OS_ANDROID) 61 #include "chrome/browser/android/intent_helper.h" 62 #endif 63@@ -136,6 +141,13 @@ class NetExportMessageHandler 64 // NetLog file. 65 void ShowSelectFileDialog(const base::FilePath& default_path); 66 67+#if BUILDFLAG(ENABLE_CEF) 68+ void ShowCefSaveAsDialog(content::WebContents* web_contents); 69+ void SaveAsDialogDismissed( 70+ int selected_accept_filter, 71+ const std::vector<base::FilePath>& file_paths); 72+#endif 73+ 74 // Cached pointer to SystemNetworkContextManager's NetExportFileWriter. 75 net_log::NetExportFileWriter* file_writer_; 76 77@@ -230,6 +242,13 @@ void NetExportMessageHandler::OnStartNetLog(const base::ListValue* list) { 78 if (UsingMobileUI()) { 79 StartNetLog(base::FilePath()); 80 } else { 81+#if BUILDFLAG(ENABLE_CEF) 82+ if (cef::IsAlloyRuntimeEnabled()) { 83+ ShowCefSaveAsDialog(web_ui()->GetWebContents()); 84+ return; 85+ } 86+#endif 87+ 88 base::FilePath initial_dir = last_save_dir.Pointer()->empty() ? 89 DownloadPrefs::FromBrowserContext( 90 web_ui()->GetWebContents()->GetBrowserContext())->DownloadPath() : 91@@ -246,6 +265,7 @@ void NetExportMessageHandler::OnStopNetLog(const base::ListValue* list) { 92 std::unique_ptr<base::DictionaryValue> ui_thread_polled_data( 93 new base::DictionaryValue()); 94 95+ if (!cef::IsAlloyRuntimeEnabled()) { 96 Profile* profile = Profile::FromWebUI(web_ui()); 97 SetIfNotNull(ui_thread_polled_data.get(), "prerenderInfo", 98 chrome_browser_net::GetPrerenderInfo(profile)); 99@@ -255,6 +275,7 @@ void NetExportMessageHandler::OnStopNetLog(const base::ListValue* list) { 100 SetIfNotNull(ui_thread_polled_data.get(), "serviceProviders", 101 chrome_browser_net::GetWindowsServiceProviders()); 102 #endif 103+ } 104 105 file_writer_->StopNetLog(std::move(ui_thread_polled_data)); 106 } 107@@ -372,6 +393,42 @@ void NetExportMessageHandler::ShowSelectFileDialog( 108 &file_type_info, 0, base::FilePath::StringType(), owning_window, nullptr); 109 } 110 111+#if BUILDFLAG(ENABLE_CEF) 112+ 113+void NetExportMessageHandler::ShowCefSaveAsDialog( 114+ content::WebContents* web_contents) { 115+ CefRefPtr<AlloyBrowserHostImpl> cef_browser = 116+ AlloyBrowserHostImpl::GetBrowserForContents(web_contents); 117+ if (!cef_browser) 118+ return; 119+ 120+ base::FilePath initial_dir; 121+ if (!last_save_dir.Pointer()->empty()) 122+ initial_dir = *last_save_dir.Pointer(); 123+ base::FilePath initial_path = 124+ initial_dir.Append(FILE_PATH_LITERAL("chrome-net-export-log.json")); 125+ 126+ CefFileDialogRunner::FileChooserParams params; 127+ params.mode = blink::mojom::FileChooserParams::Mode::kSave; 128+ params.default_file_name = initial_path; 129+ params.accept_types.push_back(CefString(initial_path.Extension())); 130+ 131+ cef_browser->RunFileChooser( 132+ params, base::Bind(&NetExportMessageHandler::SaveAsDialogDismissed, 133+ weak_ptr_factory_.GetWeakPtr())); 134+} 135+ 136+void NetExportMessageHandler::SaveAsDialogDismissed( 137+ int selected_accept_filter, 138+ const std::vector<base::FilePath>& file_paths) { 139+ if (file_paths.size() == 1) { 140+ *last_save_dir.Pointer() = file_paths[0].DirName(); 141+ StartNetLog(file_paths[0]); 142+ } 143+} 144+ 145+#endif // BUILDFLAG(ENABLE_CEF) 146+ 147 } // namespace 148 149 NetExportUI::NetExportUI(content::WebUI* web_ui) : WebUIController(web_ui) { 150