| 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" |
| 14 #include "chrome/common/extensions/extension_constants.h" |
| 15 #include "content/public/browser/web_ui.h" |
| 16 #include "extensions/browser/extension_registry.h" |
| 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(); |
| 39 if (!service->IsExtensionEnabled(extension_misc::kChromeVoxExtensionId)) |
| 40 return; |
| 41 const extensions::Extension* extension = |
| 42 service->GetInstalledExtension(extension_misc::kChromeVoxExtensionId); |
| 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 |