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

Side by Side Diff: ios/web/browser_url_rewriter_impl.cc

Issue 1308823002: Move Singleton and related structs to namespace base (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: ToT Created 5 years, 3 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 | « ios/web/browser_url_rewriter_impl.h ('k') | ios/web/net/cert_store_impl.h » ('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 #include "ios/web/browser_url_rewriter_impl.h" 5 #include "ios/web/browser_url_rewriter_impl.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/strings/string_util.h" 8 #include "base/strings/string_util.h"
9 #include "ios/web/public/browser_state.h" 9 #include "ios/web/public/browser_state.h"
10 #include "ios/web/public/web_client.h" 10 #include "ios/web/public/web_client.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 bool rewritten = false; 45 bool rewritten = false;
46 for (URLRewriter rewriter : rewriters) { 46 for (URLRewriter rewriter : rewriters) {
47 if ((rewritten = rewriter(url, browser_state))) 47 if ((rewritten = rewriter(url, browser_state)))
48 break; 48 break;
49 } 49 }
50 return rewritten; 50 return rewritten;
51 } 51 }
52 52
53 // static 53 // static
54 BrowserURLRewriterImpl* BrowserURLRewriterImpl::GetInstance() { 54 BrowserURLRewriterImpl* BrowserURLRewriterImpl::GetInstance() {
55 return Singleton<BrowserURLRewriterImpl>::get(); 55 return base::Singleton<BrowserURLRewriterImpl>::get();
56 } 56 }
57 57
58 BrowserURLRewriterImpl::BrowserURLRewriterImpl() { 58 BrowserURLRewriterImpl::BrowserURLRewriterImpl() {
59 web::WebClient* web_client = web::GetWebClient(); 59 web::WebClient* web_client = web::GetWebClient();
60 if (web_client) 60 if (web_client)
61 web_client->PostBrowserURLRewriterCreation(this); 61 web_client->PostBrowserURLRewriterCreation(this);
62 62
63 // view-source: 63 // view-source:
64 AddURLRewriter(&HandleViewSource); 64 AddURLRewriter(&HandleViewSource);
65 } 65 }
66 66
67 BrowserURLRewriterImpl::~BrowserURLRewriterImpl() { 67 BrowserURLRewriterImpl::~BrowserURLRewriterImpl() {
68 } 68 }
69 69
70 void BrowserURLRewriterImpl::AddURLRewriter(URLRewriter rewriter) { 70 void BrowserURLRewriterImpl::AddURLRewriter(URLRewriter rewriter) {
71 DCHECK(rewriter); 71 DCHECK(rewriter);
72 url_rewriters_.push_back(rewriter); 72 url_rewriters_.push_back(rewriter);
73 } 73 }
74 74
75 bool BrowserURLRewriterImpl::RewriteURLIfNecessary( 75 bool BrowserURLRewriterImpl::RewriteURLIfNecessary(
76 GURL* url, 76 GURL* url,
77 BrowserState* browser_state) { 77 BrowserState* browser_state) {
78 return BrowserURLRewriter::RewriteURLWithWriters(url, browser_state, 78 return BrowserURLRewriter::RewriteURLWithWriters(url, browser_state,
79 url_rewriters_); 79 url_rewriters_);
80 } 80 }
81 81
82 } // namespace web 82 } // namespace web
OLDNEW
« no previous file with comments | « ios/web/browser_url_rewriter_impl.h ('k') | ios/web/net/cert_store_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698