Ejemplo n.º 1
0
NS_IMETHODIMP nsTreeBoxObject::SetView(nsITreeView * aView)
{
  if (!CanTrustView(aView))
    return NS_ERROR_DOM_SECURITY_ERR;
  
  nsITreeBoxObject* body = GetTreeBody();
  if (body) {
    body->SetView(aView);
  
    // only return if the body frame was able to store the view,
    // else we need to cache the property below
    nsCOMPtr<nsITreeView> view;
    body->GetView(getter_AddRefs(view));
    if (view)
      return NS_OK;
  }
  
  nsCOMPtr<nsISupports> suppView(do_QueryInterface(aView));
  if (suppView)
    SetPropertyAsSupports(NS_LITERAL_STRING("view").get(), suppView);
  else
    RemoveProperty(NS_LITERAL_STRING("view").get());

  return NS_OK;
}
Ejemplo n.º 2
0
NS_IMETHODIMP
nsTreeBoxObject::SetPropertyAsSupports(const PRUnichar* aPropertyName, nsISupports* aValue)
{
  NS_ENSURE_ARG(aPropertyName);
  
  if (nsDependentString(aPropertyName).EqualsLiteral("view") &&
      !CanTrustView(aValue))
    return NS_ERROR_DOM_SECURITY_ERR;

  return nsBoxObject::SetPropertyAsSupports(aPropertyName, aValue);
}
Ejemplo n.º 3
0
NS_IMETHODIMP nsTreeBoxObject::SetView(nsITreeView * aView)
{
  if (!CanTrustView(aView))
    return NS_ERROR_DOM_SECURITY_ERR;
  
  mView = aView;
  nsTreeBodyFrame* body = GetTreeBody();
  if (body)
    body->SetView(aView);

  return NS_OK;
}