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 UA_TYPE_MAPPING = { | 5 UA_TYPE_MAPPING = { |
6 'desktop': | 6 'desktop': |
7 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_3) ' | 7 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_3) ' |
8 'AppleWebKit/537.22 (KHTML, like Gecko) ' | 8 'AppleWebKit/537.22 (KHTML, like Gecko) ' |
9 'Chrome/25.0.1364.2 Safari/537.22', | 9 'Chrome/25.0.1364.2 Safari/537.22', |
10 'mobile': | 10 'mobile': |
11 'Mozilla/5.0 (Linux; Android 4.0.4; Galaxy Nexus Build/IMM76B) ' | 11 'Mozilla/5.0 (Linux; Android 4.0.4; Galaxy Nexus Build/IMM76B) ' |
12 'AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.133 Mobile ' | 12 'AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.133 Mobile ' |
13 'Safari/535.19', | 13 'Safari/535.19', |
14 'tablet': | 14 'tablet': |
15 'Mozilla/5.0 (Linux; Android 4.0.4; Galaxy Nexus 7 Build/IMM76B) ' | 15 'Mozilla/5.0 (Linux; Android 4.0.4; Galaxy Nexus 7 Build/IMM76B) ' |
16 'AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.133 ' | 16 'AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.133 ' |
17 'Safari/535.19', | 17 'Safari/535.19', |
18 } | 18 } |
19 | 19 |
20 | 20 |
21 def GetChromeUserAgentArgumentFromType(user_agent_type): | 21 def GetChromeUserAgentArgumentFromType(user_agent_type): |
22 """Returns a chrome user agent based on a user agent type. | 22 """Returns a chrome user agent based on a user agent type. |
23 This is derived from: | 23 This is derived from: |
24 https://developers.google.com/chrome/mobile/docs/user-agent | 24 https://developers.google.com/chrome/mobile/docs/user-agent |
25 """ | 25 """ |
26 if user_agent_type: | 26 if user_agent_type: |
27 return ['--user-agent=%s' % UA_TYPE_MAPPING[user_agent_type]] | 27 return ['--user-agent=%s' % UA_TYPE_MAPPING[user_agent_type]] |
28 return [] | 28 return [] |
OLD | NEW |