Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(119)

Unified Diff: components/devtools_bridge/android/java/src/org/chromium/components/devtools_bridge/commands/Command.java

Issue 1142463003: Remove devtools_bridge component (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/devtools_bridge/android/java/src/org/chromium/components/devtools_bridge/commands/Command.java
diff --git a/components/devtools_bridge/android/java/src/org/chromium/components/devtools_bridge/commands/Command.java b/components/devtools_bridge/android/java/src/org/chromium/components/devtools_bridge/commands/Command.java
deleted file mode 100644
index d71eacfc01eb3699a90bebff2272a331de5baad1..0000000000000000000000000000000000000000
--- a/components/devtools_bridge/android/java/src/org/chromium/components/devtools_bridge/commands/Command.java
+++ /dev/null
@@ -1,84 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-package org.chromium.components.devtools_bridge.commands;
-
-import java.util.Map;
-
-/**
- * Base class for a command. Command is an abstracton over GCD's command. Command
- * has state, in- and out-parameters. Both parameters are encoded as a hash of strings.
- */
-public abstract class Command {
- public final Type type;
- public final String id;
-
- private State mState = State.INITIAL;
- private String mErrorMessage;
-
- public enum State {
- INITIAL, DONE, ERROR
- }
-
- public enum Type {
- START_SESSION(Commands.StartSessionCommand.DEFINITION),
- ICE_EXCHANGE(Commands.IceExchangeCommand.DEFINITION),
- RENEGOTIATE(Commands.RenegotiateCommand.DEFINITION);
-
- public final CommandDefinition definition;
-
- Type(CommandDefinition definition) {
- this.definition = definition;
- }
- }
-
- /**
- * Provides access to parameters values with the Visitor pattern.
- */
- public interface ParamVisitor {
- void visit(ParamDefinition<?> param, String value);
- }
-
- protected Command(Type type, String id) {
- assert type != null;
-
- this.type = type;
- this.id = id;
- }
-
- public State state() {
- return mState;
- }
-
- public abstract void visitInParams(ParamVisitor visitor);
-
- public abstract void visitOutParams(ParamVisitor visitor);
-
- protected abstract void setOutParams(Map<String, String> actualOutParams)
- throws CommandFormatException;
-
- protected final void setDone() {
- assert mState == State.INITIAL;
-
- mState = State.DONE;
- }
-
- public void setSuccess(Map<String, String> actualOutParams) throws CommandFormatException {
- setOutParams(actualOutParams);
- setDone();
- }
-
- public void setFailure(String errorMessage) {
- assert mState == State.INITIAL;
-
- mState = State.ERROR;
- mErrorMessage = errorMessage;
- }
-
- public String getErrorMessage() {
- assert mState == State.ERROR;
-
- return mErrorMessage;
- }
-}

Powered by Google App Engine
This is Rietveld 408576698