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/devtools/devtools_file_helper.h" | 5 #include "chrome/browser/devtools/devtools_file_helper.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
314 const base::FilePath& path) { | 314 const base::FilePath& path) { |
315 std::string file_system_path = path.AsUTF8Unsafe(); | 315 std::string file_system_path = path.AsUTF8Unsafe(); |
316 | 316 |
317 const DictionaryValue* file_systems_paths_value = | 317 const DictionaryValue* file_systems_paths_value = |
318 profile_->GetPrefs()->GetDictionary(prefs::kDevToolsFileSystemPaths); | 318 profile_->GetPrefs()->GetDictionary(prefs::kDevToolsFileSystemPaths); |
319 if (file_systems_paths_value->HasKey(file_system_path)) { | 319 if (file_systems_paths_value->HasKey(file_system_path)) { |
320 callback.Run(FileSystem()); | 320 callback.Run(FileSystem()); |
321 return; | 321 return; |
322 } | 322 } |
323 | 323 |
| 324 std::string path_display_name = path.AsEndingWithSeparator().AsUTF8Unsafe(); |
324 string16 message = l10n_util::GetStringFUTF16( | 325 string16 message = l10n_util::GetStringFUTF16( |
325 IDS_DEV_TOOLS_CONFIRM_ADD_FILE_SYSTEM_MESSAGE, | 326 IDS_DEV_TOOLS_CONFIRM_ADD_FILE_SYSTEM_MESSAGE, |
326 UTF8ToUTF16(file_system_path + "/")); | 327 UTF8ToUTF16(path_display_name)); |
327 show_info_bar_callback.Run( | 328 show_info_bar_callback.Run( |
328 message, | 329 message, |
329 Bind(&DevToolsFileHelper::AddUserConfirmedFileSystem, | 330 Bind(&DevToolsFileHelper::AddUserConfirmedFileSystem, |
330 weak_factory_.GetWeakPtr(), | 331 weak_factory_.GetWeakPtr(), |
331 callback, path)); | 332 callback, path)); |
332 } | 333 } |
333 | 334 |
334 void DevToolsFileHelper::AddUserConfirmedFileSystem( | 335 void DevToolsFileHelper::AddUserConfirmedFileSystem( |
335 const AddFileSystemCallback& callback, | 336 const AddFileSystemCallback& callback, |
336 const base::FilePath& path, | 337 const base::FilePath& path, |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
390 DictionaryValue* file_systems_paths_value = update.Get(); | 391 DictionaryValue* file_systems_paths_value = update.Get(); |
391 file_systems_paths_value->RemoveWithoutPathExpansion(file_system_path, NULL); | 392 file_systems_paths_value->RemoveWithoutPathExpansion(file_system_path, NULL); |
392 } | 393 } |
393 | 394 |
394 bool DevToolsFileHelper::IsFileSystemAdded( | 395 bool DevToolsFileHelper::IsFileSystemAdded( |
395 const std::string& file_system_path) { | 396 const std::string& file_system_path) { |
396 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 397 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
397 set<std::string> file_system_paths = GetAddedFileSystemPaths(profile_); | 398 set<std::string> file_system_paths = GetAddedFileSystemPaths(profile_); |
398 return file_system_paths.find(file_system_path) != file_system_paths.end(); | 399 return file_system_paths.find(file_system_path) != file_system_paths.end(); |
399 } | 400 } |
OLD | NEW |