Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(221)

Side by Side Diff: mojo/shell/local_fetcher.h

Issue 1274433003: Add GetMimeTypeFromFile to Mojo's network service. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix string usage and NativeApplicationLoaderTest. Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « mojo/shell/application_manager.cc ('k') | mojo/shell/local_fetcher.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef MOJO_SHELL_LOCAL_FETCHER_H_ 5 #ifndef MOJO_SHELL_LOCAL_FETCHER_H_
6 #define MOJO_SHELL_LOCAL_FETCHER_H_ 6 #define MOJO_SHELL_LOCAL_FETCHER_H_
7 7
8 #include <string>
9
8 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
9 #include "mojo/services/network/public/interfaces/url_loader.mojom.h"
10 #include "mojo/shell/fetcher.h" 11 #include "mojo/shell/fetcher.h"
11 #include "url/gurl.h" 12 #include "url/gurl.h"
12 13
13 namespace mojo { 14 namespace mojo {
15
16 class NetworkService;
17
14 namespace shell { 18 namespace shell {
15 19
16 // Implements Fetcher for file:// URLs. 20 // Implements Fetcher for file:// URLs.
17 class LocalFetcher : public Fetcher { 21 class LocalFetcher : public Fetcher {
18 public: 22 public:
19 LocalFetcher(const GURL& url, 23 LocalFetcher(NetworkService* network_service,
24 const GURL& url,
20 const GURL& url_without_query, 25 const GURL& url_without_query,
21 const FetchCallback& loader_callback); 26 const FetchCallback& loader_callback);
22 27
28 void GetMimeTypeFromFileCallback(const mojo::String& mime_type);
29
23 private: 30 private:
24 const GURL& GetURL() const override; 31 const GURL& GetURL() const override;
25 GURL GetRedirectURL() const override; 32 GURL GetRedirectURL() const override;
26 GURL GetRedirectReferer() const override; 33 GURL GetRedirectReferer() const override;
27 34
28 URLResponsePtr AsURLResponse(base::TaskRunner* task_runner, 35 URLResponsePtr AsURLResponse(base::TaskRunner* task_runner,
29 uint32_t skip) override; 36 uint32_t skip) override;
30 37
31 void AsPath( 38 void AsPath(
32 base::TaskRunner* task_runner, 39 base::TaskRunner* task_runner,
33 base::Callback<void(const base::FilePath&, bool)> callback) override; 40 base::Callback<void(const base::FilePath&, bool)> callback) override;
34 41
35 std::string MimeType() override; 42 std::string MimeType() override;
36 43
37 bool HasMojoMagic() override; 44 bool HasMojoMagic() override;
38 45
39 bool PeekFirstLine(std::string* line) override; 46 bool PeekFirstLine(std::string* line) override;
40 47
41 GURL url_; 48 GURL url_;
42 base::FilePath path_; 49 base::FilePath path_;
50 std::string mime_type_;
43 51
44 DISALLOW_COPY_AND_ASSIGN(LocalFetcher); 52 DISALLOW_COPY_AND_ASSIGN(LocalFetcher);
45 }; 53 };
46 54
47 } // namespace shell 55 } // namespace shell
56
48 } // namespace mojo 57 } // namespace mojo
49 58
50 #endif // MOJO_SHELL_LOCAL_FETCHER_H_ 59 #endif // MOJO_SHELL_LOCAL_FETCHER_H_
OLDNEW
« no previous file with comments | « mojo/shell/application_manager.cc ('k') | mojo/shell/local_fetcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698