OLD | NEW |
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/debugger/devtools_file_helper.h" | 5 #include "chrome/browser/debugger/devtools_file_helper.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/callback.h" |
8 #include "base/file_util.h" | 9 #include "base/file_util.h" |
9 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
10 #include "base/md5.h" | 11 #include "base/md5.h" |
11 #include "base/value_conversions.h" | 12 #include "base/value_conversions.h" |
12 #include "chrome/browser/browser_process.h" | 13 #include "chrome/browser/browser_process.h" |
13 #include "chrome/browser/download/download_prefs.h" | 14 #include "chrome/browser/download/download_prefs.h" |
14 #include "chrome/browser/prefs/pref_service.h" | 15 #include "chrome/browser/prefs/pref_service.h" |
15 #include "chrome/browser/prefs/scoped_user_pref_update.h" | 16 #include "chrome/browser/prefs/scoped_user_pref_update.h" |
16 #include "chrome/browser/profiles/profile.h" | 17 #include "chrome/browser/profiles/profile.h" |
17 #include "chrome/browser/ui/select_file_dialog.h" | 18 #include "chrome/browser/ui/select_file_dialog.h" |
(...skipping 27 matching lines...) Expand all Loading... |
45 | 46 |
46 url_ = url; | 47 url_ = url; |
47 content_ = content; | 48 content_ = content; |
48 | 49 |
49 select_file_dialog_->SelectFile(SelectFileDialog::SELECT_SAVEAS_FILE, | 50 select_file_dialog_->SelectFile(SelectFileDialog::SELECT_SAVEAS_FILE, |
50 string16(), | 51 string16(), |
51 initial_path, | 52 initial_path, |
52 NULL, | 53 NULL, |
53 0, | 54 0, |
54 FILE_PATH_LITERAL(""), | 55 FILE_PATH_LITERAL(""), |
55 NULL, | 56 base::Closure(), |
56 NULL, | 57 NULL, |
57 NULL); | 58 NULL); |
58 } | 59 } |
59 | 60 |
60 // SelectFileDialog::Listener implementation. | 61 // SelectFileDialog::Listener implementation. |
61 virtual void FileSelected(const FilePath& path, | 62 virtual void FileSelected(const FilePath& path, |
62 int index, void* params) { | 63 int index, void* params) { |
63 if (helper_) | 64 if (helper_) |
64 helper_->FileSelected(url_, path, content_); | 65 helper_->FileSelected(url_, path, content_); |
65 Release(); // Balanced in ::Show. | 66 Release(); // Balanced in ::Show. |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 files_map->SetWithoutPathExpansion(base::MD5String(url), | 182 files_map->SetWithoutPathExpansion(base::MD5String(url), |
182 base::CreateFilePathValue(path)); | 183 base::CreateFilePathValue(path)); |
183 delegate_->FileSavedAs(url); | 184 delegate_->FileSavedAs(url); |
184 | 185 |
185 BrowserThread::PostTask( | 186 BrowserThread::PostTask( |
186 BrowserThread::FILE, FROM_HERE, | 187 BrowserThread::FILE, FROM_HERE, |
187 base::Bind(&DevToolsFileHelper::WriteFile, | 188 base::Bind(&DevToolsFileHelper::WriteFile, |
188 path, | 189 path, |
189 content)); | 190 content)); |
190 } | 191 } |
OLD | NEW |