| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/ui/webui/net_export_ui.h" | 5 #include "chrome/browser/ui/webui/net_export_ui.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 293 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 293 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 294 file_writer_->GetFilePathToCompletedLog( | 294 file_writer_->GetFilePathToCompletedLog( |
| 295 base::Bind(&NetExportMessageHandler::ShowFileInShell, AsWeakPtr())); | 295 base::Bind(&NetExportMessageHandler::ShowFileInShell, AsWeakPtr())); |
| 296 } | 296 } |
| 297 | 297 |
| 298 void NetExportMessageHandler::FileSelected(const base::FilePath& path, | 298 void NetExportMessageHandler::FileSelected(const base::FilePath& path, |
| 299 int index, | 299 int index, |
| 300 void* params) { | 300 void* params) { |
| 301 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 301 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 302 DCHECK(select_file_dialog_); | 302 DCHECK(select_file_dialog_); |
| 303 select_file_dialog_ = nullptr; | |
| 304 *last_save_dir.Pointer() = path.DirName(); | 303 *last_save_dir.Pointer() = path.DirName(); |
| 305 | 304 |
| 306 file_writer_->StartNetLog(path, capture_mode_, GetURLRequestContexts()); | 305 file_writer_->StartNetLog(path, capture_mode_, GetURLRequestContexts()); |
| 306 |
| 307 // IMPORTANT: resetting the dialog may lead to the deletion of |path|, so keep |
| 308 // this line last. |
| 309 select_file_dialog_ = nullptr; |
| 307 } | 310 } |
| 308 | 311 |
| 309 void NetExportMessageHandler::FileSelectionCanceled(void* params) { | 312 void NetExportMessageHandler::FileSelectionCanceled(void* params) { |
| 310 DCHECK(select_file_dialog_); | 313 DCHECK(select_file_dialog_); |
| 311 select_file_dialog_ = nullptr; | 314 select_file_dialog_ = nullptr; |
| 312 } | 315 } |
| 313 | 316 |
| 314 void NetExportMessageHandler::OnNewState(const base::DictionaryValue& state) { | 317 void NetExportMessageHandler::OnNewState(const base::DictionaryValue& state) { |
| 315 NotifyUIWithState(state.CreateDeepCopy()); | 318 NotifyUIWithState(state.CreateDeepCopy()); |
| 316 } | 319 } |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 406 | 409 |
| 407 } // namespace | 410 } // namespace |
| 408 | 411 |
| 409 NetExportUI::NetExportUI(content::WebUI* web_ui) : WebUIController(web_ui) { | 412 NetExportUI::NetExportUI(content::WebUI* web_ui) : WebUIController(web_ui) { |
| 410 web_ui->AddMessageHandler(base::MakeUnique<NetExportMessageHandler>()); | 413 web_ui->AddMessageHandler(base::MakeUnique<NetExportMessageHandler>()); |
| 411 | 414 |
| 412 // Set up the chrome://net-export/ source. | 415 // Set up the chrome://net-export/ source. |
| 413 Profile* profile = Profile::FromWebUI(web_ui); | 416 Profile* profile = Profile::FromWebUI(web_ui); |
| 414 content::WebUIDataSource::Add(profile, CreateNetExportHTMLSource()); | 417 content::WebUIDataSource::Add(profile, CreateNetExportHTMLSource()); |
| 415 } | 418 } |
| OLD | NEW |