| 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 <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 return; | 130 return; |
| 131 } | 131 } |
| 132 | 132 |
| 133 if (save_as_dialog_) | 133 if (save_as_dialog_) |
| 134 save_as_dialog_->ResetHelper(); | 134 save_as_dialog_->ResetHelper(); |
| 135 | 135 |
| 136 const DictionaryValue* file_map = | 136 const DictionaryValue* file_map = |
| 137 profile_->GetPrefs()->GetDictionary(prefs::kDevToolsEditedFiles); | 137 profile_->GetPrefs()->GetDictionary(prefs::kDevToolsEditedFiles); |
| 138 FilePath initial_path; | 138 FilePath initial_path; |
| 139 | 139 |
| 140 Value* path_value; | 140 const Value* path_value; |
| 141 if (file_map->Get(base::MD5String(url), &path_value)) | 141 if (file_map->Get(base::MD5String(url), &path_value)) |
| 142 base::GetValueAsFilePath(*path_value, &initial_path); | 142 base::GetValueAsFilePath(*path_value, &initial_path); |
| 143 | 143 |
| 144 if (initial_path.empty()) { | 144 if (initial_path.empty()) { |
| 145 GURL gurl(url); | 145 GURL gurl(url); |
| 146 std::string suggested_file_name = gurl.is_valid() ? | 146 std::string suggested_file_name = gurl.is_valid() ? |
| 147 gurl.ExtractFileName() : url; | 147 gurl.ExtractFileName() : url; |
| 148 | 148 |
| 149 if (suggested_file_name.length() > 20) | 149 if (suggested_file_name.length() > 20) |
| 150 suggested_file_name = suggested_file_name.substr(0, 20); | 150 suggested_file_name = suggested_file_name.substr(0, 20); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 files_map->SetWithoutPathExpansion(base::MD5String(url), | 190 files_map->SetWithoutPathExpansion(base::MD5String(url), |
| 191 base::CreateFilePathValue(path)); | 191 base::CreateFilePathValue(path)); |
| 192 delegate_->FileSavedAs(url); | 192 delegate_->FileSavedAs(url); |
| 193 | 193 |
| 194 BrowserThread::PostTask( | 194 BrowserThread::PostTask( |
| 195 BrowserThread::FILE, FROM_HERE, | 195 BrowserThread::FILE, FROM_HERE, |
| 196 base::Bind(&DevToolsFileHelper::WriteFile, | 196 base::Bind(&DevToolsFileHelper::WriteFile, |
| 197 path, | 197 path, |
| 198 content)); | 198 content)); |
| 199 } | 199 } |
| OLD | NEW |