tests/shared/browser/extension_util.cc
// Asynchronously reads the manifest and executes |callback| on the UI thread.
Asynchronously reads the manifest and executes |callback| on the UI thread.
Asynchronously reads the manifest and executes |callback| on the UI thread .
void GetInternalManifest(const std::string& extension_path,
                         ManifestCallback callback) {
  if (!CefCurrentlyOn(TID_FILE_USER_BLOCKING)) {
    CefPostTask(TID_FILE_USER_BLOCKING,
                base::BindOnce(GetInternalManifest, extension_path,
                               std::move(callback)));
    return;
  }
  const std::string& manifest_path = GetInternalExtensionResourcePath(
      file_util::JoinPath(extension_path, "manifest.json"));
  std::string manifest_contents;
  if (!LoadBinaryResource(manifest_path.c_str(), manifest_contents) ||
      manifest_contents.empty()) {
    LOG(ERROR) << "Failed to load manifest from " << manifest_path;
    RunManifestCallback(std::move(callback), nullptr);
    return;
  }
  CefString error_msg;
  CefRefPtr<CefValue> value =
      CefParseJSONAndReturnError(manifest_contents, JSON_PARSER_RFC, error_msg);
  if (!value || value->GetType() != VTYPE_DICTIONARY) {
    if (error_msg.empty())
      error_msg = "Incorrectly formatted dictionary contents.";
    LOG(ERROR) << "Failed to parse manifest from " << manifest_path << "; "
               << error_msg.ToString();
    RunManifestCallback(std::move(callback), nullptr);
    return;
  }
  RunManifestCallback(std::move(callback), value->GetDictionary());
}
void GetInternalManifest ( const std :: string & extension_path , ManifestCallback callback ) { if ( ! CefCurrentlyOn ( TID_FILE_USER_BLOCKING ) ) { CefPostTask ( TID_FILE_USER_BLOCKING , base :: BindOnce ( GetInternalManifest , extension_path , std :: move ( callback ) ) ) ; return ; } const std :: string & manifest_path = GetInternalExtensionResourcePath ( file_util :: JoinPath ( extension_path , " " ) ) ; std :: string manifest_contents ; if ( ! LoadBinaryResource ( manifest_path . c_str ( ) , manifest_contents ) || manifest_contents . empty ( ) ) { LOG ( ERROR ) << " " << manifest_path ; RunManifestCallback ( std :: move ( callback ) , nullptr ) ; return ; } CefString error_msg ; CefRefPtr < CefValue > value = CefParseJSONAndReturnError ( manifest_contents , JSON_PARSER_RFC , error_msg ) ; if ( ! value || value -> GetType ( ) != VTYPE_DICTIONARY ) { if ( error_msg . empty ( ) ) error_msg = " " ; LOG ( ERROR ) << " " << manifest_path << " " << error_msg . ToString ( ) ; RunManifestCallback ( std :: move ( callback ) , nullptr ) ; return ; } RunManifestCallback ( std :: move ( callback ) , value -> GetDictionary ( ) ) ; }
Asynchronously reads the manifest and executes |callback| on the UI thread.
Asynchronously reads the manifest and executes |callback| on the UI thread .
// Execute on the browser FILE thread.