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

Side by Side 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 unified diff | Download patch
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_CHROMEOS_ACCESSIBILITY_ACCESSIBILITY_EXTENSION_LOADER_H_
6 #define CHROME_BROWSER_CHROMEOS_ACCESSIBILITY_ACCESSIBILITY_EXTENSION_LOADER_H_
7
8 #include "base/callback.h"
9 #include "base/files/file_path.h"
10 #include "base/memory/weak_ptr.h"
11
12 namespace content {
13 class RenderViewHost;
14 }
15
16 class ExtensionService;
17 class Profile;
18
19 namespace chromeos {
20
21 class AccessibilityExtensionLoader {
22 public:
23 AccessibilityExtensionLoader(const std::string& extension_id,
24 const base::FilePath& extension_path,
25 const base::Closure& unload_callback);
26 ~AccessibilityExtensionLoader();
27
28 void SetProfile(Profile* profile);
29 void Load(Profile* profile,
30 const std::string& init_script_str,
31 const base::Closure& done_cb);
32 void Unload();
33 void LoadToUserScreen(const base::Closure& done_cb);
34 void LoadToLockScreen(const base::Closure& done_cb);
35 void LoadExtension(Profile* profile,
36 content::RenderViewHost* render_view_host,
37 base::Closure done_cb);
38
39 bool loaded_on_lock_screen() { return loaded_on_lock_screen_; }
40
41 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);
48
49 Profile* profile_;
50 std::string extension_id_;
51 base::FilePath extension_path_;
52 std::string init_script_str_;
53
54 // Profile which the extension is currently loaded to.
55 // If nullptr, it is not loaded to any profile.
56 bool loaded_on_lock_screen_;
57 bool loaded_on_user_screen_;
58
59 base::Closure unload_callback_;
60
61 base::WeakPtrFactory<AccessibilityExtensionLoader> weak_ptr_factory_;
62
63 DISALLOW_COPY_AND_ASSIGN(AccessibilityExtensionLoader);
64 };
65
66 } // namespace chromeos
67
68 #endif // CHROME_BROWSER_CHROMEOS_ACCESSIBILITY_ACCESSIBILITY_EXTENSION_LOADER_ H_
OLDNEW
« 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