1diff --git chrome/browser/ui/BUILD.gn chrome/browser/ui/BUILD.gn 2index c1f030ecb40ec..1ce574eac188f 100644 3--- chrome/browser/ui/BUILD.gn 4+++ chrome/browser/ui/BUILD.gn 5@@ -10,6 +10,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@@ -369,6 +370,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@@ -391,6 +396,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@@ -5210,6 +5216,7 @@ static_library("ui") { 33 if (enable_basic_printing) { 34 deps += [ 35 "//components/printing/browser", 36+ "//components/printing/common:mojo_interfaces", 37 "//printing", 38 ] 39 } 40diff --git chrome/browser/ui/webui/net_export_ui.cc chrome/browser/ui/webui/net_export_ui.cc 41index c5e34303668cb..8e376848fc7d5 100644 42--- chrome/browser/ui/webui/net_export_ui.cc 43+++ chrome/browser/ui/webui/net_export_ui.cc 44@@ -22,6 +22,7 @@ 45 #include "base/task/single_thread_task_runner.h" 46 #include "base/values.h" 47 #include "build/build_config.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@@ -45,6 +46,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_dialog_util.h" 58+#endif 59+ 60 #if BUILDFLAG(IS_ANDROID) 61 #include "components/browser_ui/share/android/intent_helper.h" 62 #endif 63@@ -142,6 +147,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 raw_ptr<net_log::NetExportFileWriter> file_writer_; 76 77@@ -235,6 +247,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@@ -251,6 +270,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@@ -260,6 +280,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@@ -375,6 +396,38 @@ 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+ base::FilePath initial_dir; 116+ if (!last_save_dir.Pointer()->empty()) 117+ initial_dir = *last_save_dir.Pointer(); 118+ base::FilePath initial_path = 119+ initial_dir.Append(FILE_PATH_LITERAL("chrome-net-export-log.json")); 120+ 121+ blink::mojom::FileChooserParams params; 122+ params.mode = blink::mojom::FileChooserParams::Mode::kSave; 123+ params.default_file_name = initial_path; 124+ params.accept_types.push_back( 125+ alloy::FilePathTypeToString16(initial_path.Extension())); 126+ 127+ alloy::RunFileChooser(web_contents, params, 128+ base::BindOnce(&NetExportMessageHandler::SaveAsDialogDismissed, 129+ weak_ptr_factory_.GetWeakPtr())); 130+} 131+ 132+void NetExportMessageHandler::SaveAsDialogDismissed( 133+ int selected_accept_filter, 134+ const std::vector<base::FilePath>& file_paths) { 135+ if (file_paths.size() == 1) { 136+ *last_save_dir.Pointer() = file_paths[0].DirName(); 137+ StartNetLog(file_paths[0]); 138+ } 139+} 140+ 141+#endif // BUILDFLAG(ENABLE_CEF) 142+ 143 } // namespace 144 145 NetExportUI::NetExportUI(content::WebUI* web_ui) : WebUIController(web_ui) { 146