Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / ios / web / browser_url_rewriter_impl.h
bloba0568f92f957fc686e3681060545c5e94cf48031
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 #ifndef IOS_WEB_BROWSER_URL_REWRITER_IMPL_H_
6 #define IOS_WEB_BROWSER_URL_REWRITER_IMPL_H_
8 #include <vector>
10 #include "base/memory/singleton.h"
11 #include "ios/web/public/browser_url_rewriter.h"
13 class GURL;
15 namespace web {
17 // Concrete subclass of web::BrowserURLRewriter. Stores added URLRewriters in a
18 // vector and performs URL rewrites if necessary.
19 class BrowserURLRewriterImpl : public BrowserURLRewriter {
20 public:
21 // Returns the singleton instance.
22 static BrowserURLRewriterImpl* GetInstance();
24 // BrowserURLRewriter implementation:
25 bool RewriteURLIfNecessary(GURL* url, BrowserState* browser_state) override;
26 void AddURLRewriter(URLRewriter rewriter) override;
28 private:
29 // This object is a singleton:
30 BrowserURLRewriterImpl();
31 ~BrowserURLRewriterImpl() override;
32 friend struct base::DefaultSingletonTraits<BrowserURLRewriterImpl>;
34 // The list of known URLRewriters.
35 std::vector<URLRewriter> url_rewriters_;
37 DISALLOW_COPY_AND_ASSIGN(BrowserURLRewriterImpl);
40 } // namespace web
42 #endif // IOS_WEB_BROWSER_URL_REWRITER_IMPL_H_