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