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 #ifndef CHROME_BROWSER_DEVTOOLS_DEVTOOLS_FILE_HELPER_H_ | 5 #ifndef CHROME_BROWSER_DEVTOOLS_DEVTOOLS_FILE_HELPER_H_ |
6 #define CHROME_BROWSER_DEVTOOLS_DEVTOOLS_FILE_HELPER_H_ | 6 #define CHROME_BROWSER_DEVTOOLS_DEVTOOLS_FILE_HELPER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
14 #include "base/callback.h" | 14 #include "base/callback.h" |
15 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
16 #include "base/memory/weak_ptr.h" | 16 #include "base/memory/weak_ptr.h" |
17 #include "base/prefs/pref_change_registrar.h" | 17 #include "base/prefs/pref_change_registrar.h" |
18 #include "base/strings/string16.h" | 18 #include "base/strings/string16.h" |
19 | 19 |
| 20 class DevToolsFileWatcher; |
20 class Profile; | 21 class Profile; |
21 | 22 |
22 namespace base { | 23 namespace base { |
23 class FilePath; | 24 class FilePath; |
24 } | 25 } |
25 | 26 |
26 namespace content { | 27 namespace content { |
27 class WebContents; | 28 class WebContents; |
28 } | 29 } |
29 | 30 |
30 class DevToolsFileHelper { | 31 class DevToolsFileHelper { |
31 public: | 32 public: |
32 struct FileSystem { | 33 struct FileSystem { |
33 FileSystem(); | 34 FileSystem(); |
34 FileSystem(const std::string& file_system_name, | 35 FileSystem(const std::string& file_system_name, |
35 const std::string& root_url, | 36 const std::string& root_url, |
36 const std::string& file_system_path); | 37 const std::string& file_system_path); |
37 | 38 |
38 std::string file_system_name; | 39 std::string file_system_name; |
39 std::string root_url; | 40 std::string root_url; |
40 std::string file_system_path; | 41 std::string file_system_path; |
41 }; | 42 }; |
42 | 43 |
43 class Delegate { | 44 class Delegate { |
44 public: | 45 public: |
45 virtual ~Delegate() {} | 46 virtual ~Delegate() {} |
46 virtual void FileSystemAdded(const FileSystem& file_system) = 0; | 47 virtual void FileSystemAdded(const FileSystem& file_system) = 0; |
47 virtual void FileSystemRemoved(const std::string& file_system_path) = 0; | 48 virtual void FileSystemRemoved(const std::string& file_system_path) = 0; |
| 49 virtual void FilePathsChanged(const std::vector<std::string>& paths) = 0; |
48 }; | 50 }; |
49 | 51 |
50 DevToolsFileHelper(content::WebContents* web_contents, Profile* profile, | 52 DevToolsFileHelper(content::WebContents* web_contents, Profile* profile, |
51 Delegate* delegate); | 53 Delegate* delegate); |
52 ~DevToolsFileHelper(); | 54 ~DevToolsFileHelper(); |
53 | 55 |
54 typedef base::Callback<void(void)> SaveCallback; | 56 typedef base::Callback<void(void)> SaveCallback; |
55 typedef base::Callback<void(void)> AppendCallback; | 57 typedef base::Callback<void(void)> AppendCallback; |
56 typedef base::Callback<void(const base::string16&, | 58 typedef base::Callback<void(const base::string16&, |
57 const base::Callback<void(bool)>&)> | 59 const base::Callback<void(bool)>&)> |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 void InnerAddFileSystem( | 124 void InnerAddFileSystem( |
123 const ShowInfoBarCallback& show_info_bar_callback, | 125 const ShowInfoBarCallback& show_info_bar_callback, |
124 const base::FilePath& path); | 126 const base::FilePath& path); |
125 void CheckProjectFileExistsAndAddFileSystem( | 127 void CheckProjectFileExistsAndAddFileSystem( |
126 const ShowInfoBarCallback& show_info_bar_callback, | 128 const ShowInfoBarCallback& show_info_bar_callback, |
127 const base::FilePath& path); | 129 const base::FilePath& path); |
128 void AddUserConfirmedFileSystem( | 130 void AddUserConfirmedFileSystem( |
129 const base::FilePath& path, | 131 const base::FilePath& path, |
130 bool allowed); | 132 bool allowed); |
131 void FileSystemPathsSettingChanged(); | 133 void FileSystemPathsSettingChanged(); |
| 134 void FilePathsChanged(const std::vector<std::string>& paths); |
132 | 135 |
133 content::WebContents* web_contents_; | 136 content::WebContents* web_contents_; |
134 Profile* profile_; | 137 Profile* profile_; |
135 DevToolsFileHelper::Delegate* delegate_; | 138 DevToolsFileHelper::Delegate* delegate_; |
136 typedef std::map<std::string, base::FilePath> PathsMap; | 139 typedef std::map<std::string, base::FilePath> PathsMap; |
137 PathsMap saved_files_; | 140 PathsMap saved_files_; |
138 PrefChangeRegistrar pref_change_registrar_; | 141 PrefChangeRegistrar pref_change_registrar_; |
139 std::set<std::string> file_system_paths_; | 142 std::set<std::string> file_system_paths_; |
| 143 scoped_ptr<DevToolsFileWatcher> file_watcher_; |
140 base::WeakPtrFactory<DevToolsFileHelper> weak_factory_; | 144 base::WeakPtrFactory<DevToolsFileHelper> weak_factory_; |
141 DISALLOW_COPY_AND_ASSIGN(DevToolsFileHelper); | 145 DISALLOW_COPY_AND_ASSIGN(DevToolsFileHelper); |
142 }; | 146 }; |
143 | 147 |
144 #endif // CHROME_BROWSER_DEVTOOLS_DEVTOOLS_FILE_HELPER_H_ | 148 #endif // CHROME_BROWSER_DEVTOOLS_DEVTOOLS_FILE_HELPER_H_ |
OLD | NEW |