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

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

Issue 133273030: Change a WebString type of url parameter with WebURL (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 11 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 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 136
137 void NavigatorContentUtils::registerProtocolHandler(Navigator* navigator, const String& scheme, const String& url, const String& title, ExceptionState& exceptio nState) 137 void NavigatorContentUtils::registerProtocolHandler(Navigator* navigator, const String& scheme, const String& url, const String& title, ExceptionState& exceptio nState)
138 { 138 {
139 if (!navigator->frame()) 139 if (!navigator->frame())
140 return; 140 return;
141 141
142 Document* document = navigator->frame()->document(); 142 Document* document = navigator->frame()->document();
143 if (!document) 143 if (!document)
144 return; 144 return;
145 145
146 String baseURL = document->baseURL().baseAsString(); 146 KURL baseURL = document->baseURL();
147 147
148 if (!verifyCustomHandlerURL(baseURL, url, exceptionState)) 148 if (!verifyCustomHandlerURL(baseURL.string(), url, exceptionState))
jochen (gone - plz use gerrit) 2014/01/20 09:21:38 should verifyCustomHandlerURL take a URL as first
gyuyoung-inactive 2014/01/21 02:17:14 Ok, I modify it to use KURL. BTW, don't you think
149 return; 149 return;
150 150
151 if (!verifyProtocolHandlerScheme(scheme, "registerProtocolHandler", exceptio nState)) 151 if (!verifyProtocolHandlerScheme(scheme, "registerProtocolHandler", exceptio nState))
152 return; 152 return;
153 153
154 NavigatorContentUtils::from(navigator->frame()->page())->client()->registerP rotocolHandler(scheme, baseURL, url, title); 154 NavigatorContentUtils::from(navigator->frame()->page())->client()->registerP rotocolHandler(scheme, baseURL, KURL(ParsedURLString, url), title);
155 } 155 }
156 156
157 static String customHandlersStateString(const NavigatorContentUtilsClient::Custo mHandlersState state) 157 static String customHandlersStateString(const NavigatorContentUtilsClient::Custo mHandlersState state)
158 { 158 {
159 DEFINE_STATIC_LOCAL(const String, newHandler, ("new")); 159 DEFINE_STATIC_LOCAL(const String, newHandler, ("new"));
160 DEFINE_STATIC_LOCAL(const String, registeredHandler, ("registered")); 160 DEFINE_STATIC_LOCAL(const String, registeredHandler, ("registered"));
161 DEFINE_STATIC_LOCAL(const String, declinedHandler, ("declined")); 161 DEFINE_STATIC_LOCAL(const String, declinedHandler, ("declined"));
162 162
163 switch (state) { 163 switch (state) {
164 case NavigatorContentUtilsClient::CustomHandlersNew: 164 case NavigatorContentUtilsClient::CustomHandlersNew:
165 return newHandler; 165 return newHandler;
166 case NavigatorContentUtilsClient::CustomHandlersRegistered: 166 case NavigatorContentUtilsClient::CustomHandlersRegistered:
167 return registeredHandler; 167 return registeredHandler;
168 case NavigatorContentUtilsClient::CustomHandlersDeclined: 168 case NavigatorContentUtilsClient::CustomHandlersDeclined:
169 return declinedHandler; 169 return declinedHandler;
170 } 170 }
171 171
172 ASSERT_NOT_REACHED(); 172 ASSERT_NOT_REACHED();
173 return String(); 173 return String();
174 } 174 }
175 175
176 String NavigatorContentUtils::isProtocolHandlerRegistered(Navigator* navigator, const String& scheme, const String& url, ExceptionState& exceptionState) 176 String NavigatorContentUtils::isProtocolHandlerRegistered(Navigator* navigator, const String& scheme, const String& url, ExceptionState& exceptionState)
177 { 177 {
178 DEFINE_STATIC_LOCAL(const String, declined, ("declined")); 178 DEFINE_STATIC_LOCAL(const String, declined, ("declined"));
179 179
180 if (!navigator->frame()) 180 if (!navigator->frame())
181 return declined; 181 return declined;
182 182
183 Document* document = navigator->frame()->document(); 183 Document* document = navigator->frame()->document();
184 String baseURL = document->baseURL().baseAsString(); 184 KURL baseURL = document->baseURL();
185 185
186 if (!verifyCustomHandlerURL(baseURL, url, exceptionState)) 186 if (!verifyCustomHandlerURL(baseURL.string(), url, exceptionState))
187 return declined; 187 return declined;
188 188
189 if (!verifyProtocolHandlerScheme(scheme, "isProtocolHandlerRegistered", exce ptionState)) 189 if (!verifyProtocolHandlerScheme(scheme, "isProtocolHandlerRegistered", exce ptionState))
190 return declined; 190 return declined;
191 191
192 return customHandlersStateString(NavigatorContentUtils::from(navigator->fram e()->page())->client()->isProtocolHandlerRegistered(scheme, baseURL, url)); 192 return customHandlersStateString(NavigatorContentUtils::from(navigator->fram e()->page())->client()->isProtocolHandlerRegistered(scheme, baseURL, KURL(Parsed URLString, url)));
193 } 193 }
194 194
195 void NavigatorContentUtils::unregisterProtocolHandler(Navigator* navigator, cons t String& scheme, const String& url, ExceptionState& exceptionState) 195 void NavigatorContentUtils::unregisterProtocolHandler(Navigator* navigator, cons t String& scheme, const String& url, ExceptionState& exceptionState)
196 { 196 {
197 if (!navigator->frame()) 197 if (!navigator->frame())
198 return; 198 return;
199 199
200 Document* document = navigator->frame()->document(); 200 Document* document = navigator->frame()->document();
201 String baseURL = document->baseURL().baseAsString(); 201 KURL baseURL = document->baseURL();
202 202
203 if (!verifyCustomHandlerURL(baseURL, url, exceptionState)) 203 if (!verifyCustomHandlerURL(baseURL.string(), url, exceptionState))
204 return; 204 return;
205 205
206 if (!verifyProtocolHandlerScheme(scheme, "unregisterProtocolHandler", except ionState)) 206 if (!verifyProtocolHandlerScheme(scheme, "unregisterProtocolHandler", except ionState))
207 return; 207 return;
208 208
209 NavigatorContentUtils::from(navigator->frame()->page())->client()->unregiste rProtocolHandler(scheme, baseURL, url); 209 NavigatorContentUtils::from(navigator->frame()->page())->client()->unregiste rProtocolHandler(scheme, baseURL, KURL(ParsedURLString, url));
210 } 210 }
211 211
212 const char* NavigatorContentUtils::supplementName() 212 const char* NavigatorContentUtils::supplementName()
213 { 213 {
214 return "NavigatorContentUtils"; 214 return "NavigatorContentUtils";
215 } 215 }
216 216
217 void provideNavigatorContentUtilsTo(Page* page, NavigatorContentUtilsClient* cli ent) 217 void provideNavigatorContentUtilsTo(Page* page, NavigatorContentUtilsClient* cli ent)
218 { 218 {
219 RefCountedSupplement<Page, NavigatorContentUtils>::provideTo(page, Navigator ContentUtils::supplementName(), NavigatorContentUtils::create(client)); 219 RefCountedSupplement<Page, NavigatorContentUtils>::provideTo(page, Navigator ContentUtils::supplementName(), NavigatorContentUtils::create(client));
220 } 220 }
221 221
222 } // namespace WebCore 222 } // namespace WebCore
OLDNEW
« no previous file with comments | « no previous file | Source/modules/navigatorcontentutils/NavigatorContentUtilsClient.h » ('j') | public/web/WebViewClient.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698