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

Side by Side Diff: chrome/browser/ui/webui/net_export_ui.cc

Issue 2863283002: Fix a crash on Chrome OS when selecting a file in chrome://net-export/ (Closed)
Patch Set: Created 3 years, 7 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698