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

Side by Side Diff: Source/modules/navigatorcontentutils/NavigatorContentUtils.cpp

Issue 22859043: Add a CustomSchemeHandler runtime flag to remove ENABLE(CUSTOM_SCHEME_HANDLER) (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 4 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011, Google Inc. All rights reserved. 2 * Copyright (C) 2011, Google Inc. All rights reserved.
3 * Copyright (C) 2012, Samsung Electronics. All rights reserved. 3 * Copyright (C) 2012, Samsung Electronics. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 146
147 if (!verifyCustomHandlerURL(baseURL, url, es)) 147 if (!verifyCustomHandlerURL(baseURL, url, es))
148 return; 148 return;
149 149
150 if (!verifyProtocolHandlerScheme(scheme, es)) 150 if (!verifyProtocolHandlerScheme(scheme, es))
151 return; 151 return;
152 152
153 NavigatorContentUtils::from(navigator->frame()->page())->client()->registerP rotocolHandler(scheme, baseURL, url, navigator->frame()->displayStringModifiedBy Encoding(title)); 153 NavigatorContentUtils::from(navigator->frame()->page())->client()->registerP rotocolHandler(scheme, baseURL, url, navigator->frame()->displayStringModifiedBy Encoding(title));
154 } 154 }
155 155
156 #if ENABLE(CUSTOM_SCHEME_HANDLER)
157 static String customHandlersStateString(const NavigatorContentUtilsClient::Custo mHandlersState state) 156 static String customHandlersStateString(const NavigatorContentUtilsClient::Custo mHandlersState state)
158 { 157 {
159 DEFINE_STATIC_LOCAL(const String, newHandler, ("new")); 158 DEFINE_STATIC_LOCAL(const String, newHandler, ("new"));
160 DEFINE_STATIC_LOCAL(const String, registeredHandler, ("registered")); 159 DEFINE_STATIC_LOCAL(const String, registeredHandler, ("registered"));
161 DEFINE_STATIC_LOCAL(const String, declinedHandler, ("declined")); 160 DEFINE_STATIC_LOCAL(const String, declinedHandler, ("declined"));
162 161
163 switch (state) { 162 switch (state) {
164 case NavigatorContentUtilsClient::CustomHandlersNew: 163 case NavigatorContentUtilsClient::CustomHandlersNew:
165 return newHandler; 164 return newHandler;
166 case NavigatorContentUtilsClient::CustomHandlersRegistered: 165 case NavigatorContentUtilsClient::CustomHandlersRegistered:
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 String baseURL = document->baseURL().baseAsString(); 200 String baseURL = document->baseURL().baseAsString();
202 201
203 if (!verifyCustomHandlerURL(baseURL, url, es)) 202 if (!verifyCustomHandlerURL(baseURL, url, es))
204 return; 203 return;
205 204
206 if (!verifyProtocolHandlerScheme(scheme, es)) 205 if (!verifyProtocolHandlerScheme(scheme, es))
207 return; 206 return;
208 207
209 NavigatorContentUtils::from(navigator->frame()->page())->client()->unregiste rProtocolHandler(scheme, baseURL, url); 208 NavigatorContentUtils::from(navigator->frame()->page())->client()->unregiste rProtocolHandler(scheme, baseURL, url);
210 } 209 }
211 #endif
212 210
213 const char* NavigatorContentUtils::supplementName() 211 const char* NavigatorContentUtils::supplementName()
214 { 212 {
215 return "NavigatorContentUtils"; 213 return "NavigatorContentUtils";
216 } 214 }
217 215
218 void provideNavigatorContentUtilsTo(Page* page, NavigatorContentUtilsClient* cli ent) 216 void provideNavigatorContentUtilsTo(Page* page, NavigatorContentUtilsClient* cli ent)
219 { 217 {
220 RefCountedSupplement<Page, NavigatorContentUtils>::provideTo(page, Navigator ContentUtils::supplementName(), NavigatorContentUtils::create(client)); 218 RefCountedSupplement<Page, NavigatorContentUtils>::provideTo(page, Navigator ContentUtils::supplementName(), NavigatorContentUtils::create(client));
221 } 219 }
222 220
223 } // namespace WebCore 221 } // namespace WebCore
224 222
225 #endif // ENABLE(NAVIGATOR_CONTENT_UTILS) 223 #endif // ENABLE(NAVIGATOR_CONTENT_UTILS)
226 224
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698