13551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)// Copyright 2013 The Chromium Authors. All rights reserved.
25821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be
35821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// found in the LICENSE file.
45821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
53551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)#include "content/shell/browser/shell_resource_dispatcher_host_delegate.h"
65821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
75821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "base/command_line.h"
83551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)#include "content/shell/browser/shell_login_dialog.h"
9b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)#include "content/shell/common/shell_switches.h"
105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)namespace content {
125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)ShellResourceDispatcherHostDelegate::ShellResourceDispatcherHostDelegate() {
145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}
155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)ShellResourceDispatcherHostDelegate::~ShellResourceDispatcherHostDelegate() {
175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}
185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)ResourceDispatcherHostLoginDelegate*
205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)ShellResourceDispatcherHostDelegate::CreateLoginDelegate(
215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    net::AuthChallengeInfo* auth_info, net::URLRequest* request) {
225d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree))
235d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)    return NULL;
245d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  if (!login_request_callback_.is_null()) {
265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    login_request_callback_.Run();
275821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    login_request_callback_.Reset();
285821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    return NULL;
295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  }
305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
31a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch#if !defined(OS_MACOSX)
325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// TODO: implement ShellLoginDialog for other platforms, drop this #if
335821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  return NULL;
345821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#else
355821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  return new ShellLoginDialog(auth_info, request);
365821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#endif
375821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}
385821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
395821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}  // namespace content
40