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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 base::string16(), | 80 base::string16(), |
81 default_path, | 81 default_path, |
82 NULL, | 82 NULL, |
83 0, | 83 0, |
84 base::FilePath::StringType(), | 84 base::FilePath::StringType(), |
85 platform_util::GetTopLevel(web_contents_->GetNativeView()), | 85 platform_util::GetTopLevel(web_contents_->GetNativeView()), |
86 NULL); | 86 NULL); |
87 } | 87 } |
88 | 88 |
89 // ui::SelectFileDialog::Listener implementation. | 89 // ui::SelectFileDialog::Listener implementation. |
90 virtual void FileSelected(const base::FilePath& path, | 90 void FileSelected(const base::FilePath& path, |
91 int index, | 91 int index, |
92 void* params) override { | 92 void* params) override { |
93 selected_callback_.Run(path); | 93 selected_callback_.Run(path); |
94 Release(); // Balanced in ::Show. | 94 Release(); // Balanced in ::Show. |
95 } | 95 } |
96 | 96 |
97 virtual void MultiFilesSelected(const std::vector<base::FilePath>& files, | 97 void MultiFilesSelected(const std::vector<base::FilePath>& files, |
98 void* params) override { | 98 void* params) override { |
99 Release(); // Balanced in ::Show. | 99 Release(); // Balanced in ::Show. |
100 NOTREACHED() << "Should not be able to select multiple files"; | 100 NOTREACHED() << "Should not be able to select multiple files"; |
101 } | 101 } |
102 | 102 |
103 virtual void FileSelectionCanceled(void* params) override { | 103 void FileSelectionCanceled(void* params) override { |
104 canceled_callback_.Run(); | 104 canceled_callback_.Run(); |
105 Release(); // Balanced in ::Show. | 105 Release(); // Balanced in ::Show. |
106 } | 106 } |
107 | 107 |
108 private: | 108 private: |
109 friend class base::RefCounted<SelectFileDialog>; | 109 friend class base::RefCounted<SelectFileDialog>; |
110 virtual ~SelectFileDialog() {} | 110 ~SelectFileDialog() override {} |
111 | 111 |
112 scoped_refptr<ui::SelectFileDialog> select_file_dialog_; | 112 scoped_refptr<ui::SelectFileDialog> select_file_dialog_; |
113 SelectedCallback selected_callback_; | 113 SelectedCallback selected_callback_; |
114 CanceledCallback canceled_callback_; | 114 CanceledCallback canceled_callback_; |
115 WebContents* web_contents_; | 115 WebContents* web_contents_; |
116 | 116 |
117 DISALLOW_COPY_AND_ASSIGN(SelectFileDialog); | 117 DISALLOW_COPY_AND_ASSIGN(SelectFileDialog); |
118 }; | 118 }; |
119 | 119 |
120 void WriteToFile(const base::FilePath& path, const std::string& content) { | 120 void WriteToFile(const base::FilePath& path, const std::string& content) { |
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
419 base::DictionaryValue* file_systems_paths_value = update.Get(); | 419 base::DictionaryValue* file_systems_paths_value = update.Get(); |
420 file_systems_paths_value->RemoveWithoutPathExpansion(file_system_path, NULL); | 420 file_systems_paths_value->RemoveWithoutPathExpansion(file_system_path, NULL); |
421 } | 421 } |
422 | 422 |
423 bool DevToolsFileHelper::IsFileSystemAdded( | 423 bool DevToolsFileHelper::IsFileSystemAdded( |
424 const std::string& file_system_path) { | 424 const std::string& file_system_path) { |
425 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 425 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
426 set<std::string> file_system_paths = GetAddedFileSystemPaths(profile_); | 426 set<std::string> file_system_paths = GetAddedFileSystemPaths(profile_); |
427 return file_system_paths.find(file_system_path) != file_system_paths.end(); | 427 return file_system_paths.find(file_system_path) != file_system_paths.end(); |
428 } | 428 } |
OLD | NEW |