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

Side by Side Diff: Source/bindings/v8/custom/V8GeolocationCustom.cpp

Issue 297143003: Set default values for timeout and maximumAge of PositionOptions (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 7 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
« no previous file with comments | « no previous file | Source/modules/geolocation/Geolocation.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2009, The Android Open Source Project 2 * Copyright 2009, The Android Open Source Project
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * * Redistributions of source code must retain the above copyright 7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright 9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 succeeded = false; 98 succeeded = false;
99 return nullptr; 99 return nullptr;
100 } 100 }
101 if (!maximumAgeValue->IsUndefined()) { 101 if (!maximumAgeValue->IsUndefined()) {
102 v8::Local<v8::Number> maximumAgeNumber = maximumAgeValue->ToNumber(); 102 v8::Local<v8::Number> maximumAgeNumber = maximumAgeValue->ToNumber();
103 if (maximumAgeNumber.IsEmpty()) { 103 if (maximumAgeNumber.IsEmpty()) {
104 succeeded = false; 104 succeeded = false;
105 return nullptr; 105 return nullptr;
106 } 106 }
107 double maximumAgeDouble = maximumAgeNumber->Value(); 107 double maximumAgeDouble = maximumAgeNumber->Value();
108 if (std::isinf(maximumAgeDouble) && maximumAgeDouble > 0) { 108 if ((std::isinf(maximumAgeDouble) && maximumAgeDouble > 0) || maximumAge Double <= 0) {
109 // If the value is positive infinity, clear maximumAge. 109 // If the value is positive infinity or negative
Nils Barth (inactive) 2014/05/26 01:20:43 ??? If the value of maximumAge is set to positive
kihong 2014/05/26 04:23:43 You are right. I will change this with next patch.
110 options->clearMaximumAge(); 110 options->setMaximumAge(0);
111 } else { 111 } else {
112 if (maximumAgeDouble <= 0) { 112 options->setMaximumAge(toUInt32(maximumAgeValue, Clamp, exceptionSta te));
113 options->setMaximumAge(0);
114 } else {
115 options->setMaximumAge(toUInt32(maximumAgeValue, Clamp, exceptio nState));
116 }
117 } 113 }
118 } 114 }
119 115
120 return options.release(); 116 return options.release();
121 } 117 }
122 118
123 void V8Geolocation::getCurrentPositionMethodCustom(const v8::FunctionCallbackInf o<v8::Value>& info) 119 void V8Geolocation::getCurrentPositionMethodCustom(const v8::FunctionCallbackInf o<v8::Value>& info)
124 { 120 {
125 bool succeeded = false; 121 bool succeeded = false;
126 122
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 if (!succeeded) 161 if (!succeeded)
166 return; 162 return;
167 ASSERT(positionOptions); 163 ASSERT(positionOptions);
168 164
169 Geolocation* geolocation = V8Geolocation::toNative(info.Holder()); 165 Geolocation* geolocation = V8Geolocation::toNative(info.Holder());
170 int watchId = geolocation->watchPosition(positionCallback.release(), positio nErrorCallback.release(), positionOptions.release()); 166 int watchId = geolocation->watchPosition(positionCallback.release(), positio nErrorCallback.release(), positionOptions.release());
171 v8SetReturnValue(info, watchId); 167 v8SetReturnValue(info, watchId);
172 } 168 }
173 169
174 } // namespace WebCore 170 } // namespace WebCore
OLDNEW
« no previous file with comments | « no previous file | Source/modules/geolocation/Geolocation.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698