Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(262)

Unified Diff: chrome/browser/chromeos/accessibility/accessibility_extension_loader.h

Issue 2212863002: Factor the extension loading code out of AccessibilityManager (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@no_load_chromevox
Patch Set: Fix code that runs on OnUnload Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/accessibility/accessibility_extension_loader.h
diff --git a/chrome/browser/chromeos/accessibility/accessibility_extension_loader.h b/chrome/browser/chromeos/accessibility/accessibility_extension_loader.h
new file mode 100644
index 0000000000000000000000000000000000000000..58d8134a4921d0b5879cc33631ee2cbd12b7975e
--- /dev/null
+++ b/chrome/browser/chromeos/accessibility/accessibility_extension_loader.h
@@ -0,0 +1,68 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_CHROMEOS_ACCESSIBILITY_ACCESSIBILITY_EXTENSION_LOADER_H_
+#define CHROME_BROWSER_CHROMEOS_ACCESSIBILITY_ACCESSIBILITY_EXTENSION_LOADER_H_
+
+#include "base/callback.h"
+#include "base/files/file_path.h"
+#include "base/memory/weak_ptr.h"
+
+namespace content {
+class RenderViewHost;
+}
+
+class ExtensionService;
+class Profile;
+
+namespace chromeos {
+
+class AccessibilityExtensionLoader {
+ public:
+ AccessibilityExtensionLoader(const std::string& extension_id,
+ const base::FilePath& extension_path,
+ const base::Closure& unload_callback);
+ ~AccessibilityExtensionLoader();
+
+ void SetProfile(Profile* profile);
+ void Load(Profile* profile,
+ const std::string& init_script_str,
+ const base::Closure& done_cb);
+ void Unload();
+ void LoadToUserScreen(const base::Closure& done_cb);
+ void LoadToLockScreen(const base::Closure& done_cb);
+ void LoadExtension(Profile* profile,
+ content::RenderViewHost* render_view_host,
+ base::Closure done_cb);
+
+ bool loaded_on_lock_screen() { return loaded_on_lock_screen_; }
+
+ private:
+ void InjectContentScriptAndCallback(ExtensionService* extension_service,
+ int render_process_id,
+ int render_view_id,
+ const base::Closure& done_cb);
+ void UnloadFromLockScreen();
+ void UnloadExtensionFromProfile(Profile* profile);
+
+ Profile* profile_;
+ std::string extension_id_;
+ base::FilePath extension_path_;
+ std::string init_script_str_;
+
+ // Profile which the extension is currently loaded to.
+ // If nullptr, it is not loaded to any profile.
+ bool loaded_on_lock_screen_;
+ bool loaded_on_user_screen_;
+
+ base::Closure unload_callback_;
+
+ base::WeakPtrFactory<AccessibilityExtensionLoader> weak_ptr_factory_;
+
+ DISALLOW_COPY_AND_ASSIGN(AccessibilityExtensionLoader);
+};
+
+} // namespace chromeos
+
+#endif // CHROME_BROWSER_CHROMEOS_ACCESSIBILITY_ACCESSIBILITY_EXTENSION_LOADER_H_
« no previous file with comments | « chrome/browser/chromeos/BUILD.gn ('k') | chrome/browser/chromeos/accessibility/accessibility_extension_loader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698