| OLD | NEW |
| 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" |
| 11 #include "url/gurl.h" | 11 #include "url/gurl.h" |
| 12 | 12 |
| 13 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 14 #error "This file requires ARC support." |
| 15 #endif |
| 16 |
| 13 namespace web { | 17 namespace web { |
| 14 | 18 |
| 15 namespace { | 19 namespace { |
| 16 | 20 |
| 17 // The scheme used to view the source of a page using WebUI in content/. | 21 // The scheme used to view the source of a page using WebUI in content/. |
| 18 const char kViewSourceScheme[] = "view-source"; | 22 const char kViewSourceScheme[] = "view-source"; |
| 19 | 23 |
| 20 // Handles rewriting view-source URLs for what we'll actually load. Since | 24 // Handles rewriting view-source URLs for what we'll actually load. Since |
| 21 // WebUI-based view-source isn't supported on iOS, simply strip out the scheme | 25 // WebUI-based view-source isn't supported on iOS, simply strip out the scheme |
| 22 // and load the URL. This is to gracefully handle tabs synced from other | 26 // and load the URL. This is to gracefully handle tabs synced from other |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 } | 76 } |
| 73 | 77 |
| 74 bool BrowserURLRewriterImpl::RewriteURLIfNecessary( | 78 bool BrowserURLRewriterImpl::RewriteURLIfNecessary( |
| 75 GURL* url, | 79 GURL* url, |
| 76 BrowserState* browser_state) { | 80 BrowserState* browser_state) { |
| 77 return BrowserURLRewriter::RewriteURLWithWriters(url, browser_state, | 81 return BrowserURLRewriter::RewriteURLWithWriters(url, browser_state, |
| 78 url_rewriters_); | 82 url_rewriters_); |
| 79 } | 83 } |
| 80 | 84 |
| 81 } // namespace web | 85 } // namespace web |
| OLD | NEW |