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

Side by Side Diff: chrome/browser/chromeos/accessibility/accessibility_extension_loader.cc

Issue 2422983004: Reload ChromeVox panel when reloading ChromeVox into a new profile. (Closed)
Patch Set: Created 4 years, 2 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
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 #include "chrome/browser/chromeos/accessibility/accessibility_extension_loader.h " 5 #include "chrome/browser/chromeos/accessibility/accessibility_extension_loader.h "
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/callback_helpers.h" 8 #include "base/callback_helpers.h"
9 #include "base/path_service.h" 9 #include "base/path_service.h"
10 #include "chrome/browser/chromeos/login/lock/screen_locker.h" 10 #include "chrome/browser/chromeos/login/lock/screen_locker.h"
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 : profile_(nullptr), 124 : profile_(nullptr),
125 extension_id_(extension_id), 125 extension_id_(extension_id),
126 extension_path_(extension_path), 126 extension_path_(extension_path),
127 loaded_on_lock_screen_(false), 127 loaded_on_lock_screen_(false),
128 loaded_on_user_screen_(false), 128 loaded_on_user_screen_(false),
129 unload_callback_(unload_callback), 129 unload_callback_(unload_callback),
130 weak_ptr_factory_(this) {} 130 weak_ptr_factory_(this) {}
131 131
132 AccessibilityExtensionLoader::~AccessibilityExtensionLoader() {} 132 AccessibilityExtensionLoader::~AccessibilityExtensionLoader() {}
133 133
134 void AccessibilityExtensionLoader::SetProfile(Profile* profile) { 134 void AccessibilityExtensionLoader::SetProfile(
135 Profile* profile,
136 const base::Closure& done_callback) {
135 profile_ = profile; 137 profile_ = profile;
136 138
137 if (!loaded_on_user_screen_ && !loaded_on_lock_screen_) 139 if (!loaded_on_user_screen_ && !loaded_on_lock_screen_)
138 return; 140 return;
139 141
140 // If the extension was already enabled, but not for this profile, add it 142 // If the extension was already enabled, but not for this profile, add it
141 // to this profile. 143 // to this profile.
142 auto* extension_service = 144 auto* extension_service =
143 extensions::ExtensionSystem::Get(profile_)->extension_service(); 145 extensions::ExtensionSystem::Get(profile_)->extension_service();
144 auto* component_loader = extension_service->component_loader(); 146 auto* component_loader = extension_service->component_loader();
145 if (!component_loader->Exists(extension_id_)) 147 if (!component_loader->Exists(extension_id_))
146 LoadExtension(profile_, nullptr, base::Closure()); 148 LoadExtension(profile_, nullptr, done_callback);
147 } 149 }
148 150
149 void AccessibilityExtensionLoader::Load(Profile* profile, 151 void AccessibilityExtensionLoader::Load(Profile* profile,
150 const std::string& init_script_str, 152 const std::string& init_script_str,
151 const base::Closure& done_cb) { 153 const base::Closure& done_cb) {
152 profile_ = profile; 154 profile_ = profile;
153 init_script_str_ = init_script_str; 155 init_script_str_ = init_script_str;
154 ScreenLocker* screen_locker = ScreenLocker::default_screen_locker(); 156 ScreenLocker* screen_locker = ScreenLocker::default_screen_locker();
155 if (screen_locker && screen_locker->locked()) { 157 if (screen_locker && screen_locker->locked()) {
156 // If on the lock screen, loads only to the lock screen as for 158 // If on the lock screen, loads only to the lock screen as for
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 weak_ptr_factory_.GetWeakPtr(), extension_service, 304 weak_ptr_factory_.GetWeakPtr(), extension_service,
303 render_view_host->GetProcess()->GetID(), 305 render_view_host->GetProcess()->GetID(),
304 render_view_host->GetRoutingID(), done_cb); 306 render_view_host->GetRoutingID(), done_cb);
305 } 307 }
306 308
307 extension_service->component_loader()->AddComponentFromDir( 309 extension_service->component_loader()->AddComponentFromDir(
308 extension_path_, extension_id_.c_str(), done_cb); 310 extension_path_, extension_id_.c_str(), done_cb);
309 } 311 }
310 312
311 } // namespace chromeos 313 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698