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

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

Issue 879423003: Move Location to DOMWindow (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 10 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011, Google Inc. All rights reserved. 2 * Copyright (C) 2011, Google Inc. All rights reserved.
3 * Copyright (C) 2014, Samsung Electronics. All rights reserved. 3 * Copyright (C) 2014, 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 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 { 147 {
148 } 148 }
149 149
150 PassOwnPtrWillBeRawPtr<NavigatorContentUtils> NavigatorContentUtils::create(Pass OwnPtr<NavigatorContentUtilsClient> client) 150 PassOwnPtrWillBeRawPtr<NavigatorContentUtils> NavigatorContentUtils::create(Pass OwnPtr<NavigatorContentUtilsClient> client)
151 { 151 {
152 return adoptPtrWillBeNoop(new NavigatorContentUtils(client)); 152 return adoptPtrWillBeNoop(new NavigatorContentUtils(client));
153 } 153 }
154 154
155 void NavigatorContentUtils::registerProtocolHandler(Navigator& navigator, const String& scheme, const String& url, const String& title, ExceptionState& exceptio nState) 155 void NavigatorContentUtils::registerProtocolHandler(Navigator& navigator, const String& scheme, const String& url, const String& title, ExceptionState& exceptio nState)
156 { 156 {
157 if (!navigator.frame()) 157 if (!navigator.localFrame())
158 return; 158 return;
159 159
160 Document* document = navigator.frame()->document(); 160 Document* document = navigator.localFrame()->document();
161 ASSERT(document); 161 ASSERT(document);
162 162
163 if (!verifyCustomHandlerURL(*document, url, exceptionState)) 163 if (!verifyCustomHandlerURL(*document, url, exceptionState))
164 return; 164 return;
165 165
166 if (!verifyCustomHandlerScheme(scheme, exceptionState)) 166 if (!verifyCustomHandlerScheme(scheme, exceptionState))
167 return; 167 return;
168 168
169 ASSERT(navigator.frame()->page()); 169 ASSERT(navigator.frame()->page());
170 NavigatorContentUtils::from(*navigator.frame()->page())->client()->registerP rotocolHandler(scheme, document->completeURL(url), title); 170 NavigatorContentUtils::from(*navigator.frame()->page())->client()->registerP rotocolHandler(scheme, document->completeURL(url), title);
(...skipping 15 matching lines...) Expand all
186 } 186 }
187 187
188 ASSERT_NOT_REACHED(); 188 ASSERT_NOT_REACHED();
189 return String(); 189 return String();
190 } 190 }
191 191
192 String NavigatorContentUtils::isProtocolHandlerRegistered(Navigator& navigator, const String& scheme, const String& url, ExceptionState& exceptionState) 192 String NavigatorContentUtils::isProtocolHandlerRegistered(Navigator& navigator, const String& scheme, const String& url, ExceptionState& exceptionState)
193 { 193 {
194 DEFINE_STATIC_LOCAL(const String, declined, ("declined")); 194 DEFINE_STATIC_LOCAL(const String, declined, ("declined"));
195 195
196 if (!navigator.frame()) 196 if (!navigator.localFrame())
197 return declined; 197 return declined;
198 198
199 Document* document = navigator.frame()->document(); 199 Document* document = navigator.localFrame()->document();
200 ASSERT(document); 200 ASSERT(document);
201 if (document->activeDOMObjectsAreStopped()) 201 if (document->activeDOMObjectsAreStopped())
202 return declined; 202 return declined;
203 203
204 if (!verifyCustomHandlerURL(*document, url, exceptionState)) 204 if (!verifyCustomHandlerURL(*document, url, exceptionState))
205 return declined; 205 return declined;
206 206
207 if (!verifyCustomHandlerScheme(scheme, exceptionState)) 207 if (!verifyCustomHandlerScheme(scheme, exceptionState))
208 return declined; 208 return declined;
209 209
210 ASSERT(navigator.frame()->page()); 210 ASSERT(navigator.frame()->page());
211 return customHandlersStateString(NavigatorContentUtils::from(*navigator.fram e()->page())->client()->isProtocolHandlerRegistered(scheme, document->completeUR L(url))); 211 return customHandlersStateString(NavigatorContentUtils::from(*navigator.fram e()->page())->client()->isProtocolHandlerRegistered(scheme, document->completeUR L(url)));
212 } 212 }
213 213
214 void NavigatorContentUtils::unregisterProtocolHandler(Navigator& navigator, cons t String& scheme, const String& url, ExceptionState& exceptionState) 214 void NavigatorContentUtils::unregisterProtocolHandler(Navigator& navigator, cons t String& scheme, const String& url, ExceptionState& exceptionState)
215 { 215 {
216 if (!navigator.frame()) 216 if (!navigator.localFrame())
217 return; 217 return;
218 218
219 Document* document = navigator.frame()->document(); 219 Document* document = navigator.localFrame()->document();
220 ASSERT(document); 220 ASSERT(document);
221 221
222 if (!verifyCustomHandlerURL(*document, url, exceptionState)) 222 if (!verifyCustomHandlerURL(*document, url, exceptionState))
223 return; 223 return;
224 224
225 if (!verifyCustomHandlerScheme(scheme, exceptionState)) 225 if (!verifyCustomHandlerScheme(scheme, exceptionState))
226 return; 226 return;
227 227
228 ASSERT(navigator.frame()->page()); 228 ASSERT(navigator.frame()->page());
229 NavigatorContentUtils::from(*navigator.frame()->page())->client()->unregiste rProtocolHandler(scheme, document->completeURL(url)); 229 NavigatorContentUtils::from(*navigator.frame()->page())->client()->unregiste rProtocolHandler(scheme, document->completeURL(url));
230 } 230 }
231 231
232 const char* NavigatorContentUtils::supplementName() 232 const char* NavigatorContentUtils::supplementName()
233 { 233 {
234 return "NavigatorContentUtils"; 234 return "NavigatorContentUtils";
235 } 235 }
236 236
237 void provideNavigatorContentUtilsTo(Page& page, PassOwnPtr<NavigatorContentUtils Client> client) 237 void provideNavigatorContentUtilsTo(Page& page, PassOwnPtr<NavigatorContentUtils Client> client)
238 { 238 {
239 NavigatorContentUtils::provideTo(page, NavigatorContentUtils::supplementName (), NavigatorContentUtils::create(client)); 239 NavigatorContentUtils::provideTo(page, NavigatorContentUtils::supplementName (), NavigatorContentUtils::create(client));
240 } 240 }
241 241
242 } // namespace blink 242 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698