Chromium Code Reviews| OLD | NEW |
|---|---|
| (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 #include "chrome/browser/ui/webui/settings/chromeos/accessibility_handler.h" | |
| 6 | |
| 7 #include "base/bind.h" | |
| 8 #include "base/bind_helpers.h" | |
| 9 #include "chrome/browser/extensions/extension_service.h" | |
| 10 #include "chrome/browser/extensions/extension_tab_util.h" | |
| 11 #include "chrome/browser/profiles/profile.h" | |
| 12 #include "chrome/browser/ui/browser_finder.h" | |
| 13 #include "chrome/browser/ui/webui/settings_utils.h" | |
|
Dan Beam
2016/08/02 05:18:47
what are you using settings_utils.h for?
dmazzoni
2016/08/02 17:14:51
Removed.
| |
| 14 #include "chrome/common/extensions/extension_constants.h" | |
| 15 #include "content/public/browser/web_ui.h" | |
| 16 #include "extensions/browser/extension_registry.h" | |
|
Dan Beam
2016/08/02 05:18:47
what are you using extension_registry.h for?
dmazzoni
2016/08/02 17:14:52
Kept this in due to your suggestion below, and rem
| |
| 17 #include "extensions/browser/extension_system.h" | |
| 18 | |
| 19 namespace chromeos { | |
| 20 namespace settings { | |
| 21 | |
| 22 AccessibilityHandler::AccessibilityHandler(content::WebUI* webui) | |
| 23 : profile_(Profile::FromWebUI(webui)) { | |
| 24 } | |
| 25 | |
| 26 AccessibilityHandler::~AccessibilityHandler() {} | |
| 27 | |
| 28 void AccessibilityHandler::RegisterMessages() { | |
| 29 web_ui()->RegisterMessageCallback( | |
| 30 "showChromeVoxSettings", | |
| 31 base::Bind(&AccessibilityHandler::HandleShowChromeVoxSettings, | |
| 32 base::Unretained(this))); | |
| 33 } | |
| 34 | |
| 35 void AccessibilityHandler::HandleShowChromeVoxSettings( | |
| 36 const base::ListValue* args) { | |
| 37 ExtensionService* service = | |
| 38 extensions::ExtensionSystem::Get(profile_)->extension_service(); | |
|
Dan Beam
2016/08/02 05:18:47
nit: can the extension system or service ever be n
dmazzoni
2016/08/02 17:14:52
I don't believe so, anywhere else in the code does
| |
| 39 if (!service->IsExtensionEnabled(extension_misc::kChromeVoxExtensionId)) | |
| 40 return; | |
| 41 const extensions::Extension* extension = | |
| 42 service->GetInstalledExtension(extension_misc::kChromeVoxExtensionId); | |
|
Dan Beam
2016/08/02 05:18:47
nit: can we use
Extension* chrome_vox = Extensi
dmazzoni
2016/08/02 17:14:51
Sure, that's cleaner. Thanks.
| |
| 43 if (!extension) | |
| 44 return; | |
| 45 extensions::ExtensionTabUtil::OpenOptionsPage( | |
| 46 extension, | |
| 47 chrome::FindBrowserWithWebContents(web_ui()->GetWebContents())); | |
| 48 } | |
| 49 | |
| 50 } // namespace settings | |
| 51 } // namespace chromeos | |
| OLD | NEW |