org.chromium.sdk/src/org/chromium/sdk/internal/tools/devtools/DevToolsServiceCommand.java
equal
deleted
inserted
replaced
|
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
|
2 // Use of this source code is governed by a BSD-style license that can be |
|
3 // found in the LICENSE file. |
|
4 |
|
5 package org.chromium.sdk.internal.tools.devtools; |
|
6 |
|
7 import java.util.HashMap; |
|
8 import java.util.Map; |
|
9 |
|
10 /** |
|
11 * Known DevToolsService tool commands. |
|
12 */ |
|
13 public enum DevToolsServiceCommand { |
|
14 PING("ping"), |
|
15 VERSION("version"), |
|
16 LIST_TABS("list_tabs"), |
|
17 ; |
|
18 |
|
19 private static Map<String, DevToolsServiceCommand> map = |
|
20 new HashMap<String, DevToolsServiceCommand>(); |
|
21 |
|
22 static { |
|
23 for (DevToolsServiceCommand command : values()) { |
|
24 map.put(command.commandName, command); |
|
25 } |
|
26 } |
|
27 |
|
28 public final String commandName; |
|
29 |
|
30 private DevToolsServiceCommand(String commandName) { |
|
31 this.commandName = commandName; |
|
32 } |
|
33 |
|
34 public static DevToolsServiceCommand forString(String commandName) { |
|
35 if (commandName == null) { |
|
36 return null; |
|
37 } |
|
38 return map.get(commandName); |
|
39 } |
|
40 } |