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" |
11 #include "base/callback.h" | 11 #include "base/callback.h" |
12 #include "base/files/file_util.h" | 12 #include "base/files/file_util.h" |
13 #include "base/lazy_instance.h" | 13 #include "base/lazy_instance.h" |
14 #include "base/macros.h" | 14 #include "base/macros.h" |
15 #include "base/md5.h" | 15 #include "base/md5.h" |
| 16 #include "base/memory/ptr_util.h" |
16 #include "base/strings/utf_string_conversions.h" | 17 #include "base/strings/utf_string_conversions.h" |
17 #include "base/value_conversions.h" | 18 #include "base/value_conversions.h" |
18 #include "chrome/browser/browser_process.h" | 19 #include "chrome/browser/browser_process.h" |
19 #include "chrome/browser/devtools/devtools_file_watcher.h" | 20 #include "chrome/browser/devtools/devtools_file_watcher.h" |
20 #include "chrome/browser/download/download_prefs.h" | 21 #include "chrome/browser/download/download_prefs.h" |
21 #include "chrome/browser/platform_util.h" | 22 #include "chrome/browser/platform_util.h" |
22 #include "chrome/browser/profiles/profile.h" | 23 #include "chrome/browser/profiles/profile.h" |
23 #include "chrome/browser/ui/chrome_select_file_policy.h" | 24 #include "chrome/browser/ui/chrome_select_file_policy.h" |
24 #include "chrome/common/pref_names.h" | 25 #include "chrome/common/pref_names.h" |
25 #include "chrome/grit/generated_resources.h" | 26 #include "chrome/grit/generated_resources.h" |
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
378 if (!allowed) | 379 if (!allowed) |
379 return; | 380 return; |
380 | 381 |
381 std::string file_system_id = RegisterFileSystem(web_contents_, path); | 382 std::string file_system_id = RegisterFileSystem(web_contents_, path); |
382 std::string file_system_path = path.AsUTF8Unsafe(); | 383 std::string file_system_path = path.AsUTF8Unsafe(); |
383 | 384 |
384 DictionaryPrefUpdate update(profile_->GetPrefs(), | 385 DictionaryPrefUpdate update(profile_->GetPrefs(), |
385 prefs::kDevToolsFileSystemPaths); | 386 prefs::kDevToolsFileSystemPaths); |
386 base::DictionaryValue* file_systems_paths_value = update.Get(); | 387 base::DictionaryValue* file_systems_paths_value = update.Get(); |
387 file_systems_paths_value->SetWithoutPathExpansion( | 388 file_systems_paths_value->SetWithoutPathExpansion( |
388 file_system_path, base::Value::CreateNullValue()); | 389 file_system_path, base::MakeUnique<base::Value>()); |
389 } | 390 } |
390 | 391 |
391 std::vector<DevToolsFileHelper::FileSystem> | 392 std::vector<DevToolsFileHelper::FileSystem> |
392 DevToolsFileHelper::GetFileSystems() { | 393 DevToolsFileHelper::GetFileSystems() { |
393 file_system_paths_ = GetAddedFileSystemPaths(profile_); | 394 file_system_paths_ = GetAddedFileSystemPaths(profile_); |
394 std::vector<FileSystem> file_systems; | 395 std::vector<FileSystem> file_systems; |
395 for (auto file_system_path : file_system_paths_) { | 396 for (auto file_system_path : file_system_paths_) { |
396 base::FilePath path = base::FilePath::FromUTF8Unsafe(file_system_path); | 397 base::FilePath path = base::FilePath::FromUTF8Unsafe(file_system_path); |
397 std::string file_system_id = RegisterFileSystem(web_contents_, path); | 398 std::string file_system_id = RegisterFileSystem(web_contents_, path); |
398 FileSystem filesystem = CreateFileSystemStruct(web_contents_, | 399 FileSystem filesystem = CreateFileSystemStruct(web_contents_, |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
454 base::Unretained(file_watcher_.get()), path)); | 455 base::Unretained(file_watcher_.get()), path)); |
455 } | 456 } |
456 } | 457 } |
457 | 458 |
458 void DevToolsFileHelper::FilePathsChanged( | 459 void DevToolsFileHelper::FilePathsChanged( |
459 const std::vector<std::string>& changed_paths, | 460 const std::vector<std::string>& changed_paths, |
460 const std::vector<std::string>& added_paths, | 461 const std::vector<std::string>& added_paths, |
461 const std::vector<std::string>& removed_paths) { | 462 const std::vector<std::string>& removed_paths) { |
462 delegate_->FilePathsChanged(changed_paths, added_paths, removed_paths); | 463 delegate_->FilePathsChanged(changed_paths, added_paths, removed_paths); |
463 } | 464 } |
OLD | NEW |