How does Drupal determine the context in which to display the admin theme?
There is now a hook for this: hook_admin_paths(). As usual, the default configuration is in system_admin_paths() but there are many other implementations in core, search for _admin_paths.