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

Unified Diff: chrome/browser/ui/webui/options/chromeos/system_options_handler.cc

Issue 8965070: Change system settings based on when mouse/touchpad is connected/disconnected. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/webui/options/chromeos/system_options_handler.cc
===================================================================
--- chrome/browser/ui/webui/options/chromeos/system_options_handler.cc (revision 115229)
+++ chrome/browser/ui/webui/options/chromeos/system_options_handler.cc (working copy)
@@ -44,12 +44,19 @@
void TouchpadExistsFileThread(bool* exists) {
*exists = chromeos::system::touchpad_settings::TouchpadExists();
}
+
+void MouseExistsFileThread(bool* exists) {
+ *exists = chromeos::system::mouse_settings::MouseExists();
}
+} // namespace
+
SystemOptionsHandler::SystemOptionsHandler() {
}
SystemOptionsHandler::~SystemOptionsHandler() {
+ chromeos::XInputHierarchyChangedEventListener::GetInstance()
+ ->RemoveObserver(this);
}
void SystemOptionsHandler::GetLocalizedValues(
@@ -126,19 +133,37 @@
web_ui_->CallJavascriptFunction(
"options.SystemOptions.SetAccessibilityCheckboxState", checked);
+ chromeos::XInputHierarchyChangedEventListener::GetInstance()
+ ->AddObserver(this);
+ DeviceChanged();
+}
+
+void SystemOptionsHandler::CheckTouchpadExists() {
bool* exists = new bool;
BrowserThread::PostTaskAndReply(BrowserThread::FILE, FROM_HERE,
base::Bind(&TouchpadExistsFileThread, exists),
base::Bind(&SystemOptionsHandler::TouchpadExists, AsWeakPtr(), exists));
}
+void SystemOptionsHandler::CheckMouseExists() {
+ bool* exists = new bool;
+ BrowserThread::PostTaskAndReply(BrowserThread::FILE, FROM_HERE,
+ base::Bind(&MouseExistsFileThread, exists),
+ base::Bind(&SystemOptionsHandler::MouseExists, AsWeakPtr(), exists));
+}
+
void SystemOptionsHandler::TouchpadExists(bool* exists) {
- if (*exists)
- web_ui_->CallJavascriptFunction(
- "options.SystemOptions.showTouchpadControls");
+ web_ui_->CallJavascriptFunction("options.SystemOptions.showTouchpadControls",
+ base::FundamentalValue(*exists));
xiyuan 2011/12/21 03:38:24 Think clang would bark on this and ask you to to d
achuithb 2011/12/21 22:15:01 That's unfortunate. Looks like this is part of the
delete exists;
}
+void SystemOptionsHandler::MouseExists(bool* exists) {
+ web_ui_->CallJavascriptFunction("options.SystemOptions.showMouseControls",
+ base::FundamentalValue(*exists));
+ delete exists;
+}
+
void SystemOptionsHandler::RegisterMessages() {
DCHECK(web_ui_);
web_ui_->RegisterMessageCallback("accessibilityChange",
@@ -153,6 +178,11 @@
base::Unretained(this)));
}
+void SystemOptionsHandler::DeviceChanged() {
+ CheckMouseExists();
+ CheckTouchpadExists();
+}
+
void SystemOptionsHandler::AccessibilityChangeCallback(const ListValue* args) {
std::string checked_str;
args->GetString(0, &checked_str);

Powered by Google App Engine
This is Rietveld 408576698