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_CHROMEOS_EXTENSIONS_FILE_BROWSER_HANDLER_API_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_BROWSER_HANDLER_API_H_ |
6 #define CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_BROWSER_HANDLER_API_H_ | 6 #define CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_BROWSER_HANDLER_API_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 14 matching lines...) Expand all Loading... |
25 | 25 |
26 // Used in testing. | 26 // Used in testing. |
27 virtual void set_function_for_test( | 27 virtual void set_function_for_test( |
28 FileHandlerSelectFileFunction* function) = 0; | 28 FileHandlerSelectFileFunction* function) = 0; |
29 }; | 29 }; |
30 | 30 |
31 } // namespace file_handler | 31 } // namespace file_handler |
32 | 32 |
33 class FileHandlerSelectFileFunction : public AsyncExtensionFunction { | 33 class FileHandlerSelectFileFunction : public AsyncExtensionFunction { |
34 public: | 34 public: |
| 35 DECLARE_EXTENSION_FUNCTION_NAME("fileBrowserHandlerInternal.selectFile"); |
| 36 |
35 FileHandlerSelectFileFunction(); | 37 FileHandlerSelectFileFunction(); |
36 virtual ~FileHandlerSelectFileFunction() OVERRIDE; | |
37 | 38 |
38 // Called by FileSelector implementation when the user selects new file's | 39 // Called by FileSelector implementation when the user selects new file's |
39 // file path. | 40 // file path. |
40 void OnFilePathSelected(bool success, const FilePath& full_path); | 41 void OnFilePathSelected(bool success, const FilePath& full_path); |
41 | 42 |
42 // Used in test. | 43 // Used in test. |
43 static void set_file_selector_for_test( | 44 static void set_file_selector_for_test( |
44 file_handler::FileSelector* file_selector); | 45 file_handler::FileSelector* file_selector); |
45 | 46 |
46 // Used in test. | 47 // Used in test. |
47 static void set_gesture_check_disabled_for_test(bool disabled); | 48 static void set_gesture_check_disabled_for_test(bool disabled); |
48 | 49 |
49 protected: | 50 protected: |
| 51 virtual ~FileHandlerSelectFileFunction() OVERRIDE; |
50 virtual bool RunImpl() OVERRIDE; | 52 virtual bool RunImpl() OVERRIDE; |
51 | 53 |
52 private: | 54 private: |
53 // Calls |DoCreateFile| on file thread and invokes the callback. | 55 // Calls |DoCreateFile| on file thread and invokes the callback. |
54 void CreateFileOnFileThread(bool success, | 56 void CreateFileOnFileThread(bool success, |
55 const std::string& file_system_name, | 57 const std::string& file_system_name, |
56 const GURL& file_system_root); | 58 const GURL& file_system_root); |
57 | 59 |
58 // Creates file on provided file path. | 60 // Creates file on provided file path. |
59 bool DoCreateFile(); | 61 bool DoCreateFile(); |
(...skipping 20 matching lines...) Expand all Loading... |
80 | 82 |
81 // Full file system path of the selected file. | 83 // Full file system path of the selected file. |
82 FilePath full_path_; | 84 FilePath full_path_; |
83 | 85 |
84 // |file_selector_for_test_| and |disable_geture_check_for_test_| are used | 86 // |file_selector_for_test_| and |disable_geture_check_for_test_| are used |
85 // primary in testing to override file selector to be used in the function | 87 // primary in testing to override file selector to be used in the function |
86 // implementation and disable user gesture check. | 88 // implementation and disable user gesture check. |
87 // Once set they will be used for every extension function call. | 89 // Once set they will be used for every extension function call. |
88 static file_handler::FileSelector* file_selector_for_test_; | 90 static file_handler::FileSelector* file_selector_for_test_; |
89 static bool gesture_check_disabled_for_test_; | 91 static bool gesture_check_disabled_for_test_; |
90 | |
91 DECLARE_EXTENSION_FUNCTION_NAME("fileBrowserHandlerInternal.selectFile"); | |
92 }; | 92 }; |
93 | 93 |
94 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_BROWSER_HANDLER_API_H_ | 94 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_BROWSER_HANDLER_API_H_ |
95 | 95 |
OLD | NEW |