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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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::FundamentalValue val(exists); |
61 web_ui()->CallJavascriptFunction("PointerOverlay.showTouchpadControls", val); | 61 web_ui()->CallJavascriptFunctionUnsafe("PointerOverlay.showTouchpadControls", |
| 62 val); |
62 UpdateTitle(); | 63 UpdateTitle(); |
63 } | 64 } |
64 | 65 |
65 void PointerHandler::MouseExists(bool exists) { | 66 void PointerHandler::MouseExists(bool exists) { |
66 has_mouse_ = exists; | 67 has_mouse_ = exists; |
67 base::FundamentalValue val(exists); | 68 base::FundamentalValue val(exists); |
68 web_ui()->CallJavascriptFunction("PointerOverlay.showMouseControls", val); | 69 web_ui()->CallJavascriptFunctionUnsafe("PointerOverlay.showMouseControls", |
| 70 val); |
69 UpdateTitle(); | 71 UpdateTitle(); |
70 } | 72 } |
71 | 73 |
72 void PointerHandler::UpdateTitle() { | 74 void PointerHandler::UpdateTitle() { |
73 std::string label; | 75 std::string label; |
74 if (has_touchpad_) { | 76 if (has_touchpad_) { |
75 label = has_mouse_ ? "pointerOverlayTitleTouchpadMouse" : | 77 label = has_mouse_ ? "pointerOverlayTitleTouchpadMouse" : |
76 "pointerOverlayTitleTouchpadOnly"; | 78 "pointerOverlayTitleTouchpadOnly"; |
77 } else { | 79 } else { |
78 label = has_mouse_ ? "pointerOverlayTitleMouseOnly" : ""; | 80 label = has_mouse_ ? "pointerOverlayTitleMouseOnly" : ""; |
79 } | 81 } |
80 base::StringValue val(label); | 82 base::StringValue val(label); |
81 web_ui()->CallJavascriptFunction("PointerOverlay.setTitle", val); | 83 web_ui()->CallJavascriptFunctionUnsafe("PointerOverlay.setTitle", val); |
82 } | 84 } |
83 | 85 |
84 } // namespace options | 86 } // namespace options |
85 } // namespace chromeos | 87 } // namespace chromeos |
OLD | NEW |