Java 类com.facebook.stetho.inspector.protocol.ChromeDevtoolsDomain 实例源码

项目:stetho-realm    文件:StethoRealmInspectorModulesProvider.java   
@Override
public Iterable<ChromeDevtoolsDomain> get() {
    final List<ChromeDevtoolsDomain> modules = new ArrayList<>();

    final Iterable<ChromeDevtoolsDomain> base = baseProvider.get();
    if (base != null) {
        for (ChromeDevtoolsDomain domain : base) {
            // TODO Make it work with SQLite.
            if (!(domain instanceof com.facebook.stetho.inspector.protocol.module.Database)) {
                modules.add(domain);
            }
        }
    }

    modules.add(
        new Database(applicationContext.getPackageName(), dirs, namePattern, encryptionKeys));

    return modules;
}
项目:historian    文件:HistorianInspectorModulesProvider.java   
@Override
public Iterable<ChromeDevtoolsDomain> get() {
  return new Stetho.DefaultInspectorModulesBuilder(context)
      .provideDatabaseDriver(new SqliteDatabaseDriver(context,
          new DatabaseFilesProvider() {
            @Override
            public List<File> getDatabaseFiles() {
              List<File> list = new ArrayList<>();
              list.add(new File(historian.dbPath()));
              return list;
            }
          }, new DatabaseConnectionProvider() {
        @Override
        public SQLiteDatabase openDatabase(File file) throws SQLiteException {
          return historian.getDatabase();
        }
      }))
      .finish();
}
项目:StethoRealm    文件:RealmInspectorModulesProvider.java   
@Override
public Iterable<ChromeDevtoolsDomain> get() {
    final List<ChromeDevtoolsDomain> modules = new ArrayList<>();
    for (ChromeDevtoolsDomain domain : baseProvider.get()) {
        if (domain instanceof com.facebook.stetho.inspector.protocol.module.Database) {
            continue;
        }
        modules.add(domain);
    }
    modules.add(new Database(
            packageName,
            new RealmFilesProvider(folder, databaseNamePattern),
            withMetaTables,
            limit,
            ascendingOrder,
            defaultEncryptionKey,
            encryptionKeys));
    return modules;
}
项目:stetho    文件:MethodDispatcher.java   
private static Map<String, MethodDispatchHelper> buildDispatchTable(
    ObjectMapper objectMapper,
    Iterable<ChromeDevtoolsDomain> domainHandlers) {
  Util.throwIfNull(objectMapper);
  HashMap<String, MethodDispatchHelper> methods = new HashMap<String, MethodDispatchHelper>();
  for (ChromeDevtoolsDomain domainHandler : Util.throwIfNull(domainHandlers)) {
    Class<?> handlerClass = domainHandler.getClass();
    String domainName = handlerClass.getSimpleName();

    for (Method method : handlerClass.getDeclaredMethods()) {
      if (isDevtoolsMethod(method)) {
        MethodDispatchHelper dispatchHelper = new MethodDispatchHelper(
            objectMapper,
            domainHandler,
            method);
        methods.put(domainName + "." + method.getName(), dispatchHelper);
      }
    }
  }
  return Collections.unmodifiableMap(methods);
}
项目:ResourceInspector    文件:ResourceInspector.java   
private static Iterable<ChromeDevtoolsDomain> getInspectorModules(Context context) {
    final ArrayList<ChromeDevtoolsDomain> modules = new ArrayList<>();

    final DocumentProviderFactory factory = new RIAndroidDocumentProviderFactory(
            (Application) context.getApplicationContext(), Collections.<DescriptorProvider>emptyList());
    final Document document = new Document(factory);
    modules.add(new DOM(document));
    modules.add(new CSS(document));
    modules.add(new Page(context));

    return modules;
}
项目:Stetho-Couchbase    文件:CouchbaseInspectorModulesProvider.java   
@Override
public Iterable<ChromeDevtoolsDomain> get() {
    final List<ChromeDevtoolsDomain> modules = new ArrayList<>();
    for (ChromeDevtoolsDomain domain : Stetho.defaultInspectorModulesProvider(mContext).get()) {
        Timber.d("Domain: %s", domain.toString());
        if (domain instanceof com.facebook.stetho.inspector.protocol.module.Database) {
            continue;
        }
        modules.add(domain);
    }

    modules.add(new Database(new CouchbasePeerManager(mContext, mContext.getPackageName(), mShowMetadata)));
    return modules;
}
项目:stetho    文件:Stetho.java   
/**
 * Start the listening server.  Most of the heavy lifting initialization is deferred until the
 * first socket connection is received, allowing this to be safely used for debug builds on
 * even low-end hardware without noticeably affecting performance.
 */
public static void initializeWithDefaults(final Context context) {
  initialize(new Initializer(context) {
    @Override
    protected Iterable<DumperPlugin> getDumperPlugins() {
      return new DefaultDumperPluginsBuilder(context).finish();
    }

    @Override
    protected Iterable<ChromeDevtoolsDomain> getInspectorModules() {
      return new DefaultInspectorModulesBuilder(context).finish();
    }
  });
}
项目:stetho    文件:Stetho.java   
public static InspectorModulesProvider defaultInspectorModulesProvider(final Context context) {
  return new InspectorModulesProvider() {
    @Override
    public Iterable<ChromeDevtoolsDomain> get() {
      return new DefaultInspectorModulesBuilder(context).finish();
    }
  };
}
项目:stetho    文件:Stetho.java   
@Override
public SocketHandler create() {
  ProtocolDetectingSocketHandler socketHandler =
      new ProtocolDetectingSocketHandler(mContext);

  Iterable<DumperPlugin> dumperPlugins = getDumperPlugins();
  if (dumperPlugins != null) {
    Dumper dumper = new Dumper(dumperPlugins);

    socketHandler.addHandler(
        new ProtocolDetectingSocketHandler.ExactMagicMatcher(
            DumpappSocketLikeHandler.PROTOCOL_MAGIC),
        new DumpappSocketLikeHandler(dumper));

    // Support the old HTTP-based protocol since it's relatively straight forward to do.
    DumpappHttpSocketLikeHandler legacyHandler = new DumpappHttpSocketLikeHandler(dumper);
    socketHandler.addHandler(
        new ProtocolDetectingSocketHandler.ExactMagicMatcher(
            "GET /dumpapp".getBytes()),
        legacyHandler);
    socketHandler.addHandler(
        new ProtocolDetectingSocketHandler.ExactMagicMatcher(
            "POST /dumpapp".getBytes()),
        legacyHandler);
  }

  Iterable<ChromeDevtoolsDomain> inspectorModules = getInspectorModules();
  if (inspectorModules != null) {
    socketHandler.addHandler(
        new ProtocolDetectingSocketHandler.AlwaysMatchMatcher(),
        new DevtoolsSocketHandler(mContext, inspectorModules));
  }

  return socketHandler;
}
项目:stetho    文件:MethodDispatcher.java   
public MethodDispatchHelper(ObjectMapper objectMapper,
    ChromeDevtoolsDomain instance,
    Method method) {
  mObjectMapper = objectMapper;
  mInstance = instance;
  mMethod = method;
}
项目:asstudydemo    文件:DemoApplication.java   
@Override
    public void onCreate() {
        super.onCreate();
        if (null == demoAppContext) {
            demoAppContext = getApplicationContext();
        }
//        queues = Volley.newRequestQueue(demoAppContext);
//        CrashHandler crashHandler = CrashHandler.getInstance();
//        crashHandler.init(getApplicationContext());
//        crashHandler.initActivityContainer(container);
        container = new ArrayList<>(5);

        if (Constants.IS_OPEN_UI_BLOCK_CANARY) {
            sContext = this;
            BlockCanary.install(this, new DemoBlockCanaryContext()).start();
        }
        if (Constants.IS_OPEN_LEAK_CANARY) {
            refWatcher = initLeakCanary();
        }

        if (Constants.IS_OPEN_STETHO) {
            // 查看 dumpapp 信息
//            Stetho.initialize(Stetho.newInitializerBuilder(this).enableDumpapp(new DumperPluginsProvider() {
//                @Override
//                public Iterable<DumperPlugin> get() {
//                    return new Stetho.DefaultDumperPluginsBuilder(DemoApplication.this).provide(new HelloWorldDumperPlugin()).provide(new APODDumperPlugin(DemoApplication.this.getContentResolver())).finish();
//                }
//            }).enableWebKitInspector(new ExtInspectorModulesProvider(DemoApplication.this)).build());
            // 调用 JS
            Stetho.initialize(Stetho.newInitializerBuilder(DemoApplication.this).enableWebKitInspector(new InspectorModulesProvider() {
                @Override
                public Iterable<ChromeDevtoolsDomain> get() {
                    return new Stetho.DefaultInspectorModulesBuilder(DemoApplication.this).runtimeRepl(new JsRuntimeReplFactoryBuilder(DemoApplication.this)
                            // Pass to JavaScript: var foo = "bar";
                            .addVariable("foo", "bar").build()).finish();
                }
            }).build());
        }

    }
项目:ResourceInspector    文件:RIDevtoolsSocketHandler.java   
public RIDevtoolsSocketHandler(Context context, Iterable<ChromeDevtoolsDomain> modules) {
    mContext = context;
    mModules = modules;
    mServer = createServer();
}
项目:stetho    文件:Stetho.java   
private DefaultInspectorModulesBuilder provideIfDesired(ChromeDevtoolsDomain module) {
  mDelegate.provideIfDesired(module.getClass().getName(), module);
  return this;
}
项目:stetho    文件:Stetho.java   
public Iterable<ChromeDevtoolsDomain> finish() {
  provideIfDesired(new Console());
  provideIfDesired(new Debugger());
  DocumentProviderFactory documentModel = resolveDocumentProvider();
  if (documentModel != null) {
    Document document = new Document(documentModel);
    provideIfDesired(new DOM(document));
    provideIfDesired(new CSS(document));
  }
  provideIfDesired(new DOMStorage(mContext));
  provideIfDesired(new HeapProfiler());
  provideIfDesired(new Inspector());
  provideIfDesired(new Network(mContext));
  provideIfDesired(new Page(mContext));
  provideIfDesired(new Profiler());
  provideIfDesired(
      new Runtime(
          mRuntimeRepl != null ?
          mRuntimeRepl :
          new RhinoDetectingRuntimeReplFactory(mContext)));
  provideIfDesired(new Worker());
  if (Build.VERSION.SDK_INT >= DatabaseConstants.MIN_API_LEVEL) {
    Database database = new Database();
    boolean hasSqliteDatabaseDriver = false;
    if (mDatabaseDrivers != null) {
      for (DatabaseDriver2 databaseDriver : mDatabaseDrivers) {
        database.add(databaseDriver);
        if (databaseDriver instanceof SqliteDatabaseDriver) {
          hasSqliteDatabaseDriver = true;
        }
      }
    }
    if (!hasSqliteDatabaseDriver && !mExcludeSqliteDatabaseDriver) {
      database.add(
          new SqliteDatabaseDriver(mContext,
              mDatabaseFilesProvider != null ?
                  mDatabaseFilesProvider :
                  new DefaultDatabaseFilesProvider(mContext),
              new DefaultDatabaseConnectionProvider()));
    }
    provideIfDesired(database);
  }
  return mDelegate.finish();
}
项目:stetho    文件:Stetho.java   
@Nullable
protected abstract Iterable<ChromeDevtoolsDomain> getInspectorModules();
项目:stetho    文件:Stetho.java   
@Nullable
@Override
protected Iterable<ChromeDevtoolsDomain> getInspectorModules() {
  return mInspectorModules != null ? mInspectorModules.get() : null;
}
项目:stetho    文件:DevtoolsSocketHandler.java   
public DevtoolsSocketHandler(Context context, Iterable<ChromeDevtoolsDomain> modules) {
  mContext = context;
  mModules = modules;
  mServer = createServer();
}
项目:stetho    文件:MethodDispatcher.java   
public MethodDispatcher(
    ObjectMapper objectMapper,
    Iterable<ChromeDevtoolsDomain> domainHandlers) {
  mObjectMapper = objectMapper;
  mDomainHandlers = domainHandlers;
}
项目:stetho    文件:ChromeDevtoolsServer.java   
public ChromeDevtoolsServer(Iterable<ChromeDevtoolsDomain> domainModules) {
  mObjectMapper = new ObjectMapper();
  mMethodDispatcher = new MethodDispatcher(mObjectMapper, domainModules);
}
项目:stetho    文件:SampleDebugApplication.java   
@Override
public Iterable<ChromeDevtoolsDomain> get() {
  return new Stetho.DefaultInspectorModulesBuilder(mContext)
      .provideDatabaseDriver(createContentProviderDatabaseDriver(mContext))
      .finish();
}
项目:asstudydemo    文件:DemoApplication.java   
@Override
public Iterable<ChromeDevtoolsDomain> get() {
    return new Stetho.DefaultInspectorModulesBuilder(mContext).provideDatabaseDriver
            (createContentProviderDatabaseDriver(mContext)).finish();
}
项目:stetho    文件:Stetho.java   
/**
 * Provide either a new domain module or override an existing one.
 *
 * @deprecated This fine-grained control of the devtools modules is no longer supportable
 *     given the lack of isolation of modules in the actual protocol (many cross dependencies
 *     emerge when you implement more and more of the real protocol).
 */
@Deprecated
public DefaultInspectorModulesBuilder provide(ChromeDevtoolsDomain module) {
  mDelegate.provide(module.getClass().getName(), module);
  return this;
}
项目:stetho    文件:InspectorModulesProvider.java   
Iterable<ChromeDevtoolsDomain> get();