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_
10 #include "base/memory/singleton.h"
11 #include "ios/web/public/browser_url_rewriter.h"
17 // Concrete subclass of web::BrowserURLRewriter. Stores added URLRewriters in a
18 // vector and performs URL rewrites if necessary.
19 class BrowserURLRewriterImpl
: public BrowserURLRewriter
{
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
;
29 // This object is a singleton:
30 BrowserURLRewriterImpl();
31 ~BrowserURLRewriterImpl() override
;
32 friend struct DefaultSingletonTraits
<BrowserURLRewriterImpl
>;
34 // The list of known URLRewriters.
35 std::vector
<URLRewriter
> url_rewriters_
;
37 DISALLOW_COPY_AND_ASSIGN(BrowserURLRewriterImpl
);
42 #endif // IOS_WEB_BROWSER_URL_REWRITER_IMPL_H_