| 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, |
| 30 const std::string& init_script_str, | 25 const std::string& init_script_str, |
| 31 const base::Closure& done_cb); | 26 const base::Closure& done_cb); |
| 32 void Unload(); | 27 void Unload(); |
| 33 void LoadToUserScreen(const base::Closure& done_cb); | |
| 34 void LoadToLockScreen(const base::Closure& done_cb); | |
| 35 void LoadExtension(Profile* profile, | 28 void LoadExtension(Profile* profile, |
| 36 content::RenderViewHost* render_view_host, | |
| 37 base::Closure done_cb); | 29 base::Closure done_cb); |
| 38 | 30 |
| 39 bool loaded_on_lock_screen() { return loaded_on_lock_screen_; } | |
| 40 | |
| 41 private: | 31 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); | 32 void UnloadExtensionFromProfile(Profile* profile); |
| 48 | 33 |
| 49 Profile* profile_; | 34 Profile* profile_; |
| 50 std::string extension_id_; | 35 std::string extension_id_; |
| 51 base::FilePath extension_path_; | 36 base::FilePath extension_path_; |
| 52 std::string init_script_str_; | 37 std::string init_script_str_; |
| 53 | 38 |
| 54 // Profile which the extension is currently loaded to. | 39 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 | 40 |
| 59 base::Closure unload_callback_; | 41 base::Closure unload_callback_; |
| 60 | 42 |
| 61 base::WeakPtrFactory<AccessibilityExtensionLoader> weak_ptr_factory_; | 43 base::WeakPtrFactory<AccessibilityExtensionLoader> weak_ptr_factory_; |
| 62 | 44 |
| 63 DISALLOW_COPY_AND_ASSIGN(AccessibilityExtensionLoader); | 45 DISALLOW_COPY_AND_ASSIGN(AccessibilityExtensionLoader); |
| 64 }; | 46 }; |
| 65 | 47 |
| 66 } // namespace chromeos | 48 } // namespace chromeos |
| 67 | 49 |
| 68 #endif // CHROME_BROWSER_CHROMEOS_ACCESSIBILITY_ACCESSIBILITY_EXTENSION_LOADER_
H_ | 50 #endif // CHROME_BROWSER_CHROMEOS_ACCESSIBILITY_ACCESSIBILITY_EXTENSION_LOADER_
H_ |
| OLD | NEW |