1// Copyright (c) 2012 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.
4
5#ifndef WEBKIT_GLUE_SIMPLE_WEBMIMEREGISTRY_IMPL_H_
6#define WEBKIT_GLUE_SIMPLE_WEBMIMEREGISTRY_IMPL_H_
7
8#include <string>
9
10#include "base/compiler_specific.h"
11#include "third_party/WebKit/public/platform/WebMimeRegistry.h"
12#include "webkit/glue/webkit_glue_export.h"
13
14namespace webkit_glue {
15
16class WEBKIT_GLUE_EXPORT SimpleWebMimeRegistryImpl :
17    NON_EXPORTED_BASE(public WebKit::WebMimeRegistry) {
18 public:
19  SimpleWebMimeRegistryImpl() {}
20  virtual ~SimpleWebMimeRegistryImpl() {}
21
22  // Convert a WebString to ASCII, falling back on an empty string in the case
23  // of a non-ASCII string.
24  static std::string ToASCIIOrEmpty(const WebKit::WebString& string);
25
26  // WebMimeRegistry methods:
27  virtual WebKit::WebMimeRegistry::SupportsType supportsMIMEType(
28      const WebKit::WebString&);
29  virtual WebKit::WebMimeRegistry::SupportsType supportsImageMIMEType(
30      const WebKit::WebString&);
31  virtual WebKit::WebMimeRegistry::SupportsType supportsJavaScriptMIMEType(
32      const WebKit::WebString&);
33  // TODO(ddorwin): Remove after http://webk.it/82983 lands.
34  virtual WebKit::WebMimeRegistry::SupportsType supportsMediaMIMEType(
35      const WebKit::WebString&, const WebKit::WebString&);
36  virtual WebKit::WebMimeRegistry::SupportsType supportsMediaMIMEType(
37      const WebKit::WebString&,
38      const WebKit::WebString&,
39      const WebKit::WebString&);
40  virtual bool supportsMediaSourceMIMEType(const WebKit::WebString&,
41                                           const WebKit::WebString&);
42  virtual WebKit::WebMimeRegistry::SupportsType supportsNonImageMIMEType(
43      const WebKit::WebString&);
44  virtual WebKit::WebString mimeTypeForExtension(const WebKit::WebString&);
45  virtual WebKit::WebString wellKnownMimeTypeForExtension(
46      const WebKit::WebString&);
47  virtual WebKit::WebString mimeTypeFromFile(const WebKit::WebString&);
48  virtual WebKit::WebString preferredExtensionForMIMEType(
49      const WebKit::WebString&);
50};
51
52}  // namespace webkit_glue
53
54#endif  // WEBKIT_GLUE_SIMPLE_WEBMIMEREGISTRY_IMPL_H_
55