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 <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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 } | 70 } |
71 | 71 |
72 void Show(ui::SelectFileDialog::Type type, | 72 void Show(ui::SelectFileDialog::Type type, |
73 const base::FilePath& default_path) { | 73 const base::FilePath& default_path) { |
74 AddRef(); // Balanced in the three listener outcomes. | 74 AddRef(); // Balanced in the three listener outcomes. |
75 select_file_dialog_->SelectFile(type, | 75 select_file_dialog_->SelectFile(type, |
76 string16(), | 76 string16(), |
77 default_path, | 77 default_path, |
78 NULL, | 78 NULL, |
79 0, | 79 0, |
80 FILE_PATH_LITERAL(""), | 80 base::FilePath::StringType(), |
81 NULL, | 81 NULL, |
82 NULL); | 82 NULL); |
83 } | 83 } |
84 | 84 |
85 // ui::SelectFileDialog::Listener implementation. | 85 // ui::SelectFileDialog::Listener implementation. |
86 virtual void FileSelected(const base::FilePath& path, | 86 virtual void FileSelected(const base::FilePath& path, |
87 int index, | 87 int index, |
88 void* params) OVERRIDE { | 88 void* params) OVERRIDE { |
89 selected_callback_.Run(path); | 89 selected_callback_.Run(path); |
90 Release(); // Balanced in ::Show. | 90 Release(); // Balanced in ::Show. |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
339 | 339 |
340 DictionaryPrefUpdate update(profile_->GetPrefs(), | 340 DictionaryPrefUpdate update(profile_->GetPrefs(), |
341 prefs::kDevToolsFileSystemPaths); | 341 prefs::kDevToolsFileSystemPaths); |
342 DictionaryValue* file_systems_paths_value = update.Get(); | 342 DictionaryValue* file_systems_paths_value = update.Get(); |
343 file_systems_paths_value->Set(file_system_path, Value::CreateNullValue()); | 343 file_systems_paths_value->Set(file_system_path, Value::CreateNullValue()); |
344 | 344 |
345 FileSystem filesystem = CreateFileSystemStruct(web_contents_, | 345 FileSystem filesystem = CreateFileSystemStruct(web_contents_, |
346 file_system_id, | 346 file_system_id, |
347 registered_name, | 347 registered_name, |
348 file_system_path); | 348 file_system_path); |
349 callback.Run("", filesystem); | 349 callback.Run(std::string(), filesystem); |
350 } | 350 } |
351 | 351 |
352 void DevToolsFileHelper::RequestFileSystems( | 352 void DevToolsFileHelper::RequestFileSystems( |
353 const RequestFileSystemsCallback& callback) { | 353 const RequestFileSystemsCallback& callback) { |
354 const DictionaryValue* file_systems_paths_value = | 354 const DictionaryValue* file_systems_paths_value = |
355 profile_->GetPrefs()->GetDictionary(prefs::kDevToolsFileSystemPaths); | 355 profile_->GetPrefs()->GetDictionary(prefs::kDevToolsFileSystemPaths); |
356 std::vector<base::FilePath> saved_paths; | 356 std::vector<base::FilePath> saved_paths; |
357 for (DictionaryValue::Iterator it(*file_systems_paths_value); !it.IsAtEnd(); | 357 for (DictionaryValue::Iterator it(*file_systems_paths_value); !it.IsAtEnd(); |
358 it.Advance()) { | 358 it.Advance()) { |
359 std::string file_system_path = it.key(); | 359 std::string file_system_path = it.key(); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
395 void DevToolsFileHelper::RemoveFileSystem(const std::string& file_system_path) { | 395 void DevToolsFileHelper::RemoveFileSystem(const std::string& file_system_path) { |
396 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 396 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
397 base::FilePath path = base::FilePath::FromUTF8Unsafe(file_system_path); | 397 base::FilePath path = base::FilePath::FromUTF8Unsafe(file_system_path); |
398 isolated_context()->RevokeFileSystemByPath(path); | 398 isolated_context()->RevokeFileSystemByPath(path); |
399 | 399 |
400 DictionaryPrefUpdate update(profile_->GetPrefs(), | 400 DictionaryPrefUpdate update(profile_->GetPrefs(), |
401 prefs::kDevToolsFileSystemPaths); | 401 prefs::kDevToolsFileSystemPaths); |
402 DictionaryValue* file_systems_paths_value = update.Get(); | 402 DictionaryValue* file_systems_paths_value = update.Get(); |
403 file_systems_paths_value->RemoveWithoutPathExpansion(file_system_path, NULL); | 403 file_systems_paths_value->RemoveWithoutPathExpansion(file_system_path, NULL); |
404 } | 404 } |
OLD | NEW |