| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_ACCESSIBILITY_ACCESSIBILITY_EXTENSION_LOADER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_ACCESSIBILITY_ACCESSIBILITY_EXTENSION_LOADER_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_ACCESSIBILITY_ACCESSIBILITY_EXTENSION_LOADER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_ACCESSIBILITY_ACCESSIBILITY_EXTENSION_LOADER_H_ |
| 7 | 7 |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
| 11 | 11 |
| 12 namespace content { | |
| 13 class RenderViewHost; | |
| 14 } | |
| 15 | |
| 16 class ExtensionService; | |
| 17 class Profile; | 12 class Profile; |
| 18 | 13 |
| 19 namespace chromeos { | 14 namespace chromeos { |
| 20 | 15 |
| 21 class AccessibilityExtensionLoader { | 16 class AccessibilityExtensionLoader { |
| 22 public: | 17 public: |
| 23 AccessibilityExtensionLoader(const std::string& extension_id, | 18 AccessibilityExtensionLoader(const std::string& extension_id, |
| 24 const base::FilePath& extension_path, | 19 const base::FilePath& extension_path, |
| 25 const base::Closure& unload_callback); | 20 const base::Closure& unload_callback); |
| 26 ~AccessibilityExtensionLoader(); | 21 ~AccessibilityExtensionLoader(); |
| 27 | 22 |
| 28 void SetProfile(Profile* profile, const base::Closure& done_callback); | 23 void SetProfile(Profile* profile, const base::Closure& done_callback); |
| 29 void Load(Profile* profile, | 24 void Load(Profile* profile, const base::Closure& done_cb); |
| 30 const std::string& init_script_str, | |
| 31 const base::Closure& done_cb); | |
| 32 void Unload(); | 25 void Unload(); |
| 33 void LoadToUserScreen(const base::Closure& done_cb); | |
| 34 void LoadToLockScreen(const base::Closure& done_cb); | |
| 35 void LoadExtension(Profile* profile, | 26 void LoadExtension(Profile* profile, |
| 36 content::RenderViewHost* render_view_host, | |
| 37 base::Closure done_cb); | 27 base::Closure done_cb); |
| 38 | 28 |
| 39 bool loaded_on_lock_screen() { return loaded_on_lock_screen_; } | |
| 40 | |
| 41 private: | 29 private: |
| 42 void InjectContentScriptAndCallback(ExtensionService* extension_service, | |
| 43 int render_process_id, | |
| 44 int render_view_id, | |
| 45 const base::Closure& done_cb); | |
| 46 void UnloadFromLockScreen(); | |
| 47 void UnloadExtensionFromProfile(Profile* profile); | 30 void UnloadExtensionFromProfile(Profile* profile); |
| 48 | 31 |
| 49 Profile* profile_; | 32 Profile* profile_; |
| 50 std::string extension_id_; | 33 std::string extension_id_; |
| 51 base::FilePath extension_path_; | 34 base::FilePath extension_path_; |
| 52 std::string init_script_str_; | |
| 53 | 35 |
| 54 // Profile which the extension is currently loaded to. | 36 bool loaded_; |
| 55 // If nullptr, it is not loaded to any profile. | |
| 56 bool loaded_on_lock_screen_; | |
| 57 bool loaded_on_user_screen_; | |
| 58 | 37 |
| 59 base::Closure unload_callback_; | 38 base::Closure unload_callback_; |
| 60 | 39 |
| 61 base::WeakPtrFactory<AccessibilityExtensionLoader> weak_ptr_factory_; | 40 base::WeakPtrFactory<AccessibilityExtensionLoader> weak_ptr_factory_; |
| 62 | 41 |
| 63 DISALLOW_COPY_AND_ASSIGN(AccessibilityExtensionLoader); | 42 DISALLOW_COPY_AND_ASSIGN(AccessibilityExtensionLoader); |
| 64 }; | 43 }; |
| 65 | 44 |
| 66 } // namespace chromeos | 45 } // namespace chromeos |
| 67 | 46 |
| 68 #endif // CHROME_BROWSER_CHROMEOS_ACCESSIBILITY_ACCESSIBILITY_EXTENSION_LOADER_
H_ | 47 #endif // CHROME_BROWSER_CHROMEOS_ACCESSIBILITY_ACCESSIBILITY_EXTENSION_LOADER_
H_ |
| OLD | NEW |