| 1 |
// Copyright 2014 The Closure Library Authors. All Rights Reserved. |
| 2 |
// |
| 3 |
// Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 |
// you may not use this file except in compliance with the License. |
| 5 |
// You may obtain a copy of the License at |
| 6 |
// |
| 7 |
// http://www.apache.org/licenses/LICENSE-2.0 |
| 8 |
// |
| 9 |
// Unless required by applicable law or agreed to in writing, software |
| 10 |
// distributed under the License is distributed on an "AS-IS" BASIS, |
| 11 |
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 |
// See the License for the specific language governing permissions and |
| 13 |
// limitations under the License. |
| 14 |
|
| 15 |
/** |
| 16 |
* @fileoverview Constants for determining keyboard support. |
| 17 |
*/ |
| 18 |
|
| 19 |
goog.provide('goog.userAgent.keyboard'); |
| 20 |
|
| 21 |
goog.require('goog.labs.userAgent.platform'); |
| 22 |
|
| 23 |
|
| 24 |
/** |
| 25 |
* @define {boolean} Whether the user agent is running with in an environment |
| 26 |
* that should use Mac-based keyboard shortcuts (Meta instead of Ctrl, etc.). |
| 27 |
*/ |
| 28 |
goog.define('goog.userAgent.keyboard.ASSUME_MAC_KEYBOARD', false); |
| 29 |
|
| 30 |
|
| 31 |
/** |
| 32 |
* Determines whether Mac-based keyboard shortcuts should be used. |
| 33 |
* @return {boolean} |
| 34 |
* @private |
| 35 |
*/ |
| 36 |
goog.userAgent.keyboard.determineMacKeyboard_ = function() { |
| 37 |
return goog.labs.userAgent.platform.isMacintosh() || |
| 38 |
goog.labs.userAgent.platform.isIos(); |
| 39 |
}; |
| 40 |
|
| 41 |
|
| 42 |
/** |
| 43 |
* Whether the user agent is running in an environment that uses Mac-based |
| 44 |
* keyboard shortcuts. |
| 45 |
* @type {boolean} |
| 46 |
*/ |
| 47 |
goog.userAgent.keyboard.MAC_KEYBOARD = |
| 48 |
goog.userAgent.keyboard.ASSUME_MAC_KEYBOARD || |
| 49 |
goog.userAgent.keyboard.determineMacKeyboard_(); |