| 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_tab_util.h" |
| 10 #include "chrome/browser/profiles/profile.h" |
| 11 #include "chrome/browser/ui/browser_finder.h" |
| 12 #include "chrome/common/extensions/extension_constants.h" |
| 13 #include "content/public/browser/web_ui.h" |
| 14 #include "extensions/browser/extension_registry.h" |
| 15 |
| 16 namespace chromeos { |
| 17 namespace settings { |
| 18 |
| 19 AccessibilityHandler::AccessibilityHandler(content::WebUI* webui) |
| 20 : profile_(Profile::FromWebUI(webui)) { |
| 21 } |
| 22 |
| 23 AccessibilityHandler::~AccessibilityHandler() {} |
| 24 |
| 25 void AccessibilityHandler::RegisterMessages() { |
| 26 web_ui()->RegisterMessageCallback( |
| 27 "showChromeVoxSettings", |
| 28 base::Bind(&AccessibilityHandler::HandleShowChromeVoxSettings, |
| 29 base::Unretained(this))); |
| 30 } |
| 31 |
| 32 void AccessibilityHandler::HandleShowChromeVoxSettings( |
| 33 const base::ListValue* args) { |
| 34 const extensions::Extension* chromevox_extension = |
| 35 extensions::ExtensionRegistry::Get(profile_)->GetExtensionById( |
| 36 extension_misc::kChromeVoxExtensionId, |
| 37 extensions::ExtensionRegistry::ENABLED); |
| 38 if (!chromevox_extension) |
| 39 return; |
| 40 extensions::ExtensionTabUtil::OpenOptionsPage( |
| 41 chromevox_extension, |
| 42 chrome::FindBrowserWithWebContents(web_ui()->GetWebContents())); |
| 43 } |
| 44 |
| 45 } // namespace settings |
| 46 } // namespace chromeos |
| OLD | NEW |