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

Unified Diff: editor/tools/plugins/com.google.dart.tools.debug.ui/src/com/google/dart/tools/debug/ui/internal/DartDebugUserAgentManager.java

Issue 334853002: merge cl for mobile support fixes and features in editor (Closed) Base URL: http://dart.googlecode.com/svn/trunk/dart/
Patch Set: Created 6 years, 6 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
« no previous file with comments | « editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/mobile/AndroidDebugBridge.java ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: editor/tools/plugins/com.google.dart.tools.debug.ui/src/com/google/dart/tools/debug/ui/internal/DartDebugUserAgentManager.java
===================================================================
--- editor/tools/plugins/com.google.dart.tools.debug.ui/src/com/google/dart/tools/debug/ui/internal/DartDebugUserAgentManager.java (revision 37568)
+++ editor/tools/plugins/com.google.dart.tools.debug.ui/src/com/google/dart/tools/debug/ui/internal/DartDebugUserAgentManager.java (working copy)
@@ -14,6 +14,7 @@
package com.google.dart.tools.debug.ui.internal;
+import com.google.dart.tools.core.DartCore;
import com.google.dart.tools.debug.core.DartDebugCorePlugin;
import com.google.dart.tools.debug.core.IUserAgentManager;
@@ -45,8 +46,6 @@
boolean allowed;
}
- private static boolean dialogOpen = false;
-
static void install() {
DartDebugCorePlugin.getPlugin().setUserAgentManager(new DartDebugUserAgentManager());
}
@@ -65,18 +64,26 @@
}
// check if it's an existing agent
- if (isKnownAgent(remoteAddress.getHostAddress(), agentName)) {
+ if (isKnownAgent(remoteAddress, agentName)) {
return agentAllowed(remoteAddress, agentName);
}
// ask the user
- if (dialogOpen) {
+ if (DartCore.allowConnectionDialogOpen) {
return false;
}
- dialogOpen = true;
+ DartCore.allowConnectionDialogOpen = true;
boolean allowConnection = askUserAllows(remoteAddress, agentName);
+ addAgentData(remoteAddress, agentName, allowConnection);
+
+ DartCore.allowConnectionDialogOpen = false;
+ return allowConnection;
+
+ }
+
+ private void addAgentData(InetAddress remoteAddress, String agentName, boolean allowConnection) {
AgentData data = new AgentData();
data.address = remoteAddress.getHostAddress();
@@ -84,10 +91,6 @@
data.allowed = allowConnection;
agents.add(data);
saveSettings();
-
- dialogOpen = false;
- return allowConnection;
-
}
private boolean agentAllowed(InetAddress remoteAddress, String agent) {
@@ -138,12 +141,21 @@
return DartDebugUIPlugin.getDefault().getStateLocation().append("agentdata.txt").toFile();
}
- private boolean isKnownAgent(String address, String agent) {
+ private boolean isKnownAgent(InetAddress remoteAddress, String agent) {
+ String remoteAddressString = remoteAddress.getHostAddress();
for (AgentData data : agents) {
- if (address.equals(data.address) && agent.equals(data.agentName)) {
+ if (remoteAddressString.equals(data.address) && agent.equals(data.agentName)) {
return true;
}
}
+ if (agent.equals("com.google.dart.editor.mobile.connection.service")) {
+ for (AgentData data : agents) {
+ if (remoteAddressString.equals(data.address)) {
+ addAgentData(remoteAddress, agent, true);
+ return true;
+ }
+ }
+ }
return false;
}
« no previous file with comments | « editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/mobile/AndroidDebugBridge.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698