OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/ui/webui/options/chromeos/pointer_handler.h" | 5 #include "chrome/browser/ui/webui/options/chromeos/pointer_handler.h" |
6 | 6 |
7 #include "base/macros.h" | 7 #include "base/macros.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "base/values.h" | 9 #include "base/values.h" |
10 #include "chrome/common/url_constants.h" | 10 #include "chrome/common/url_constants.h" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 l10n_util::GetStringFUTF16( | 50 l10n_util::GetStringFUTF16( |
51 IDS_OPTIONS_SETTINGS_NATURAL_SCROLL_DESCRIPTION, | 51 IDS_OPTIONS_SETTINGS_NATURAL_SCROLL_DESCRIPTION, |
52 base::ASCIIToUTF16(chrome::kNaturalScrollHelpURL))); | 52 base::ASCIIToUTF16(chrome::kNaturalScrollHelpURL))); |
53 | 53 |
54 RegisterStrings(localized_strings, resources, arraysize(resources)); | 54 RegisterStrings(localized_strings, resources, arraysize(resources)); |
55 } | 55 } |
56 | 56 |
57 | 57 |
58 void PointerHandler::TouchpadExists(bool exists) { | 58 void PointerHandler::TouchpadExists(bool exists) { |
59 has_touchpad_ = exists; | 59 has_touchpad_ = exists; |
60 base::FundamentalValue val(exists); | 60 base::Value val(exists); |
61 web_ui()->CallJavascriptFunctionUnsafe("PointerOverlay.showTouchpadControls", | 61 web_ui()->CallJavascriptFunctionUnsafe("PointerOverlay.showTouchpadControls", |
62 val); | 62 val); |
63 UpdateTitle(); | 63 UpdateTitle(); |
64 } | 64 } |
65 | 65 |
66 void PointerHandler::MouseExists(bool exists) { | 66 void PointerHandler::MouseExists(bool exists) { |
67 has_mouse_ = exists; | 67 has_mouse_ = exists; |
68 base::FundamentalValue val(exists); | 68 base::Value val(exists); |
69 web_ui()->CallJavascriptFunctionUnsafe("PointerOverlay.showMouseControls", | 69 web_ui()->CallJavascriptFunctionUnsafe("PointerOverlay.showMouseControls", |
70 val); | 70 val); |
71 UpdateTitle(); | 71 UpdateTitle(); |
72 } | 72 } |
73 | 73 |
74 void PointerHandler::UpdateTitle() { | 74 void PointerHandler::UpdateTitle() { |
75 std::string label; | 75 std::string label; |
76 if (has_touchpad_) { | 76 if (has_touchpad_) { |
77 label = has_mouse_ ? "pointerOverlayTitleTouchpadMouse" : | 77 label = has_mouse_ ? "pointerOverlayTitleTouchpadMouse" : |
78 "pointerOverlayTitleTouchpadOnly"; | 78 "pointerOverlayTitleTouchpadOnly"; |
79 } else { | 79 } else { |
80 label = has_mouse_ ? "pointerOverlayTitleMouseOnly" : ""; | 80 label = has_mouse_ ? "pointerOverlayTitleMouseOnly" : ""; |
81 } | 81 } |
82 base::StringValue val(label); | 82 base::StringValue val(label); |
83 web_ui()->CallJavascriptFunctionUnsafe("PointerOverlay.setTitle", val); | 83 web_ui()->CallJavascriptFunctionUnsafe("PointerOverlay.setTitle", val); |
84 } | 84 } |
85 | 85 |
86 } // namespace options | 86 } // namespace options |
87 } // namespace chromeos | 87 } // namespace chromeos |
OLD | NEW |