| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/ui/webui/options/automatic_settings_reset_handler.h" | 5 #include "chrome/browser/ui/webui/options/automatic_settings_reset_handler.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/time/time.h" | 9 #include "base/time/time.h" |
| 10 #include "chrome/browser/prefs/chrome_pref_service_factory.h" | 10 #include "chrome/browser/prefs/chrome_pref_service_factory.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 if ((now - then).InDays() < kBannerShowTimeInDays) | 37 if ((now - then).InDays() < kBannerShowTimeInDays) |
| 38 web_ui()->CallJavascriptFunction("AutomaticSettingsResetBanner.show"); | 38 web_ui()->CallJavascriptFunction("AutomaticSettingsResetBanner.show"); |
| 39 } | 39 } |
| 40 } | 40 } |
| 41 | 41 |
| 42 void AutomaticSettingsResetHandler::GetLocalizedValues( | 42 void AutomaticSettingsResetHandler::GetLocalizedValues( |
| 43 base::DictionaryValue* localized_strings) { | 43 base::DictionaryValue* localized_strings) { |
| 44 DCHECK(localized_strings); | 44 DCHECK(localized_strings); |
| 45 | 45 |
| 46 static const OptionsStringResource resources[] = { | 46 static const OptionsStringResource resources[] = { |
| 47 { "automaticSettingsResetBannerResetButtonText", |
| 48 IDS_AUTOMATIC_SETTINGS_RESET_BANNER_RESET_BUTTON_TEXT }, |
| 47 { "automaticSettingsResetBannerText", | 49 { "automaticSettingsResetBannerText", |
| 48 IDS_AUTOMATIC_SETTINGS_RESET_BANNER_TEXT }, | 50 IDS_AUTOMATIC_SETTINGS_RESET_BANNER_TEXT }, |
| 49 { "automaticSettingsResetLearnMoreUrl", | 51 { "automaticSettingsResetLearnMoreUrl", |
| 50 IDS_LEARN_MORE }, | 52 IDS_LEARN_MORE }, |
| 51 }; | 53 }; |
| 52 | 54 |
| 53 RegisterStrings(localized_strings, resources, arraysize(resources)); | 55 RegisterStrings(localized_strings, resources, arraysize(resources)); |
| 54 localized_strings->SetString( | 56 localized_strings->SetString( |
| 55 "automaticSettingsResetLearnMoreUrl", | 57 "automaticSettingsResetLearnMoreUrl", |
| 56 chrome::kAutomaticSettingsResetLearnMoreURL); | 58 chrome::kAutomaticSettingsResetLearnMoreURL); |
| 57 } | 59 } |
| 58 | 60 |
| 59 void AutomaticSettingsResetHandler::RegisterMessages() { | 61 void AutomaticSettingsResetHandler::RegisterMessages() { |
| 60 web_ui()->RegisterMessageCallback( | 62 web_ui()->RegisterMessageCallback( |
| 61 "onDismissedAutomaticSettingsResetBanner", | 63 "onDismissedAutomaticSettingsResetBanner", |
| 62 base::Bind(&OnDismissedAutomaticSettingsResetBanner, | 64 base::Bind(&OnDismissedAutomaticSettingsResetBanner, |
| 63 Profile::FromWebUI(web_ui()))); | 65 Profile::FromWebUI(web_ui()))); |
| 64 } | 66 } |
| 65 | 67 |
| 66 } // namespace options | 68 } // namespace options |
| OLD | NEW |