| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2011 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.wip; | |
| 6 | |
| 7 import org.chromium.sdk.JsEvaluateContext; | |
| 8 import org.chromium.sdk.RelayOk; | |
| 9 import org.chromium.sdk.SyncCallback; | |
| 10 import org.chromium.sdk.internal.wip.protocol.input.WipCommandResponse; | |
| 11 import org.chromium.sdk.internal.wip.protocol.output.runtime.ReleaseObjectGroupP
arams; | |
| 12 import org.chromium.sdk.util.GenericCallback; | |
| 13 import org.chromium.sdk.wip.PermanentRemoteValueMapping; | |
| 14 | |
| 15 class PermanentRemoteValueMappingImpl extends WipValueLoader | |
| 16 implements PermanentRemoteValueMapping { | |
| 17 private final String id; | |
| 18 | |
| 19 PermanentRemoteValueMappingImpl(WipTabImpl tabImpl, String id) { | |
| 20 super(tabImpl); | |
| 21 this.id = id; | |
| 22 } | |
| 23 | |
| 24 @Override | |
| 25 public String getId() { | |
| 26 return id; | |
| 27 } | |
| 28 | |
| 29 @Override | |
| 30 public RelayOk delete(final GenericCallback<Void> callback, SyncCallback syncC
allback) { | |
| 31 ReleaseObjectGroupParams params = new ReleaseObjectGroupParams(id); | |
| 32 WipCommandCallback callbackWrapper; | |
| 33 if (callback == null) { | |
| 34 callbackWrapper = null; | |
| 35 } else { | |
| 36 callbackWrapper = new WipCommandCallback() { | |
| 37 @Override | |
| 38 public void messageReceived(WipCommandResponse response) { | |
| 39 callback.success(null); | |
| 40 } | |
| 41 | |
| 42 @Override | |
| 43 public void failure(String message) { | |
| 44 callback.failure(new Exception(message)); | |
| 45 } | |
| 46 }; | |
| 47 } | |
| 48 return getTabImpl().getCommandProcessor().send(params, callbackWrapper, sync
Callback); | |
| 49 } | |
| 50 | |
| 51 @Override | |
| 52 String getObjectGroupId() { | |
| 53 return id; | |
| 54 } | |
| 55 | |
| 56 @Override | |
| 57 public JsEvaluateContext getEvaluateContext() { | |
| 58 return new WipContextBuilder.GlobalEvaluateContext(this); | |
| 59 } | |
| 60 } | |
| OLD | NEW |