diff options
author | arv@chromium.org <arv@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-01 01:02:07 +0000 |
---|---|---|
committer | arv@chromium.org <arv@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-01 01:02:07 +0000 |
commit | fb534c949f92bec8c6312b58ffcc04c5dc488f2d (patch) | |
tree | 84384bdb8b06e62662ce1a5e9619ae455e9a69a8 /chrome | |
parent | efeb669b05db99c54309771e4884b1a17d604a37 (diff) | |
download | chromium_src-fb534c949f92bec8c6312b58ffcc04c5dc488f2d.zip chromium_src-fb534c949f92bec8c6312b58ffcc04c5dc488f2d.tar.gz chromium_src-fb534c949f92bec8c6312b58ffcc04c5dc488f2d.tar.bz2 |
Rename Real* to Double* in values.* and dependent files
BUG=None
TEST=Compiles and passes all tests
Review URL: http://codereview.chromium.org/6248026
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@73232 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
54 files changed, 224 insertions, 220 deletions
diff --git a/chrome/browser/autofill/autofill_download.cc b/chrome/browser/autofill/autofill_download.cc index 0c35a74..f2011ef 100644 --- a/chrome/browser/autofill/autofill_download.cc +++ b/chrome/browser/autofill/autofill_download.cc @@ -54,9 +54,9 @@ AutoFillDownloadManager::AutoFillDownloadManager(Profile* profile) if (profile_) { PrefService* preferences = profile_->GetPrefs(); positive_upload_rate_ = - preferences->GetReal(prefs::kAutoFillPositiveUploadRate); + preferences->GetDouble(prefs::kAutoFillPositiveUploadRate); negative_upload_rate_ = - preferences->GetReal(prefs::kAutoFillNegativeUploadRate); + preferences->GetDouble(prefs::kAutoFillNegativeUploadRate); } } @@ -165,7 +165,7 @@ void AutoFillDownloadManager::SetPositiveUploadRate(double rate) { DCHECK_LE(rate, 1.0); DCHECK(profile_); PrefService* preferences = profile_->GetPrefs(); - preferences->SetReal(prefs::kAutoFillPositiveUploadRate, rate); + preferences->SetDouble(prefs::kAutoFillPositiveUploadRate, rate); } void AutoFillDownloadManager::SetNegativeUploadRate(double rate) { @@ -176,7 +176,7 @@ void AutoFillDownloadManager::SetNegativeUploadRate(double rate) { DCHECK_LE(rate, 1.0); DCHECK(profile_); PrefService* preferences = profile_->GetPrefs(); - preferences->SetReal(prefs::kAutoFillNegativeUploadRate, rate); + preferences->SetDouble(prefs::kAutoFillNegativeUploadRate, rate); } bool AutoFillDownloadManager::StartRequest( diff --git a/chrome/browser/autofill/autofill_manager.cc b/chrome/browser/autofill/autofill_manager.cc index ed73429..84af836 100644 --- a/chrome/browser/autofill/autofill_manager.cc +++ b/chrome/browser/autofill/autofill_manager.cc @@ -165,10 +165,10 @@ void AutoFillManager::RegisterUserPrefs(PrefService* prefs) { #else prefs->RegisterBooleanPref(prefs::kAutoFillAuxiliaryProfilesEnabled, false); #endif - prefs->RegisterRealPref(prefs::kAutoFillPositiveUploadRate, - kAutoFillPositiveUploadRateDefaultValue); - prefs->RegisterRealPref(prefs::kAutoFillNegativeUploadRate, - kAutoFillNegativeUploadRateDefaultValue); + prefs->RegisterDoublePref(prefs::kAutoFillPositiveUploadRate, + kAutoFillPositiveUploadRateDefaultValue); + prefs->RegisterDoublePref(prefs::kAutoFillNegativeUploadRate, + kAutoFillNegativeUploadRateDefaultValue); } void AutoFillManager::DidNavigateMainFramePostCommit( diff --git a/chrome/browser/automation/automation_provider_observers.cc b/chrome/browser/automation/automation_provider_observers.cc index cba209c..f496a7a 100644 --- a/chrome/browser/automation/automation_provider_observers.cc +++ b/chrome/browser/automation/automation_provider_observers.cc @@ -130,12 +130,12 @@ DictionaryValue* InitialLoadObserver::GetTimingInformation() const { DictionaryValue* item = new DictionaryValue; base::TimeDelta delta_start = it->second.start_time() - init_time_; - item->SetReal("load_start_ms", delta_start.InMillisecondsF()); + item->SetDouble("load_start_ms", delta_start.InMillisecondsF()); if (it->second.stop_time().is_null()) { item->Set("load_stop_ms", Value::CreateNullValue()); } else { base::TimeDelta delta_stop = it->second.stop_time() - init_time_; - item->SetReal("load_stop_ms", delta_stop.InMillisecondsF()); + item->SetDouble("load_stop_ms", delta_stop.InMillisecondsF()); } items->Append(item); } @@ -1250,8 +1250,8 @@ void AutomationProviderHistoryObserver::HistoryQueryComplete( history::URLResult const &page = (*results)[i]; page_value->SetString("title", page.title()); page_value->SetString("url", page.url().spec()); - page_value->SetReal("time", - static_cast<double>(page.visit_time().ToDoubleT())); + page_value->SetDouble("time", + static_cast<double>(page.visit_time().ToDoubleT())); page_value->SetString("snippet", page.snippet().text()); page_value->SetBoolean( "starred", @@ -1284,7 +1284,7 @@ void AutomationProviderGetPasswordsObserver::OnPasswordStoreRequestDone( password_val->SetString("username_value", password_form->username_value); password_val->SetString("password_value", password_form->password_value); password_val->SetString("signon_realm", password_form->signon_realm); - password_val->SetReal( + password_val->SetDouble( "time", static_cast<double>(password_form->date_created.ToDoubleT())); password_val->SetString("origin_url", password_form->origin.spec()); password_val->SetString("username_element", diff --git a/chrome/browser/automation/testing_automation_provider.cc b/chrome/browser/automation/testing_automation_provider.cc index 9c2e9a1..04709ff 100644 --- a/chrome/browser/automation/testing_automation_provider.cc +++ b/chrome/browser/automation/testing_automation_provider.cc @@ -2502,7 +2502,7 @@ void TestingAutomationProvider::AddHistoryItem(Browser* browser, double dt; if (item->GetInteger("time", &it)) time = base::Time::FromTimeT(it); - else if (item->GetReal("time", &dt)) + else if (item->GetDouble("time", &dt)) time = base::Time::FromDoubleT(dt); // Ideas for "dummy" values (e.g. id_scope) came from @@ -3157,7 +3157,7 @@ webkit_glue::PasswordForm GetPasswordFormFromDict( double dt; if (password_dict.GetInteger("time", &it)) time = base::Time::FromTimeT(it); - else if (password_dict.GetReal("time", &dt)) + else if (password_dict.GetDouble("time", &dt)) time = base::Time::FromDoubleT(dt); std::string signon_realm; diff --git a/chrome/browser/chromeos/audio_mixer_alsa.cc b/chrome/browser/chromeos/audio_mixer_alsa.cc index be2959b..5704cac 100644 --- a/chrome/browser/chromeos/audio_mixer_alsa.cc +++ b/chrome/browser/chromeos/audio_mixer_alsa.cc @@ -168,7 +168,7 @@ AudioMixer::State AudioMixerAlsa::GetState() const { // static void AudioMixerAlsa::RegisterPrefs(PrefService* local_state) { if (!local_state->FindPreference(prefs::kAudioVolume)) - local_state->RegisterRealPref(prefs::kAudioVolume, kPrefVolumeInvalid); + local_state->RegisterDoublePref(prefs::kAudioVolume, kPrefVolumeInvalid); if (!local_state->FindPreference(prefs::kAudioMute)) local_state->RegisterIntegerPref(prefs::kAudioMute, kPrefMuteInvalid); } diff --git a/chrome/browser/chromeos/audio_mixer_alsa.h b/chrome/browser/chromeos/audio_mixer_alsa.h index 56010de..3cbe7ac 100644 --- a/chrome/browser/chromeos/audio_mixer_alsa.h +++ b/chrome/browser/chromeos/audio_mixer_alsa.h @@ -97,7 +97,7 @@ class AudioMixerAlsa : public AudioMixer { _snd_mixer_elem* elem_pcm_; IntegerPrefMember mute_pref_; - RealPrefMember volume_pref_; + DoublePrefMember volume_pref_; scoped_ptr<base::Thread> thread_; diff --git a/chrome/browser/chromeos/cros_settings.cc b/chrome/browser/chromeos/cros_settings.cc index 59cdb4d..419479b 100644 --- a/chrome/browser/chromeos/cros_settings.cc +++ b/chrome/browser/chromeos/cros_settings.cc @@ -63,9 +63,9 @@ void CrosSettings::SetInteger(const std::string& path, int in_value) { Set(path, Value::CreateIntegerValue(in_value)); } -void CrosSettings::SetReal(const std::string& path, double in_value) { +void CrosSettings::SetDouble(const std::string& path, double in_value) { DCHECK(CalledOnValidThread()); - Set(path, Value::CreateRealValue(in_value)); + Set(path, Value::CreateDoubleValue(in_value)); } void CrosSettings::SetString(const std::string& path, @@ -181,14 +181,14 @@ bool CrosSettings::GetInteger(const std::string& path, return value->GetAsInteger(out_value); } -bool CrosSettings::GetReal(const std::string& path, - double* out_value) const { +bool CrosSettings::GetDouble(const std::string& path, + double* out_value) const { DCHECK(CalledOnValidThread()); Value* value; if (!Get(path, &value)) return false; - return value->GetAsReal(out_value); + return value->GetAsDouble(out_value); } bool CrosSettings::GetString(const std::string& path, diff --git a/chrome/browser/chromeos/cros_settings.h b/chrome/browser/chromeos/cros_settings.h index c8446c5..fe7a7e7 100644 --- a/chrome/browser/chromeos/cros_settings.h +++ b/chrome/browser/chromeos/cros_settings.h @@ -50,7 +50,7 @@ class CrosSettings : public base::NonThreadSafe { // value at that path, even if it has a different type. void SetBoolean(const std::string& path, bool in_value); void SetInteger(const std::string& path, int in_value); - void SetReal(const std::string& path, double in_value); + void SetDouble(const std::string& path, double in_value); void SetString(const std::string& path, const std::string& in_value); // These are convenience forms of Get(). The value will be retrieved @@ -58,7 +58,7 @@ class CrosSettings : public base::NonThreadSafe { // the end of the path can be returned in the form specified. bool GetBoolean(const std::string& path, bool* out_value) const; bool GetInteger(const std::string& path, int* out_value) const; - bool GetReal(const std::string& path, double* out_value) const; + bool GetDouble(const std::string& path, double* out_value) const; bool GetString(const std::string& path, std::string* out_value) const; // adding/removing of providers diff --git a/chrome/browser/dom_ui/foreign_session_handler.cc b/chrome/browser/dom_ui/foreign_session_handler.cc index c31772d..eaf378a 100644 --- a/chrome/browser/dom_ui/foreign_session_handler.cc +++ b/chrome/browser/dom_ui/foreign_session_handler.cc @@ -210,8 +210,8 @@ bool ForeignSessionHandler::SessionTabToValue( NewTabUI::SetURLTitleAndDirection(dictionary, current_navigation.title(), current_navigation.virtual_url()); dictionary->SetString("type", "tab"); - dictionary->SetReal("timestamp", - static_cast<double>(tab.timestamp.ToInternalValue())); + dictionary->SetDouble("timestamp", + static_cast<double>(tab.timestamp.ToInternalValue())); dictionary->SetInteger("sessionId", tab.tab_id.id()); return true; } @@ -232,8 +232,8 @@ bool ForeignSessionHandler::SessionWindowToValue( if (tab_values->GetSize() == 0) return false; dictionary->SetString("type", "window"); - dictionary->SetReal("timestamp", - static_cast<double>(window.timestamp.ToInternalValue())); + dictionary->SetDouble("timestamp", + static_cast<double>(window.timestamp.ToInternalValue())); dictionary->SetInteger("sessionId", window.window_id.id()); dictionary->Set("tabs", tab_values.release()); return true; diff --git a/chrome/browser/dom_ui/ntp_resource_cache.cc b/chrome/browser/dom_ui/ntp_resource_cache.cc index b57fb98..61c92fb 100644 --- a/chrome/browser/dom_ui/ntp_resource_cache.cc +++ b/chrome/browser/dom_ui/ntp_resource_cache.cc @@ -368,8 +368,8 @@ void NTPResourceCache::CreateNewTabHTML() { if (profile_->GetPrefs()->FindPreference(prefs::kNTPCustomLogoStart) && profile_->GetPrefs()->FindPreference(prefs::kNTPCustomLogoEnd)) { localized_strings.SetString("customlogo", - InDateRange(profile_->GetPrefs()->GetReal(prefs::kNTPCustomLogoStart), - profile_->GetPrefs()->GetReal(prefs::kNTPCustomLogoEnd)) ? + InDateRange(profile_->GetPrefs()->GetDouble(prefs::kNTPCustomLogoStart), + profile_->GetPrefs()->GetDouble(prefs::kNTPCustomLogoEnd)) ? "true" : "false"); } else { localized_strings.SetString("customlogo", "false"); @@ -382,8 +382,8 @@ void NTPResourceCache::CreateNewTabHTML() { profile_->GetPrefs()->FindPreference(prefs::kNTPPromoLine) && WebResourceServiceUtil::CanShowPromo(profile_)) { localized_strings.SetString("serverpromo", - InDateRange(profile_->GetPrefs()->GetReal(prefs::kNTPPromoStart), - profile_->GetPrefs()->GetReal(prefs::kNTPPromoEnd)) ? + InDateRange(profile_->GetPrefs()->GetDouble(prefs::kNTPPromoStart), + profile_->GetPrefs()->GetDouble(prefs::kNTPPromoEnd)) ? profile_->GetPrefs()->GetString(prefs::kNTPPromoLine) : std::string()); } diff --git a/chrome/browser/dom_ui/options/core_options_handler.cc b/chrome/browser/dom_ui/options/core_options_handler.cc index 15a61a5..983572a 100644 --- a/chrome/browser/dom_ui/options/core_options_handler.cc +++ b/chrome/browser/dom_ui/options/core_options_handler.cc @@ -132,8 +132,8 @@ void CoreOptionsHandler::RegisterMessages() { NewCallback(this, &CoreOptionsHandler::HandleSetBooleanPref)); dom_ui_->RegisterMessageCallback("setIntegerPref", NewCallback(this, &CoreOptionsHandler::HandleSetIntegerPref)); - dom_ui_->RegisterMessageCallback("setRealPref", - NewCallback(this, &CoreOptionsHandler::HandleSetRealPref)); + dom_ui_->RegisterMessageCallback("setDoublePref", + NewCallback(this, &CoreOptionsHandler::HandleSetDoublePref)); dom_ui_->RegisterMessageCallback("setStringPref", NewCallback(this, &CoreOptionsHandler::HandleSetStringPref)); dom_ui_->RegisterMessageCallback("setObjectPref", @@ -188,10 +188,10 @@ void CoreOptionsHandler::SetPref(const std::string& pref_name, break; - case Value::TYPE_REAL: + case Value::TYPE_DOUBLE: double double_value; CHECK(base::StringToDouble(value_string, &double_value)); - pref_service->SetReal(pref_name.c_str(), double_value); + pref_service->SetDouble(pref_name.c_str(), double_value); break; @@ -309,8 +309,8 @@ void CoreOptionsHandler::HandleSetIntegerPref(const ListValue* args) { HandleSetPref(args, Value::TYPE_INTEGER); } -void CoreOptionsHandler::HandleSetRealPref(const ListValue* args) { - HandleSetPref(args, Value::TYPE_REAL); +void CoreOptionsHandler::HandleSetDoublePref(const ListValue* args) { + HandleSetPref(args, Value::TYPE_DOUBLE); } void CoreOptionsHandler::HandleSetStringPref(const ListValue* args) { diff --git a/chrome/browser/dom_ui/options/core_options_handler.h b/chrome/browser/dom_ui/options/core_options_handler.h index cece8ae..75d1855 100644 --- a/chrome/browser/dom_ui/options/core_options_handler.h +++ b/chrome/browser/dom_ui/options/core_options_handler.h @@ -83,7 +83,7 @@ class CoreOptionsHandler : public OptionsPageUIHandler { // item 2 - name of the metric identifier (optional). void HandleSetBooleanPref(const ListValue* args); void HandleSetIntegerPref(const ListValue* args); - void HandleSetRealPref(const ListValue* args); + void HandleSetDoublePref(const ListValue* args); void HandleSetStringPref(const ListValue* args); void HandleSetObjectPref(const ListValue* args); diff --git a/chrome/browser/dom_ui/shown_sections_handler.cc b/chrome/browser/dom_ui/shown_sections_handler.cc index a1bcbf6..8df69fb 100644 --- a/chrome/browser/dom_ui/shown_sections_handler.cc +++ b/chrome/browser/dom_ui/shown_sections_handler.cc @@ -92,7 +92,7 @@ void ShownSectionsHandler::HandleGetShownSections(const ListValue* args) { void ShownSectionsHandler::HandleSetShownSections(const ListValue* args) { double mode_double; - CHECK(args->GetReal(0, &mode_double)); + CHECK(args->GetDouble(0, &mode_double)); int mode = static_cast<int>(mode_double); int old_mode = pref_service_->GetInteger(prefs::kNTPShownSections); diff --git a/chrome/browser/dom_ui/value_helper.cc b/chrome/browser/dom_ui/value_helper.cc index 92bee3c..93c1137 100644 --- a/chrome/browser/dom_ui/value_helper.cc +++ b/chrome/browser/dom_ui/value_helper.cc @@ -20,7 +20,7 @@ bool ValueHelper::TabToValue( NewTabUI::SetURLTitleAndDirection(dictionary, current_navigation.title(), current_navigation.virtual_url()); dictionary->SetString("type", "tab"); - dictionary->SetReal("timestamp", tab.timestamp.ToDoubleT()); + dictionary->SetDouble("timestamp", tab.timestamp.ToDoubleT()); return true; } @@ -40,7 +40,7 @@ bool ValueHelper::WindowToValue( if (tab_values->GetSize() == 0) return false; dictionary->SetString("type", "window"); - dictionary->SetReal("timestamp", window.timestamp.ToDoubleT()); + dictionary->SetDouble("timestamp", window.timestamp.ToDoubleT()); dictionary->Set("tabs", tab_values.release()); return true; } diff --git a/chrome/browser/extensions/extension_bookmark_helpers.cc b/chrome/browser/extensions/extension_bookmark_helpers.cc index ad7cbb0..a48a12c 100644 --- a/chrome/browser/extensions/extension_bookmark_helpers.cc +++ b/chrome/browser/extensions/extension_bookmark_helpers.cc @@ -33,15 +33,15 @@ DictionaryValue* GetNodeDictionary(const BookmarkNode* node, // seconds. base::Time t = node->date_group_modified(); if (!t.is_null()) - dict->SetReal(keys::kDateGroupModifiedKey, floor(t.ToDoubleT() * 1000)); + dict->SetDouble(keys::kDateGroupModifiedKey, floor(t.ToDoubleT() * 1000)); } dict->SetString(keys::kTitleKey, node->GetTitle()); if (!node->date_added().is_null()) { // Javascript Date wants milliseconds since the epoch, ToDoubleT is // seconds. - dict->SetReal(keys::kDateAddedKey, - floor(node->date_added().ToDoubleT() * 1000)); + dict->SetDouble(keys::kDateAddedKey, + floor(node->date_added().ToDoubleT() * 1000)); } if (recurse && node->is_folder()) { diff --git a/chrome/browser/extensions/extension_cookies_api.cc b/chrome/browser/extensions/extension_cookies_api.cc index 0f61602..04d5600 100644 --- a/chrome/browser/extensions/extension_cookies_api.cc +++ b/chrome/browser/extensions/extension_cookies_api.cc @@ -312,7 +312,7 @@ bool SetCookieFunction::RunImpl() { expiration_date = static_cast<double>(expiration_date_int); } else { EXTENSION_FUNCTION_VALIDATE( - expiration_date_value->GetAsReal(&expiration_date)); + expiration_date_value->GetAsDouble(&expiration_date)); } // Time::FromDoubleT converts double time 0 to empty Time object. So we need // to do special handling here. diff --git a/chrome/browser/extensions/extension_cookies_helpers.cc b/chrome/browser/extensions/extension_cookies_helpers.cc index 42e2fae..418eb97 100644 --- a/chrome/browser/extensions/extension_cookies_helpers.cc +++ b/chrome/browser/extensions/extension_cookies_helpers.cc @@ -59,8 +59,10 @@ DictionaryValue* CreateCookieValue( result->SetBoolean(keys::kSecureKey, cookie.IsSecure()); result->SetBoolean(keys::kHttpOnlyKey, cookie.IsHttpOnly()); result->SetBoolean(keys::kSessionKey, !cookie.DoesExpire()); - if (cookie.DoesExpire()) - result->SetReal(keys::kExpirationDateKey, cookie.ExpiryDate().ToDoubleT()); + if (cookie.DoesExpire()) { + result->SetDouble(keys::kExpirationDateKey, + cookie.ExpiryDate().ToDoubleT()); + } result->SetString(keys::kStoreIdKey, store_id); return result; diff --git a/chrome/browser/extensions/extension_cookies_unittest.cc b/chrome/browser/extensions/extension_cookies_unittest.cc index 2aa34a3..2063c4f 100644 --- a/chrome/browser/extensions/extension_cookies_unittest.cc +++ b/chrome/browser/extensions/extension_cookies_unittest.cc @@ -130,7 +130,7 @@ TEST_F(ExtensionCookiesTest, ExtensionTypeCreation) { EXPECT_TRUE(cookie_value1->GetBoolean(keys::kSessionKey, &boolean_value)); EXPECT_TRUE(boolean_value); EXPECT_FALSE( - cookie_value1->GetReal(keys::kExpirationDateKey, &double_value)); + cookie_value1->GetDouble(keys::kExpirationDateKey, &double_value)); EXPECT_TRUE(cookie_value1->GetString(keys::kStoreIdKey, &string_value)); EXPECT_EQ("some cookie store", string_value); @@ -144,7 +144,8 @@ TEST_F(ExtensionCookiesTest, ExtensionTypeCreation) { EXPECT_FALSE(boolean_value); EXPECT_TRUE(cookie_value2->GetBoolean(keys::kSessionKey, &boolean_value)); EXPECT_FALSE(boolean_value); - EXPECT_TRUE(cookie_value2->GetReal(keys::kExpirationDateKey, &double_value)); + EXPECT_TRUE( + cookie_value2->GetDouble(keys::kExpirationDateKey, &double_value)); EXPECT_EQ(10000, double_value); TestingProfile profile; diff --git a/chrome/browser/extensions/extension_history_api.cc b/chrome/browser/extensions/extension_history_api.cc index 5ff98e3..65bef38 100644 --- a/chrome/browser/extensions/extension_history_api.cc +++ b/chrome/browser/extensions/extension_history_api.cc @@ -31,7 +31,8 @@ void GetHistoryItemDictionary(const history::URLRow& row, value->SetString(keys::kIdKey, base::Int64ToString(row.id())); value->SetString(keys::kUrlKey, row.url().spec()); value->SetString(keys::kTitleKey, row.title()); - value->SetReal(keys::kLastVisitdKey, MilliSecondsFromTime(row.last_visit())); + value->SetDouble(keys::kLastVisitdKey, + MilliSecondsFromTime(row.last_visit())); value->SetInteger(keys::kTypedCountKey, row.typed_count()); value->SetInteger(keys::kVisitCountKey, row.visit_count()); } @@ -46,7 +47,7 @@ void GetVisitInfoDictionary(const history::VisitRow& row, DictionaryValue* value) { value->SetString(keys::kIdKey, base::Int64ToString(row.url_id)); value->SetString(keys::kVisitId, base::Int64ToString(row.visit_id)); - value->SetReal(keys::kVisitTime, MilliSecondsFromTime(row.visit_time)); + value->SetDouble(keys::kVisitTime, MilliSecondsFromTime(row.visit_time)); value->SetString(keys::kReferringVisitId, base::Int64ToString(row.referring_visit)); @@ -175,7 +176,7 @@ bool HistoryFunction::GetUrlFromValue(Value* value, GURL* url) { bool HistoryFunction::GetTimeFromValue(Value* value, base::Time* time) { double ms_from_epoch = 0.0; - if (!value->GetAsReal(&ms_from_epoch)) { + if (!value->GetAsDouble(&ms_from_epoch)) { int ms_from_epoch_as_int = 0; if (!value->GetAsInteger(&ms_from_epoch_as_int)) return false; diff --git a/chrome/browser/extensions/extension_processes_api.cc b/chrome/browser/extensions/extension_processes_api.cc index 5edc2f0..c4a5dd7 100644 --- a/chrome/browser/extensions/extension_processes_api.cc +++ b/chrome/browser/extensions/extension_processes_api.cc @@ -35,10 +35,10 @@ DictionaryValue* CreateProcessValue(int process_id, DictionaryValue* result = new DictionaryValue(); result->SetInteger(keys::kIdKey, process_id); result->SetString(keys::kTypeKey, type); - result->SetReal(keys::kCpuKey, cpu); - result->SetReal(keys::kNetworkKey, static_cast<double>(net)); - result->SetReal(keys::kPrivateMemoryKey, static_cast<double>(pr_mem)); - result->SetReal(keys::kSharedMemoryKey, static_cast<double>(sh_mem)); + result->SetDouble(keys::kCpuKey, cpu); + result->SetDouble(keys::kNetworkKey, static_cast<double>(net)); + result->SetDouble(keys::kPrivateMemoryKey, static_cast<double>(pr_mem)); + result->SetDouble(keys::kSharedMemoryKey, static_cast<double>(sh_mem)); return result; } diff --git a/chrome/browser/extensions/extension_tts_api_util.cc b/chrome/browser/extensions/extension_tts_api_util.cc index b3ef18c..b630387 100644 --- a/chrome/browser/extensions/extension_tts_api_util.cc +++ b/chrome/browser/extensions/extension_tts_api_util.cc @@ -27,8 +27,8 @@ bool ReadNumberByKey(DictionaryValue* dict, if (!dict->GetInteger(key, &int_value)) return false; *ret_value = int_value; - } else if (value->IsType(Value::TYPE_REAL)) { - if (!dict->GetReal(key, ret_value)) + } else if (value->IsType(Value::TYPE_DOUBLE)) { + if (!dict->GetDouble(key, ret_value)) return false; } else { return false; diff --git a/chrome/browser/extensions/extension_webnavigation_api.cc b/chrome/browser/extensions/extension_webnavigation_api.cc index dd755e3..0a4db21 100644 --- a/chrome/browser/extensions/extension_webnavigation_api.cc +++ b/chrome/browser/extensions/extension_webnavigation_api.cc @@ -196,7 +196,7 @@ void ExtensionWebNavigationEventRouter::FrameProvisionalLoadStart( dict->SetString(keys::kUrlKey, details->url().spec()); dict->SetInteger(keys::kFrameIdKey, GetFrameId(details)); dict->SetInteger(keys::kRequestIdKey, 0); - dict->SetReal(keys::kTimeStampKey, MilliSecondsFromTime(base::Time::Now())); + dict->SetDouble(keys::kTimeStampKey, MilliSecondsFromTime(base::Time::Now())); args.Append(dict); std::string json_args; @@ -221,7 +221,7 @@ void ExtensionWebNavigationEventRouter::FrameProvisionalLoadCommitted( dict->SetString(keys::kTransitionQualifiersKey, PageTransition::QualifierString( details->transition_type())); - dict->SetReal(keys::kTimeStampKey, MilliSecondsFromTime(base::Time::Now())); + dict->SetDouble(keys::kTimeStampKey, MilliSecondsFromTime(base::Time::Now())); args.Append(dict); std::string json_args; @@ -241,7 +241,7 @@ void ExtensionWebNavigationEventRouter::FrameDomContentLoaded( dict->SetString(keys::kUrlKey, navigation_state_.GetUrl(frame_id).spec()); dict->SetInteger(keys::kFrameIdKey, navigation_state_.IsMainFrame(frame_id) ? 0 : static_cast<int>(frame_id)); - dict->SetReal(keys::kTimeStampKey, MilliSecondsFromTime(base::Time::Now())); + dict->SetDouble(keys::kTimeStampKey, MilliSecondsFromTime(base::Time::Now())); args.Append(dict); std::string json_args; @@ -261,7 +261,7 @@ void ExtensionWebNavigationEventRouter::FrameDidFinishLoad( dict->SetString(keys::kUrlKey, navigation_state_.GetUrl(frame_id).spec()); dict->SetInteger(keys::kFrameIdKey, navigation_state_.IsMainFrame(frame_id) ? 0 : static_cast<int>(frame_id)); - dict->SetReal(keys::kTimeStampKey, MilliSecondsFromTime(base::Time::Now())); + dict->SetDouble(keys::kTimeStampKey, MilliSecondsFromTime(base::Time::Now())); args.Append(dict); std::string json_args; @@ -282,7 +282,7 @@ void ExtensionWebNavigationEventRouter::FailProvisionalLoadWithError( dict->SetInteger(keys::kFrameIdKey, GetFrameId(details)); dict->SetString(keys::kErrorKey, std::string(net::ErrorToString(details->error_code()))); - dict->SetReal(keys::kTimeStampKey, MilliSecondsFromTime(base::Time::Now())); + dict->SetDouble(keys::kTimeStampKey, MilliSecondsFromTime(base::Time::Now())); args.Append(dict); std::string json_args; @@ -301,7 +301,7 @@ void ExtensionWebNavigationEventRouter::CreatingNewWindow( dict->SetString(keys::kSourceUrlKey, details->opener_url.spec()); dict->SetString(keys::kTargetUrlKey, details->target_url.possibly_invalid_spec()); - dict->SetReal(keys::kTimeStampKey, MilliSecondsFromTime(base::Time::Now())); + dict->SetDouble(keys::kTimeStampKey, MilliSecondsFromTime(base::Time::Now())); args.Append(dict); std::string json_args; diff --git a/chrome/browser/geolocation/network_location_request.cc b/chrome/browser/geolocation/network_location_request.cc index 5edade1..928d621 100644 --- a/chrome/browser/geolocation/network_location_request.cc +++ b/chrome/browser/geolocation/network_location_request.cc @@ -282,7 +282,7 @@ bool GetAsDouble(const DictionaryValue& object, *out = value_as_int; return true; } - return value->GetAsReal(out); + return value->GetAsDouble(out); } bool ParseServerResponse(const std::string& response_body, diff --git a/chrome/browser/host_zoom_map.cc b/chrome/browser/host_zoom_map.cc index 598450e..3dc257b 100644 --- a/chrome/browser/host_zoom_map.cc +++ b/chrome/browser/host_zoom_map.cc @@ -30,7 +30,7 @@ HostZoomMap::HostZoomMap(Profile* profile) updating_preferences_(false) { Load(); default_zoom_level_ = - profile_->GetPrefs()->GetReal(prefs::kDefaultZoomLevel); + profile_->GetPrefs()->GetDouble(prefs::kDefaultZoomLevel); registrar_.Add(this, NotificationType::PROFILE_DESTROYED, Source<Profile>(profile)); // Don't observe pref changes (e.g. from sync) in Incognito; once we create @@ -62,7 +62,7 @@ void HostZoomMap::Load() { const std::string& host(*i); double zoom_level = 0; - bool success = host_zoom_dictionary->GetRealWithoutPathExpansion( + bool success = host_zoom_dictionary->GetDoubleWithoutPathExpansion( host, &zoom_level); if (!success) { // The data used to be stored as ints, so try that. @@ -133,7 +133,7 @@ void HostZoomMap::SetZoomLevel(const GURL& url, double level) { host_zoom_dictionary->RemoveWithoutPathExpansion(host, NULL); } else { host_zoom_dictionary->SetWithoutPathExpansion( - host, Value::CreateRealValue(level)); + host, Value::CreateDoubleValue(level)); } } updating_preferences_ = false; @@ -245,7 +245,7 @@ void HostZoomMap::Observe( Load(); else if (prefs::kDefaultZoomLevel == *name) { default_zoom_level_ = - profile_->GetPrefs()->GetReal(prefs::kDefaultZoomLevel); + profile_->GetPrefs()->GetDouble(prefs::kDefaultZoomLevel); } } break; diff --git a/chrome/browser/host_zoom_map_unittest.cc b/chrome/browser/host_zoom_map_unittest.cc index 73f37d6..82e0e58 100644 --- a/chrome/browser/host_zoom_map_unittest.cc +++ b/chrome/browser/host_zoom_map_unittest.cc @@ -64,7 +64,7 @@ TEST_F(HostZoomMapTest, LoadNoPrefs) { TEST_F(HostZoomMapTest, Load) { DictionaryValue* dict = prefs_->GetMutableDictionary(prefs::kPerHostZoomLevels); - dict->SetWithoutPathExpansion(host_, Value::CreateRealValue(kZoomLevel)); + dict->SetWithoutPathExpansion(host_, Value::CreateDoubleValue(kZoomLevel)); scoped_refptr<HostZoomMap> map(new HostZoomMap(&profile_)); EXPECT_EQ(kZoomLevel, map->GetZoomLevel(url_)); } @@ -80,7 +80,7 @@ TEST_F(HostZoomMapTest, SetZoomLevel) { const DictionaryValue* dict = prefs_->GetDictionary(prefs::kPerHostZoomLevels); double zoom_level = 0; - EXPECT_TRUE(dict->GetRealWithoutPathExpansion(host_, &zoom_level)); + EXPECT_TRUE(dict->GetDoubleWithoutPathExpansion(host_, &zoom_level)); EXPECT_EQ(kZoomLevel, zoom_level); SetPrefObserverExpectation(); @@ -109,7 +109,7 @@ TEST_F(HostZoomMapTest, ReloadOnPrefChange) { map->SetZoomLevel(url_, kZoomLevel); DictionaryValue dict; - dict.SetWithoutPathExpansion(host_, Value::CreateRealValue(0)); + dict.SetWithoutPathExpansion(host_, Value::CreateDoubleValue(0)); prefs_->Set(prefs::kPerHostZoomLevels, dict); EXPECT_EQ(0, map->GetZoomLevel(url_)); } diff --git a/chrome/browser/net/predictor_unittest.cc b/chrome/browser/net/predictor_unittest.cc index bbc798e..2dbcc4e 100644 --- a/chrome/browser/net/predictor_unittest.cc +++ b/chrome/browser/net/predictor_unittest.cc @@ -339,7 +339,7 @@ static bool GetDataFromSerialization(const GURL& motivation, for (size_t i = 0; i < subresource_list->GetSize();) { std::string url_spec; EXPECT_TRUE(subresource_list->GetString(i++, &url_spec)); - EXPECT_TRUE(subresource_list->GetReal(i++, use_rate)); + EXPECT_TRUE(subresource_list->GetDouble(i++, use_rate)); if (subresource == GURL(url_spec)) { return true; } diff --git a/chrome/browser/net/referrer.cc b/chrome/browser/net/referrer.cc index 0b884d6..8f16067 100644 --- a/chrome/browser/net/referrer.cc +++ b/chrome/browser/net/referrer.cc @@ -124,7 +124,7 @@ void Referrer::Deserialize(const Value& value) { if (!subresource_list->GetString(index++, &url_spec)) return; double rate; - if (!subresource_list->GetReal(index++, &rate)) + if (!subresource_list->GetDouble(index++, &rate)) return; GURL url(url_spec); diff --git a/chrome/browser/policy/device_management_policy_cache.cc b/chrome/browser/policy/device_management_policy_cache.cc index cc6a34e..ef8e6e1 100644 --- a/chrome/browser/policy/device_management_policy_cache.cc +++ b/chrome/browser/policy/device_management_policy_cache.cc @@ -185,7 +185,7 @@ Value* DeviceManagementPolicyCache::DecodeValue(const em::GenericValue& value) { return NULL; case em::GenericValue::VALUE_TYPE_DOUBLE: if (value.has_double_value()) - return Value::CreateRealValue(value.double_value()); + return Value::CreateDoubleValue(value.double_value()); return NULL; case em::GenericValue::VALUE_TYPE_BYTES: if (value.has_bytes_value()) { @@ -224,7 +224,7 @@ Value* DeviceManagementPolicyCache::DecodeValue(const em::GenericValue& value) { RepeatedField<double>::const_iterator i; for (i = value.double_array().begin(); i != value.double_array().end(); ++i) - list->Append(Value::CreateRealValue(*i)); + list->Append(Value::CreateDoubleValue(*i)); return list; } default: diff --git a/chrome/browser/policy/device_management_policy_cache_unittest.cc b/chrome/browser/policy/device_management_policy_cache_unittest.cc index e1482f1..1fe98c8 100644 --- a/chrome/browser/policy/device_management_policy_cache_unittest.cc +++ b/chrome/browser/policy/device_management_policy_cache_unittest.cc @@ -257,7 +257,7 @@ TEST_F(DeviceManagementPolicyCacheDecodeTest, String) { TEST_F(DeviceManagementPolicyCacheDecodeTest, Double) { value_.set_value_type(em::GenericValue::VALUE_TYPE_DOUBLE); value_.set_double_value(0.42L); - DecodeAndCheck(Value::CreateRealValue(0.42L)); + DecodeAndCheck(Value::CreateDoubleValue(0.42L)); } TEST_F(DeviceManagementPolicyCacheDecodeTest, Bytes) { @@ -303,8 +303,8 @@ TEST_F(DeviceManagementPolicyCacheDecodeTest, DoubleArray) { value_.add_double_array(0.42L); value_.add_double_array(0.17L); ListValue* list = new ListValue; - list->Append(Value::CreateRealValue(0.42L)); - list->Append(Value::CreateRealValue(0.17L)); + list->Append(Value::CreateDoubleValue(0.42L)); + list->Append(Value::CreateDoubleValue(0.17L)); DecodeAndCheck(list); } diff --git a/chrome/browser/prefs/pref_member.cc b/chrome/browser/prefs/pref_member.cc index 0b38486..5ff0f0d 100644 --- a/chrome/browser/prefs/pref_member.cc +++ b/chrome/browser/prefs/pref_member.cc @@ -96,18 +96,18 @@ void IntegerPrefMember::UpdatePref(const int& value) { prefs()->SetInteger(pref_name().c_str(), value); } -RealPrefMember::RealPrefMember() : PrefMember<double>() { +DoublePrefMember::DoublePrefMember() : PrefMember<double>() { } -RealPrefMember::~RealPrefMember() { +DoublePrefMember::~DoublePrefMember() { } -void RealPrefMember::UpdateValueFromPref() const { - value_ = prefs()->GetReal(pref_name().c_str()); +void DoublePrefMember::UpdateValueFromPref() const { + value_ = prefs()->GetDouble(pref_name().c_str()); } -void RealPrefMember::UpdatePref(const double& value) { - prefs()->SetReal(pref_name().c_str(), value); +void DoublePrefMember::UpdatePref(const double& value) { + prefs()->SetDouble(pref_name().c_str(), value); } StringPrefMember::StringPrefMember() : PrefMember<std::string>() { diff --git a/chrome/browser/prefs/pref_member.h b/chrome/browser/prefs/pref_member.h index 099511a..082ec6e 100644 --- a/chrome/browser/prefs/pref_member.h +++ b/chrome/browser/prefs/pref_member.h @@ -178,17 +178,17 @@ class IntegerPrefMember : public PrefMember<int> { DISALLOW_COPY_AND_ASSIGN(IntegerPrefMember); }; -class RealPrefMember : public PrefMember<double> { +class DoublePrefMember : public PrefMember<double> { public: - RealPrefMember(); - virtual ~RealPrefMember(); + DoublePrefMember(); + virtual ~DoublePrefMember(); protected: virtual void UpdateValueFromPref() const; virtual void UpdatePref(const double& value); private: - DISALLOW_COPY_AND_ASSIGN(RealPrefMember); + DISALLOW_COPY_AND_ASSIGN(DoublePrefMember); }; class StringPrefMember : public PrefMember<std::string> { diff --git a/chrome/browser/prefs/pref_member_unittest.cc b/chrome/browser/prefs/pref_member_unittest.cc index 3f786afb..f0bf181 100644 --- a/chrome/browser/prefs/pref_member_unittest.cc +++ b/chrome/browser/prefs/pref_member_unittest.cc @@ -14,13 +14,13 @@ namespace { static const char kBoolPref[] = "bool"; static const char kIntPref[] = "int"; -static const char kRealPref[] = "real"; +static const char kDoublePref[] = "double"; static const char kStringPref[] = "string"; void RegisterTestPrefs(PrefService* prefs) { prefs->RegisterBooleanPref(kBoolPref, false); prefs->RegisterIntegerPref(kIntPref, 0); - prefs->RegisterRealPref(kRealPref, 0.0); + prefs->RegisterDoublePref(kDoublePref, 0.0); prefs->RegisterStringPref(kStringPref, "default"); } @@ -98,26 +98,26 @@ TEST(PrefMemberTest, BasicGetAndSet) { EXPECT_EQ(2, integer.GetValue()); EXPECT_EQ(2, *integer); - // Test real (double) - RealPrefMember real; - real.Init(kRealPref, &prefs, NULL); + // Test double + DoublePrefMember double_member; + double_member.Init(kDoublePref, &prefs, NULL); // Check the defaults - EXPECT_EQ(0.0, prefs.GetReal(kRealPref)); - EXPECT_EQ(0.0, real.GetValue()); - EXPECT_EQ(0.0, *real); + EXPECT_EQ(0.0, prefs.GetDouble(kDoublePref)); + EXPECT_EQ(0.0, double_member.GetValue()); + EXPECT_EQ(0.0, *double_member); // Try changing through the member variable. - real.SetValue(1.0); - EXPECT_EQ(1.0, real.GetValue()); - EXPECT_EQ(1.0, prefs.GetReal(kRealPref)); - EXPECT_EQ(1.0, *real); + double_member.SetValue(1.0); + EXPECT_EQ(1.0, double_member.GetValue()); + EXPECT_EQ(1.0, prefs.GetDouble(kDoublePref)); + EXPECT_EQ(1.0, *double_member); // Try changing back through the pref. - prefs.SetReal(kRealPref, 3.0); - EXPECT_EQ(3.0, prefs.GetReal(kRealPref)); - EXPECT_EQ(3.0, real.GetValue()); - EXPECT_EQ(3.0, *real); + prefs.SetDouble(kDoublePref, 3.0); + EXPECT_EQ(3.0, prefs.GetDouble(kDoublePref)); + EXPECT_EQ(3.0, double_member.GetValue()); + EXPECT_EQ(3.0, *double_member); // Test string StringPrefMember string; @@ -142,14 +142,14 @@ TEST(PrefMemberTest, BasicGetAndSet) { } TEST(PrefMemberTest, TwoPrefs) { - // Make sure two RealPrefMembers stay in sync. + // Make sure two DoublePrefMembers stay in sync. TestingPrefService prefs; RegisterTestPrefs(&prefs); - RealPrefMember pref1; - pref1.Init(kRealPref, &prefs, NULL); - RealPrefMember pref2; - pref2.Init(kRealPref, &prefs, NULL); + DoublePrefMember pref1; + pref1.Init(kDoublePref, &prefs, NULL); + DoublePrefMember pref2; + pref2.Init(kDoublePref, &prefs, NULL); pref1.SetValue(2.3); EXPECT_EQ(2.3, *pref2); @@ -157,7 +157,7 @@ TEST(PrefMemberTest, TwoPrefs) { pref2.SetValue(3.5); EXPECT_EQ(3.5, *pref1); - prefs.SetReal(kRealPref, 4.2); + prefs.SetDouble(kDoublePref, 4.2); EXPECT_EQ(4.2, *pref1); EXPECT_EQ(4.2, *pref2); } diff --git a/chrome/browser/prefs/pref_service.cc b/chrome/browser/prefs/pref_service.cc index 363d262..34b6ca4 100644 --- a/chrome/browser/prefs/pref_service.cc +++ b/chrome/browser/prefs/pref_service.cc @@ -56,10 +56,10 @@ Value* CreateLocaleDefaultValue(Value::ValueType type, int message_id) { return Value::CreateIntegerValue(val); } - case Value::TYPE_REAL: { + case Value::TYPE_DOUBLE: { double val; base::StringToDouble(resource_string, &val); - return Value::CreateRealValue(val); + return Value::CreateDoubleValue(val); } case Value::TYPE_STRING: { @@ -227,8 +227,8 @@ void PrefService::RegisterIntegerPref(const char* path, int default_value) { RegisterPreference(path, Value::CreateIntegerValue(default_value)); } -void PrefService::RegisterRealPref(const char* path, double default_value) { - RegisterPreference(path, Value::CreateRealValue(default_value)); +void PrefService::RegisterDoublePref(const char* path, double default_value) { + RegisterPreference(path, Value::CreateDoubleValue(default_value)); } void PrefService::RegisterStringPref(const char* path, @@ -263,11 +263,11 @@ void PrefService::RegisterLocalizedIntegerPref(const char* path, CreateLocaleDefaultValue(Value::TYPE_INTEGER, locale_default_message_id)); } -void PrefService::RegisterLocalizedRealPref(const char* path, - int locale_default_message_id) { +void PrefService::RegisterLocalizedDoublePref(const char* path, + int locale_default_message_id) { RegisterPreference( path, - CreateLocaleDefaultValue(Value::TYPE_REAL, locale_default_message_id)); + CreateLocaleDefaultValue(Value::TYPE_DOUBLE, locale_default_message_id)); } void PrefService::RegisterLocalizedStringPref(const char* path, @@ -307,7 +307,7 @@ int PrefService::GetInteger(const char* path) const { return result; } -double PrefService::GetReal(const char* path) const { +double PrefService::GetDouble(const char* path) const { DCHECK(CalledOnValidThread()); double result = 0.0; @@ -317,7 +317,7 @@ double PrefService::GetReal(const char* path) const { NOTREACHED() << "Trying to read an unregistered pref: " << path; return result; } - bool rv = pref->GetValue()->GetAsReal(&result); + bool rv = pref->GetValue()->GetAsDouble(&result); DCHECK(rv); return result; } @@ -494,8 +494,8 @@ void PrefService::SetInteger(const char* path, int value) { SetUserPrefValue(path, Value::CreateIntegerValue(value)); } -void PrefService::SetReal(const char* path, double value) { - SetUserPrefValue(path, Value::CreateRealValue(value)); +void PrefService::SetDouble(const char* path, double value) { + SetUserPrefValue(path, Value::CreateDoubleValue(value)); } void PrefService::SetString(const char* path, const std::string& value) { diff --git a/chrome/browser/prefs/pref_service.h b/chrome/browser/prefs/pref_service.h index 41d4e50..5891a1d 100644 --- a/chrome/browser/prefs/pref_service.h +++ b/chrome/browser/prefs/pref_service.h @@ -38,7 +38,7 @@ class PrefService : public base::NonThreadSafe { public: // The type of the preference is determined by the type with which it is - // registered. This type needs to be a boolean, integer, real, string, + // registered. This type needs to be a boolean, integer, double, string, // dictionary (a branch), or list. You shouldn't need to construct this on // your own; use the PrefService::Register*Pref methods instead. Preference(const PrefService* service, @@ -142,7 +142,7 @@ class PrefService : public base::NonThreadSafe { // Make the PrefService aware of a pref. void RegisterBooleanPref(const char* path, bool default_value); void RegisterIntegerPref(const char* path, int default_value); - void RegisterRealPref(const char* path, double default_value); + void RegisterDoublePref(const char* path, double default_value); void RegisterStringPref(const char* path, const std::string& default_value); void RegisterFilePathPref(const char* path, const FilePath& default_value); void RegisterListPref(const char* path); @@ -153,8 +153,8 @@ class PrefService : public base::NonThreadSafe { int locale_default_message_id); void RegisterLocalizedIntegerPref(const char* path, int locale_default_message_id); - void RegisterLocalizedRealPref(const char* path, - int locale_default_message_id); + void RegisterLocalizedDoublePref(const char* path, + int locale_default_message_id); void RegisterLocalizedStringPref(const char* path, int locale_default_message_id); @@ -163,7 +163,7 @@ class PrefService : public base::NonThreadSafe { // value (set when the pref was registered) will be returned. bool GetBoolean(const char* path) const; int GetInteger(const char* path) const; - double GetReal(const char* path) const; + double GetDouble(const char* path) const; std::string GetString(const char* path) const; FilePath GetFilePath(const char* path) const; @@ -182,7 +182,7 @@ class PrefService : public base::NonThreadSafe { void Set(const char* path, const Value& value); void SetBoolean(const char* path, bool value); void SetInteger(const char* path, int value); - void SetReal(const char* path, double value); + void SetDouble(const char* path, double value); void SetString(const char* path, const std::string& value); void SetFilePath(const char* path, const FilePath& value); diff --git a/chrome/browser/printing/print_dialog_cloud.cc b/chrome/browser/printing/print_dialog_cloud.cc index 1013aed..515e0b4 100644 --- a/chrome/browser/printing/print_dialog_cloud.cc +++ b/chrome/browser/printing/print_dialog_cloud.cc @@ -106,10 +106,10 @@ namespace internal_cloud_print_helpers { -bool GetRealOrInt(const DictionaryValue& dictionary, - const std::string& path, - double* out_value) { - if (!dictionary.GetReal(path, out_value)) { +bool GetDoubleOrInt(const DictionaryValue& dictionary, + const std::string& path, + double* out_value) { + if (!dictionary.GetDouble(path, out_value)) { int int_value = 0; if (!dictionary.GetInteger(path, &int_value)) return false; @@ -131,9 +131,9 @@ bool GetPageSetupParameters(const std::string& json, bool result = true; DictionaryValue* params = static_cast<DictionaryValue*>(parsed_value.get()); - result &= GetRealOrInt(*params, "dpi", ¶meters.dpi); - result &= GetRealOrInt(*params, "min_shrink", ¶meters.min_shrink); - result &= GetRealOrInt(*params, "max_shrink", ¶meters.max_shrink); + result &= GetDoubleOrInt(*params, "dpi", ¶meters.dpi); + result &= GetDoubleOrInt(*params, "min_shrink", ¶meters.min_shrink); + result &= GetDoubleOrInt(*params, "max_shrink", ¶meters.max_shrink); result &= params->GetBoolean("selection_only", ¶meters.selection_only); return result; } diff --git a/chrome/browser/renderer_host/test/render_view_host_browsertest.cc b/chrome/browser/renderer_host/test/render_view_host_browsertest.cc index 67c0dfb..6e37723 100644 --- a/chrome/browser/renderer_host/test/render_view_host_browsertest.cc +++ b/chrome/browser/renderer_host/test/render_view_host_browsertest.cc @@ -117,9 +117,9 @@ IN_PROC_BROWSER_TEST_F(RenderViewHostTest, { ExecuteNotificationObserver observer; ExecuteJavascriptAndGetValue("42.2;", &observer); - EXPECT_EQ(Value::TYPE_REAL, observer.value()->GetType()); + EXPECT_EQ(Value::TYPE_DOUBLE, observer.value()->GetType()); double double_value; - EXPECT_TRUE(observer.value()->GetAsReal(&double_value)); + EXPECT_TRUE(observer.value()->GetAsDouble(&double_value)); EXPECT_EQ(42.2, double_value); } @@ -149,9 +149,9 @@ IN_PROC_BROWSER_TEST_F(RenderViewHostTest, { ExecuteNotificationObserver observer; ExecuteJavascriptAndGetValue("new Date(1);", &observer); - EXPECT_EQ(Value::TYPE_REAL, observer.value()->GetType()); + EXPECT_EQ(Value::TYPE_DOUBLE, observer.value()->GetType()); double date_seconds; - EXPECT_TRUE(observer.value()->GetAsReal(&date_seconds)); + EXPECT_TRUE(observer.value()->GetAsDouble(&date_seconds)); base::Time time = base::Time::FromDoubleT(date_seconds); @@ -170,9 +170,9 @@ IN_PROC_BROWSER_TEST_F(RenderViewHostTest, ExecuteNotificationObserver observer; ExecuteJavascriptAndGetValue("new Date(Date.UTC(2006, 7, 16, 12, 0, 15));", &observer); - EXPECT_EQ(Value::TYPE_REAL, observer.value()->GetType()); + EXPECT_EQ(Value::TYPE_DOUBLE, observer.value()->GetType()); double date_seconds; - EXPECT_TRUE(observer.value()->GetAsReal(&date_seconds)); + EXPECT_TRUE(observer.value()->GetAsDouble(&date_seconds)); base::Time time = base::Time::FromDoubleT(date_seconds); diff --git a/chrome/browser/resources/options/pref_ui.js b/chrome/browser/resources/options/pref_ui.js index 99db298..3e8c965 100644 --- a/chrome/browser/resources/options/pref_ui.js +++ b/chrome/browser/resources/options/pref_ui.js @@ -411,7 +411,7 @@ cr.define('options', function() { self.options[self.selectedIndex].value, self.metric); break; case 'real': - Preferences.setRealPref(self.pref, + Preferences.setDoublePref(self.pref, self.options[self.selectedIndex].value, self.metric); break; case 'boolean': diff --git a/chrome/browser/resources/options/preferences.js b/chrome/browser/resources/options/preferences.js index 1b242337..ccd3bd7 100644 --- a/chrome/browser/resources/options/preferences.js +++ b/chrome/browser/resources/options/preferences.js @@ -69,10 +69,10 @@ cr.define('options', function() { * @param {number} value New preference value. * @param {string} metric User metrics identifier. */ - Preferences.setRealPref = function(name, value, metric) { + Preferences.setDoublePref = function(name, value, metric) { var argumentList = [name, String(value)]; if (metric != undefined) argumentList.push(metric); - chrome.send('setRealPref', argumentList); + chrome.send('setDoublePref', argumentList); }; /** diff --git a/chrome/browser/speech/speech_recognition_request.cc b/chrome/browser/speech/speech_recognition_request.cc index 74665e98..dc8dc27 100644 --- a/chrome/browser/speech/speech_recognition_request.cc +++ b/chrome/browser/speech/speech_recognition_request.cc @@ -91,7 +91,7 @@ bool ParseServerResponse(const std::string& response_body, // It is not an error if the 'confidence' field is missing. double confidence = 0.0; - hypothesis_value->GetReal(kConfidenceString, &confidence); + hypothesis_value->GetDouble(kConfidenceString, &confidence); result->push_back(speech_input::SpeechInputResultItem(utterance, confidence)); diff --git a/chrome/browser/themes/browser_theme_pack.cc b/chrome/browser/themes/browser_theme_pack.cc index 517efd0..32c45aa 100644 --- a/chrome/browser/themes/browser_theme_pack.cc +++ b/chrome/browser/themes/browser_theme_pack.cc @@ -298,8 +298,8 @@ RefCountedMemory* ReadFileData(const FilePath& path) { // Does error checking for invalid incoming data while trying to read an // floating point value. -bool ValidRealValue(ListValue* tint_list, int index, double* out) { - if (tint_list->GetReal(index, out)) +bool ValidDoubleValue(ListValue* tint_list, int index, double* out) { + if (tint_list->GetDouble(index, out)) return true; int value = 0; @@ -619,9 +619,9 @@ void BrowserThemePack::BuildTintsFromJSON(DictionaryValue* tints_value) { (tint_list->GetSize() == 3)) { color_utils::HSL hsl = { -1, -1, -1 }; - if (ValidRealValue(tint_list, 0, &hsl.h) && - ValidRealValue(tint_list, 1, &hsl.s) && - ValidRealValue(tint_list, 2, &hsl.l)) { + if (ValidDoubleValue(tint_list, 0, &hsl.h) && + ValidDoubleValue(tint_list, 1, &hsl.s) && + ValidDoubleValue(tint_list, 2, &hsl.l)) { int id = GetIntForString(*iter, kTintTable); if (id != -1) { temp_tints[id] = hsl; @@ -680,7 +680,7 @@ void BrowserThemePack::ReadColorsFromJSON( if (color_list->GetSize() == 4) { double alpha; int alpha_int; - if (color_list->GetReal(3, &alpha)) { + if (color_list->GetDouble(3, &alpha)) { color = SkColorSetARGB(static_cast<int>(alpha * 255), r, g, b); } else if (color_list->GetInteger(3, &alpha_int) && (alpha_int == 0 || alpha_int == 1)) { diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc index 59ef3db..d395497 100644 --- a/chrome/browser/ui/browser.cc +++ b/chrome/browser/ui/browser.cc @@ -2061,7 +2061,7 @@ void Browser::RegisterUserPrefs(PrefService* prefs) { prefs->RegisterStringPref(prefs::kCloudPrintEmail, std::string()); prefs->RegisterBooleanPref(prefs::kDevToolsDisabled, false); prefs->RegisterBooleanPref(prefs::kIncognitoEnabled, true); - prefs->RegisterRealPref(prefs::kDefaultZoomLevel, 0.0); + prefs->RegisterDoublePref(prefs::kDefaultZoomLevel, 0.0); prefs->RegisterIntegerPref(prefs::kMultipleProfilePrefMigration, 0); // We need to register the type of this preference in order to query // it even though it's only typically controlled via policy. diff --git a/chrome/browser/ui/cocoa/extensions/browser_actions_controller.mm b/chrome/browser/ui/cocoa/extensions/browser_actions_controller.mm index 3cf2433..e0d0a09 100644 --- a/chrome/browser/ui/cocoa/extensions/browser_actions_controller.mm +++ b/chrome/browser/ui/cocoa/extensions/browser_actions_controller.mm @@ -360,7 +360,7 @@ class ExtensionServiceObserverBridge : public NotificationObserver, // Migration code to the new VisibleIconCount pref. // TODO(mpcomplete): remove this at some point. double predefinedWidth = - profile_->GetPrefs()->GetReal(prefs::kBrowserActionContainerWidth); + profile_->GetPrefs()->GetDouble(prefs::kBrowserActionContainerWidth); if (predefinedWidth != 0) { int iconWidth = kBrowserActionWidth + kBrowserActionButtonPadding; int extraWidth = kChevronWidth; @@ -419,7 +419,7 @@ class ExtensionServiceObserverBridge : public NotificationObserver, } + (void)registerUserPrefs:(PrefService*)prefs { - prefs->RegisterRealPref(prefs::kBrowserActionContainerWidth, 0); + prefs->RegisterDoublePref(prefs::kBrowserActionContainerWidth, 0); } #pragma mark - diff --git a/chrome/browser/web_resource/web_resource_service.cc b/chrome/browser/web_resource/web_resource_service.cc index 3225b92..ab060a8 100644 --- a/chrome/browser/web_resource/web_resource_service.cc +++ b/chrome/browser/web_resource/web_resource_service.cc @@ -242,10 +242,10 @@ void WebResourceService::Init() { resource_dispatcher_host_ = g_browser_process->resource_dispatcher_host(); web_resource_fetcher_.reset(new WebResourceFetcher(this)); prefs_->RegisterStringPref(prefs::kNTPWebResourceCacheUpdate, "0"); - prefs_->RegisterRealPref(prefs::kNTPCustomLogoStart, 0); - prefs_->RegisterRealPref(prefs::kNTPCustomLogoEnd, 0); - prefs_->RegisterRealPref(prefs::kNTPPromoStart, 0); - prefs_->RegisterRealPref(prefs::kNTPPromoEnd, 0); + prefs_->RegisterDoublePref(prefs::kNTPCustomLogoStart, 0); + prefs_->RegisterDoublePref(prefs::kNTPCustomLogoEnd, 0); + prefs_->RegisterDoublePref(prefs::kNTPPromoStart, 0); + prefs_->RegisterDoublePref(prefs::kNTPPromoEnd, 0); prefs_->RegisterStringPref(prefs::kNTPPromoLine, std::string()); prefs_->RegisterBooleanPref(prefs::kNTPPromoClosed, false); prefs_->RegisterIntegerPref(prefs::kNTPPromoGroup, -1); @@ -255,8 +255,8 @@ void WebResourceService::Init() { // If the promo start is in the future, set a notification task to invalidate // the NTP cache at the time of the promo start. - double promo_start = prefs_->GetReal(prefs::kNTPPromoStart); - double promo_end = prefs_->GetReal(prefs::kNTPPromoEnd); + double promo_start = prefs_->GetDouble(prefs::kNTPPromoStart); + double promo_end = prefs_->GetDouble(prefs::kNTPPromoEnd); ScheduleNotification(promo_start, promo_end); } @@ -391,8 +391,8 @@ void WebResourceService::UnpackPromoSignal(const DictionaryValue& parsed_json) { // Check for preexisting start and end values. if (prefs_->HasPrefPath(prefs::kNTPPromoStart) && prefs_->HasPrefPath(prefs::kNTPPromoEnd)) { - old_promo_start = prefs_->GetReal(prefs::kNTPPromoStart); - old_promo_end = prefs_->GetReal(prefs::kNTPPromoEnd); + old_promo_start = prefs_->GetDouble(prefs::kNTPPromoStart); + old_promo_end = prefs_->GetDouble(prefs::kNTPPromoEnd); } // Check for newly received start and end values. @@ -473,8 +473,8 @@ void WebResourceService::UnpackPromoSignal(const DictionaryValue& parsed_json) { // Also reset the promo closed preference, to signal a new promo. if (!(old_promo_start == promo_start) || !(old_promo_end == promo_end)) { - prefs_->SetReal(prefs::kNTPPromoStart, promo_start); - prefs_->SetReal(prefs::kNTPPromoEnd, promo_end); + prefs_->SetDouble(prefs::kNTPPromoStart, promo_start); + prefs_->SetDouble(prefs::kNTPPromoEnd, promo_end); prefs_->SetBoolean(prefs::kNTPPromoClosed, false); ScheduleNotification(promo_start, promo_end); } @@ -491,8 +491,8 @@ void WebResourceService::UnpackLogoSignal(const DictionaryValue& parsed_json) { // Check for preexisting start and end values. if (prefs_->HasPrefPath(prefs::kNTPCustomLogoStart) && prefs_->HasPrefPath(prefs::kNTPCustomLogoEnd)) { - old_logo_start = prefs_->GetReal(prefs::kNTPCustomLogoStart); - old_logo_end = prefs_->GetReal(prefs::kNTPCustomLogoEnd); + old_logo_start = prefs_->GetDouble(prefs::kNTPCustomLogoStart); + old_logo_end = prefs_->GetDouble(prefs::kNTPCustomLogoEnd); } // Check for newly received start and end values. @@ -538,8 +538,8 @@ void WebResourceService::UnpackLogoSignal(const DictionaryValue& parsed_json) { // dates counts as a triggering change if there were dates before. if (!(old_logo_start == logo_start) || !(old_logo_end == logo_end)) { - prefs_->SetReal(prefs::kNTPCustomLogoStart, logo_start); - prefs_->SetReal(prefs::kNTPCustomLogoEnd, logo_end); + prefs_->SetDouble(prefs::kNTPCustomLogoStart, logo_start); + prefs_->SetDouble(prefs::kNTPCustomLogoEnd, logo_end); NotificationService* service = NotificationService::current(); service->Notify(NotificationType::WEB_RESOURCE_STATE_CHANGED, Source<WebResourceService>(this), diff --git a/chrome/browser/web_resource/web_resource_service_unittest.cc b/chrome/browser/web_resource/web_resource_service_unittest.cc index 4127a6e..cb51d9f 100644 --- a/chrome/browser/web_resource/web_resource_service_unittest.cc +++ b/chrome/browser/web_resource/web_resource_service_unittest.cc @@ -57,10 +57,10 @@ TEST_F(WebResourceServiceTest, UnpackLogoSignal) { ASSERT_TRUE(prefs != NULL); double logo_start = - prefs->GetReal(prefs::kNTPCustomLogoStart); + prefs->GetDouble(prefs::kNTPCustomLogoStart); EXPECT_EQ(logo_start, 1264899600); // unix epoch for Jan 31 2010 0100 GMT. double logo_end = - prefs->GetReal(prefs::kNTPCustomLogoEnd); + prefs->GetDouble(prefs::kNTPCustomLogoEnd); EXPECT_EQ(logo_end, 1327971600); // unix epoch for Jan 31 2012 0100 GMT. // Change the start only and recheck. @@ -85,7 +85,7 @@ TEST_F(WebResourceServiceTest, UnpackLogoSignal) { // Check that prefs are set correctly. web_resource_service->UnpackLogoSignal(*(test_json.get())); - logo_start = prefs->GetReal(prefs::kNTPCustomLogoStart); + logo_start = prefs->GetDouble(prefs::kNTPCustomLogoStart); EXPECT_EQ(logo_start, 1267365600); // date changes to Feb 28 2010 1400 GMT. // If no date is included in the prefs, reset custom logo dates to 0. @@ -103,9 +103,9 @@ TEST_F(WebResourceServiceTest, UnpackLogoSignal) { // Check that prefs are set correctly. web_resource_service->UnpackLogoSignal(*(test_json.get())); - logo_start = prefs->GetReal(prefs::kNTPCustomLogoStart); + logo_start = prefs->GetDouble(prefs::kNTPCustomLogoStart); EXPECT_EQ(logo_start, 0); // date value reset to 0; - logo_end = prefs->GetReal(prefs::kNTPCustomLogoEnd); + logo_end = prefs->GetDouble(prefs::kNTPCustomLogoEnd); EXPECT_EQ(logo_end, 0); // date value reset to 0; } @@ -160,13 +160,13 @@ TEST_F(WebResourceServiceTest, UnpackPromoSignal) { EXPECT_EQ(promo_time_slice, 2); double promo_start = - prefs->GetReal(prefs::kNTPPromoStart); + prefs->GetDouble(prefs::kNTPPromoStart); int64 actual_start = 1264899600 + // unix epoch for Jan 31 2010 0100 GMT. promo_group * 2 * 60 * 60; EXPECT_EQ(promo_start, actual_start); double promo_end = - prefs->GetReal(prefs::kNTPPromoEnd); + prefs->GetDouble(prefs::kNTPPromoEnd); EXPECT_EQ(promo_end, 1327971600); // unix epoch for Jan 31 2012 0100 GMT. } diff --git a/chrome/common/common_param_traits_unittest.cc b/chrome/common/common_param_traits_unittest.cc index 8446158..3e4311c 100644 --- a/chrome/common/common_param_traits_unittest.cc +++ b/chrome/common/common_param_traits_unittest.cc @@ -118,7 +118,7 @@ TEST(IPCMessageTest, Bitmap) { TEST(IPCMessageTest, ListValue) { ListValue input; - input.Set(0, Value::CreateRealValue(42.42)); + input.Set(0, Value::CreateDoubleValue(42.42)); input.Set(1, Value::CreateStringValue("forty")); input.Set(2, Value::CreateNullValue()); @@ -149,7 +149,7 @@ TEST(IPCMessageTest, DictionaryValue) { subdict->Set("bool", Value::CreateBooleanValue(false)); scoped_ptr<ListValue> sublist(new ListValue()); - sublist->Set(0, Value::CreateRealValue(42.42)); + sublist->Set(0, Value::CreateDoubleValue(42.42)); sublist->Set(1, Value::CreateStringValue("forty")); sublist->Set(2, Value::CreateStringValue("two")); subdict->Set("list", sublist.release()); diff --git a/chrome/common/extensions/extension.cc b/chrome/common/extensions/extension.cc index 76215e4..90b2c3a 100644 --- a/chrome/common/extensions/extension.cc +++ b/chrome/common/extensions/extension.cc @@ -1493,7 +1493,7 @@ bool Extension::InitFromValue(const DictionaryValue& source, bool require_key, ((color_list->GetSize() != 3) && ((color_list->GetSize() != 4) || // For RGBA, the fourth item must be a real or int alpha value - (!color_list->GetReal(3, &alpha) && + (!color_list->GetDouble(3, &alpha) && !color_list->GetInteger(3, &alpha_int)))) || // For both RGB and RGBA, the first three items must be ints (R,G,B) !color_list->GetInteger(0, &color) || @@ -1516,9 +1516,9 @@ bool Extension::InitFromValue(const DictionaryValue& source, bool require_key, int vi; if (!tints_value->GetListWithoutPathExpansion(*iter, &tint_list) || tint_list->GetSize() != 3 || - !(tint_list->GetReal(0, &v) || tint_list->GetInteger(0, &vi)) || - !(tint_list->GetReal(1, &v) || tint_list->GetInteger(1, &vi)) || - !(tint_list->GetReal(2, &v) || tint_list->GetInteger(2, &vi))) { + !(tint_list->GetDouble(0, &v) || tint_list->GetInteger(0, &vi)) || + !(tint_list->GetDouble(1, &v) || tint_list->GetInteger(1, &vi)) || + !(tint_list->GetDouble(2, &v) || tint_list->GetInteger(2, &vi))) { *error = errors::kInvalidThemeTints; return false; } diff --git a/chrome/common/json_schema_validator.cc b/chrome/common/json_schema_validator.cc index 7d43543..7da218f 100644 --- a/chrome/common/json_schema_validator.cc +++ b/chrome/common/json_schema_validator.cc @@ -16,7 +16,7 @@ namespace { double GetNumberValue(Value* value) { double result = 0; - if (value->GetAsReal(&result)) + if (value->GetAsDouble(&result)) return result; int int_result = 0; @@ -30,7 +30,7 @@ double GetNumberValue(Value* value) { bool GetNumberFromDictionary(DictionaryValue* value, const std::string& key, double* number) { - if (value->GetReal(key, number)) + if (value->GetDouble(key, number)) return true; int int_value = 0; @@ -97,9 +97,9 @@ std::string JSONSchemaValidator::GetJSONSchemaType(Value* value) { return "boolean"; case Value::TYPE_INTEGER: return "integer"; - case Value::TYPE_REAL: { + case Value::TYPE_DOUBLE: { double double_value = 0; - value->GetAsReal(&double_value); + value->GetAsDouble(&double_value); if (std::abs(double_value) <= std::pow(2.0, DBL_MANT_DIG) && double_value == floor(double_value)) { return "integer"; @@ -269,9 +269,9 @@ void JSONSchemaValidator::ValidateEnum(Value* instance, break; case Value::TYPE_INTEGER: - case Value::TYPE_REAL: + case Value::TYPE_DOUBLE: if (instance->IsType(Value::TYPE_INTEGER) || - instance->IsType(Value::TYPE_REAL)) { + instance->IsType(Value::TYPE_DOUBLE)) { if (GetNumberValue(choice) == GetNumberValue(instance)) return; } diff --git a/chrome/common/json_schema_validator_unittest_base.cc b/chrome/common/json_schema_validator_unittest_base.cc index 782d6bc..6d2c1bb 100644 --- a/chrome/common/json_schema_validator_unittest_base.cc +++ b/chrome/common/json_schema_validator_unittest_base.cc @@ -441,18 +441,18 @@ void JSONSchemaValidatorTestBase::TestNumber() { scoped_ptr<Value>(Value::CreateIntegerValue(100)).get(), schema.get(), NULL); ExpectValid(TEST_SOURCE, - scoped_ptr<Value>(Value::CreateRealValue(88.88)).get(), + scoped_ptr<Value>(Value::CreateDoubleValue(88.88)).get(), schema.get(), NULL); ExpectNotValid( TEST_SOURCE, - scoped_ptr<Value>(Value::CreateRealValue(0.5)).get(), + scoped_ptr<Value>(Value::CreateDoubleValue(0.5)).get(), schema.get(), NULL, "", JSONSchemaValidator::FormatErrorMessage( JSONSchemaValidator::kNumberMinimum, "1")); ExpectNotValid( TEST_SOURCE, - scoped_ptr<Value>(Value::CreateRealValue(100.1)).get(), + scoped_ptr<Value>(Value::CreateDoubleValue(100.1)).get(), schema.get(), NULL, "", JSONSchemaValidator::FormatErrorMessage( JSONSchemaValidator::kNumberMaximum, "100")); @@ -472,23 +472,23 @@ void JSONSchemaValidatorTestBase::TestTypeClassifier() { EXPECT_EQ("integer", JSONSchemaValidator::GetJSONSchemaType( scoped_ptr<Value>(Value::CreateIntegerValue(0)).get())); EXPECT_EQ("integer", JSONSchemaValidator::GetJSONSchemaType( - scoped_ptr<Value>(Value::CreateRealValue(42)).get())); + scoped_ptr<Value>(Value::CreateDoubleValue(42)).get())); EXPECT_EQ("integer", JSONSchemaValidator::GetJSONSchemaType( scoped_ptr<Value>( - Value::CreateRealValue(pow(2.0, DBL_MANT_DIG))).get())); + Value::CreateDoubleValue(pow(2.0, DBL_MANT_DIG))).get())); EXPECT_EQ("integer", JSONSchemaValidator::GetJSONSchemaType( scoped_ptr<Value>( - Value::CreateRealValue(pow(-2.0, DBL_MANT_DIG))).get())); + Value::CreateDoubleValue(pow(-2.0, DBL_MANT_DIG))).get())); // "number" is only used for non-integral numbers, or numbers beyond what // double can accurately represent. EXPECT_EQ("number", JSONSchemaValidator::GetJSONSchemaType( - scoped_ptr<Value>(Value::CreateRealValue(88.8)).get())); + scoped_ptr<Value>(Value::CreateDoubleValue(88.8)).get())); EXPECT_EQ("number", JSONSchemaValidator::GetJSONSchemaType( - scoped_ptr<Value>(Value::CreateRealValue( + scoped_ptr<Value>(Value::CreateDoubleValue( pow(2.0, DBL_MANT_DIG) * 2)).get())); EXPECT_EQ("number", JSONSchemaValidator::GetJSONSchemaType( - scoped_ptr<Value>(Value::CreateRealValue( + scoped_ptr<Value>(Value::CreateDoubleValue( pow(-2.0, DBL_MANT_DIG) * 2)).get())); EXPECT_EQ("string", JSONSchemaValidator::GetJSONSchemaType( @@ -520,10 +520,10 @@ void JSONSchemaValidatorTestBase::TestTypes() { schema->SetString("type", "number"); ExpectValid(TEST_SOURCE, - scoped_ptr<Value>(Value::CreateRealValue(88.8)).get(), + scoped_ptr<Value>(Value::CreateDoubleValue(88.8)).get(), schema.get(), NULL); ExpectValid(TEST_SOURCE, - scoped_ptr<Value>(Value::CreateRealValue(42)).get(), + scoped_ptr<Value>(Value::CreateDoubleValue(42)).get(), schema.get(), NULL); ExpectValid(TEST_SOURCE, scoped_ptr<Value>(Value::CreateIntegerValue(42)).get(), @@ -537,18 +537,18 @@ void JSONSchemaValidatorTestBase::TestTypes() { scoped_ptr<Value>(Value::CreateIntegerValue(42)).get(), schema.get(), NULL); ExpectValid(TEST_SOURCE, - scoped_ptr<Value>(Value::CreateRealValue(42)).get(), + scoped_ptr<Value>(Value::CreateDoubleValue(42)).get(), schema.get(), NULL); ExpectValid(TEST_SOURCE, scoped_ptr<Value>(Value::CreateIntegerValue(0)).get(), schema.get(), NULL); ExpectValid(TEST_SOURCE, scoped_ptr<Value>( - Value::CreateRealValue(pow(2.0, DBL_MANT_DIG))).get(), + Value::CreateDoubleValue(pow(2.0, DBL_MANT_DIG))).get(), schema.get(), NULL); ExpectValid(TEST_SOURCE, scoped_ptr<Value>( - Value::CreateRealValue(pow(-2.0, DBL_MANT_DIG))).get(), + Value::CreateDoubleValue(pow(-2.0, DBL_MANT_DIG))).get(), schema.get(), NULL); schema->SetString("type", "boolean"); @@ -600,14 +600,14 @@ void JSONSchemaValidatorTestBase::TestTypes() { schema->SetString("type", "integer"); ExpectNotValid(TEST_SOURCE, - scoped_ptr<Value>(Value::CreateRealValue(88.8)).get(), + scoped_ptr<Value>(Value::CreateDoubleValue(88.8)).get(), schema.get(), NULL, "", JSONSchemaValidator::FormatErrorMessage( JSONSchemaValidator::kInvalidType, "integer", "number")); schema->SetString("type", "integer"); ExpectNotValid(TEST_SOURCE, - scoped_ptr<Value>(Value::CreateRealValue(88.8)).get(), + scoped_ptr<Value>(Value::CreateDoubleValue(88.8)).get(), schema.get(), NULL, "", JSONSchemaValidator::FormatErrorMessage( JSONSchemaValidator::kInvalidType, "integer", "number")); diff --git a/chrome/common/json_value_serializer_unittest.cc b/chrome/common/json_value_serializer_unittest.cc index b3f3e0d..d1b83c4 100644 --- a/chrome/common/json_value_serializer_unittest.cc +++ b/chrome/common/json_value_serializer_unittest.cc @@ -17,7 +17,7 @@ TEST(JSONValueSerializerTest, Roundtrip) { const std::string original_serialization = - "{\"bool\":true,\"int\":42,\"list\":[1,2],\"null\":null,\"real\":3.14}"; + "{\"bool\":true,\"int\":42,\"list\":[1,2],\"null\":null,\"double\":3.14}"; JSONStringValueSerializer serializer(original_serialization); scoped_ptr<Value> root(serializer.Deserialize(NULL, NULL)); ASSERT_TRUE(root.get()); @@ -38,9 +38,9 @@ TEST(JSONValueSerializerTest, Roundtrip) { ASSERT_TRUE(root_dict->GetInteger("int", &int_value)); ASSERT_EQ(42, int_value); - double real_value = 0.0; - ASSERT_TRUE(root_dict->GetReal("real", &real_value)); - ASSERT_DOUBLE_EQ(3.14, real_value); + double double_value = 0.0; + ASSERT_TRUE(root_dict->GetDouble("double", &double_value)); + ASSERT_DOUBLE_EQ(3.14, double_value); // We shouldn't be able to write using this serializer, since it was // initialized with a const string. @@ -66,7 +66,7 @@ TEST(JSONValueSerializerTest, Roundtrip) { " \"int\": 42," JSON_NEWLINE " \"list\": [ 1, 2 ]," JSON_NEWLINE " \"null\": null," JSON_NEWLINE - " \"real\": 3.14" JSON_NEWLINE + " \"double\": 3.14" JSON_NEWLINE "}" JSON_NEWLINE; #undef JSON_NEWLINE ASSERT_EQ(pretty_serialization, test_serialization); diff --git a/chrome/renderer/dom_ui_bindings.cc b/chrome/renderer/dom_ui_bindings.cc index e3a6a4c..a938f03 100644 --- a/chrome/renderer/dom_ui_bindings.cc +++ b/chrome/renderer/dom_ui_bindings.cc @@ -21,7 +21,7 @@ Value* CreateValueFromCppVariant(const CppVariant& value) { if (value.isBool()) return Value::CreateBooleanValue(value.ToBoolean()); if (value.isDouble()) - return Value::CreateRealValue(value.ToDouble()); + return Value::CreateDoubleValue(value.ToDouble()); if (value.isInt32()) return Value::CreateIntegerValue(value.ToInt32()); if (value.isString()) diff --git a/chrome/renderer/extensions/renderer_extension_bindings.cc b/chrome/renderer/extensions/renderer_extension_bindings.cc index ab7a8eb..8b40f85 100644 --- a/chrome/renderer/extensions/renderer_extension_bindings.cc +++ b/chrome/renderer/extensions/renderer_extension_bindings.cc @@ -269,9 +269,9 @@ static std::vector< v8::Handle<v8::Value> > ListValueToV8( v8_values.push_back(v8::Integer::New(val)); break; } - case Value::TYPE_REAL: { + case Value::TYPE_DOUBLE: { double val; - elem->GetAsReal(&val); + elem->GetAsDouble(&val); v8_values.push_back(v8::Number::New(val)); break; } diff --git a/chrome/renderer/render_view.cc b/chrome/renderer/render_view.cc index 25e3544..dc045e9 100644 --- a/chrome/renderer/render_view.cc +++ b/chrome/renderer/render_view.cc @@ -484,8 +484,8 @@ static bool WebAccessibilityNotificationToViewHostMsg( // Conversion for the incoming value. The map isn't perfect; v8 has Uint32, // and int64 which don't fit as Value::TYPE_INTEGER, so we let them fall into -// being TYPE_REALs. Dates are converted to a string (which can then be parsed -// into a base::Time), as are regexps. Arrays are converted into lists, +// being TYPE_DOUBLEs. Dates are converted to a string (which can then be +// parsed into a base::Time), as are regexps. Arrays are converted into lists, // recursively. We don't deal with binary objects or functions - they become // null values. static Value* ConvertV8Value(const v8::Handle<v8::Value>& v8value) { @@ -494,12 +494,12 @@ static Value* ConvertV8Value(const v8::Handle<v8::Value>& v8value) { } else if (v8value->IsInt32()) { return Value::CreateIntegerValue(v8value->Int32Value()); } else if (v8value->IsNumber()) { - return Value::CreateRealValue(v8value->NumberValue()); + return Value::CreateDoubleValue(v8value->NumberValue()); } else if (v8value->IsString()) { return Value::CreateStringValue(*v8::String::Utf8Value(v8value)); } else if (v8value->IsDate()) { v8::Date* date = v8::Date::Cast(*v8value); - return Value::CreateRealValue(date->NumberValue() / 1000.0); + return Value::CreateDoubleValue(date->NumberValue() / 1000.0); } else if (v8value->IsRegExp()) { return Value::CreateStringValue( *v8::String::Utf8Value(v8value->ToString())); diff --git a/chrome/test/automation/browser_proxy.cc b/chrome/test/automation/browser_proxy.cc index 9ba3057..c91025d 100644 --- a/chrome/test/automation/browser_proxy.cc +++ b/chrome/test/automation/browser_proxy.cc @@ -628,11 +628,11 @@ bool BrowserProxy::GetInitialLoadTimes(float* min_start_time, tab_dict = static_cast<DictionaryValue*>(tab_value); double temp; - if (!tab_dict->GetReal("load_start_ms", &temp)) + if (!tab_dict->GetDouble("load_start_ms", &temp)) return false; start_ms = static_cast<float>(temp); // load_stop_ms can only be null if WaitForInitialLoads did not run. - if (!tab_dict->GetReal("load_stop_ms", &temp)) + if (!tab_dict->GetDouble("load_stop_ms", &temp)) return false; stop_ms = static_cast<float>(temp); diff --git a/chrome/test/webdriver/utility_functions.cc b/chrome/test/webdriver/utility_functions.cc index 54e5ae8..4d6975f 100644 --- a/chrome/test/webdriver/utility_functions.cc +++ b/chrome/test/webdriver/utility_functions.cc @@ -35,8 +35,8 @@ std::wstring print_valuetype(Value::ValueType e) { return L"BOOL"; case Value::TYPE_INTEGER: return L"INT"; - case Value::TYPE_REAL: - return L"REAL"; + case Value::TYPE_DOUBLE: + return L"DOUBLE"; case Value::TYPE_STRING: return L"STRING"; case Value::TYPE_BINARY: |