1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "base/files/file_path.h"
6 #include "mojo/fetcher/url_resolver.h"
7 #include "mojo/services/network/public/interfaces/network_service.mojom.h"
8 #include "mojo/services/network/public/interfaces/url_loader_factory.mojom.h"
9 #include "mojo/shell/application_fetcher.h"
14 // This is the default implementation of shell::ApplicationFetcher. It loads
15 // http/s urls off the network as well as providing special handling for mojo:
17 class BaseApplicationFetcher
: public shell::ApplicationFetcher
{
19 // mojo: urls are only supported if |shell_file_root| is non-empty.
20 BaseApplicationFetcher(const base::FilePath
& shell_file_root
);
21 ~BaseApplicationFetcher() override
;
24 // Overridden from shell::ApplicationFetcher:
25 void SetApplicationManager(shell::ApplicationManager
* manager
) override
;
26 GURL
ResolveURL(const GURL
& url
) override
;
28 URLRequestPtr request
,
29 const shell::Fetcher::FetchCallback
& loader_callback
) override
;
31 shell::ApplicationManager
* application_manager_
;
32 scoped_ptr
<URLResolver
> url_resolver_
;
33 const bool disable_cache_
;
34 NetworkServicePtr network_service_
;
35 URLLoaderFactoryPtr url_loader_factory_
;
37 DISALLOW_COPY_AND_ASSIGN(BaseApplicationFetcher
);
40 } // namespace fetcher