OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 "content/browser/browser_url_handler_impl.h" | 5 #include "content/browser/browser_url_handler_impl.h" |
6 | 6 |
7 #include "base/strings/string_util.h" | 7 #include "base/strings/string_util.h" |
8 #include "content/browser/frame_host/debug_urls.h" | 8 #include "content/browser/frame_host/debug_urls.h" |
9 #include "content/browser/webui/web_ui_impl.h" | 9 #include "content/browser/webui/web_ui_impl.h" |
10 #include "content/public/browser/content_browser_client.h" | 10 #include "content/public/browser/content_browser_client.h" |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
82 // Required for VS2010: http://connect.microsoft.com/VisualStudio/feedback/det ails/520043/error-converting-from-null-to-a-pointer-type-in-std-pair | 82 // Required for VS2010: http://connect.microsoft.com/VisualStudio/feedback/det ails/520043/error-converting-from-null-to-a-pointer-type-in-std-pair |
83 return NULL; | 83 return NULL; |
84 } | 84 } |
85 | 85 |
86 // static | 86 // static |
87 BrowserURLHandlerImpl* BrowserURLHandlerImpl::GetInstance() { | 87 BrowserURLHandlerImpl* BrowserURLHandlerImpl::GetInstance() { |
88 return Singleton<BrowserURLHandlerImpl>::get(); | 88 return Singleton<BrowserURLHandlerImpl>::get(); |
89 } | 89 } |
90 | 90 |
91 BrowserURLHandlerImpl::BrowserURLHandlerImpl() : | 91 BrowserURLHandlerImpl::BrowserURLHandlerImpl() : |
92 fixup_handler_(null_handler()) { | 92 fixup_handler_(nullptr) { |
93 AddHandlerPair(&DebugURLHandler, BrowserURLHandlerImpl::null_handler()); | 93 AddHandlerPair(&DebugURLHandler, BrowserURLHandlerImpl::null_handler()); |
94 | 94 |
95 GetContentClient()->browser()->BrowserURLHandlerCreated(this); | 95 GetContentClient()->browser()->BrowserURLHandlerCreated(this); |
96 | 96 |
97 // view-source: | 97 // view-source: |
98 AddHandlerPair(&HandleViewSource, &ReverseViewSource); | 98 AddHandlerPair(&HandleViewSource, &ReverseViewSource); |
99 } | 99 } |
100 | 100 |
101 BrowserURLHandlerImpl::~BrowserURLHandlerImpl() { | 101 BrowserURLHandlerImpl::~BrowserURLHandlerImpl() { |
102 } | 102 } |
103 | 103 |
104 void BrowserURLHandlerImpl::SetFixupHandler(URLHandler handler) { | 104 void BrowserURLHandlerImpl::SetFixupHandler(URLHandler handler) { |
105 DCHECK_EQ(null_handler(), fixup_handler_); | 105 DCHECK(fixup_handler_ == nullptr); |
Charlie Reis
2015/04/24 21:22:52
DCHECK_EQ wasn't happy doing the comparison betwee
| |
106 fixup_handler_ = handler; | 106 fixup_handler_ = handler; |
107 } | 107 } |
108 | 108 |
109 void BrowserURLHandlerImpl::AddHandlerPair(URLHandler handler, | 109 void BrowserURLHandlerImpl::AddHandlerPair(URLHandler handler, |
110 URLHandler reverse_handler) { | 110 URLHandler reverse_handler) { |
111 url_handlers_.push_back(HandlerPair(handler, reverse_handler)); | 111 url_handlers_.push_back(HandlerPair(handler, reverse_handler)); |
112 } | 112 } |
113 | 113 |
114 void BrowserURLHandlerImpl::RewriteURLIfNecessary( | 114 void BrowserURLHandlerImpl::RewriteURLIfNecessary( |
115 GURL* url, | 115 GURL* url, |
(...skipping 27 matching lines...) Expand all Loading... | |
143 return true; | 143 return true; |
144 } else if (handler(&test_url, browser_context)) { | 144 } else if (handler(&test_url, browser_context)) { |
145 return reverse_rewriter(url, browser_context); | 145 return reverse_rewriter(url, browser_context); |
146 } | 146 } |
147 } | 147 } |
148 } | 148 } |
149 return false; | 149 return false; |
150 } | 150 } |
151 | 151 |
152 } // namespace content | 152 } // namespace content |
OLD | NEW |