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

Side by Side Diff: chrome/browser/ui/webui/options/automatic_settings_reset_handler.cc

Issue 1995113002: Rename WebUI::CallJavascriptFunction to WebUI::CallJavascriptFunctionUnsafe (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 // 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/macros.h" 9 #include "base/macros.h"
10 #include "base/time/time.h" 10 #include "base/time/time.h"
(...skipping 19 matching lines...) Expand all
30 AutomaticSettingsResetHandler::~AutomaticSettingsResetHandler() {} 30 AutomaticSettingsResetHandler::~AutomaticSettingsResetHandler() {}
31 31
32 void AutomaticSettingsResetHandler::InitializePage() { 32 void AutomaticSettingsResetHandler::InitializePage() {
33 static const int kBannerShowTimeInDays = 5; 33 static const int kBannerShowTimeInDays = 5;
34 34
35 const base::Time then = 35 const base::Time then =
36 chrome_prefs::GetResetTime(Profile::FromWebUI(web_ui())); 36 chrome_prefs::GetResetTime(Profile::FromWebUI(web_ui()));
37 if (!then.is_null()) { 37 if (!then.is_null()) {
38 const base::Time now = base::Time::Now(); 38 const base::Time now = base::Time::Now();
39 if ((now - then).InDays() < kBannerShowTimeInDays) 39 if ((now - then).InDays() < kBannerShowTimeInDays)
40 web_ui()->CallJavascriptFunction("AutomaticSettingsResetBanner.show"); 40 web_ui()->CallJavascriptFunctionUnsafe(
41 "AutomaticSettingsResetBanner.show");
41 } 42 }
42 } 43 }
43 44
44 void AutomaticSettingsResetHandler::GetLocalizedValues( 45 void AutomaticSettingsResetHandler::GetLocalizedValues(
45 base::DictionaryValue* localized_strings) { 46 base::DictionaryValue* localized_strings) {
46 DCHECK(localized_strings); 47 DCHECK(localized_strings);
47 48
48 static const OptionsStringResource resources[] = { 49 static const OptionsStringResource resources[] = {
49 { "automaticSettingsResetBannerResetButtonText", 50 { "automaticSettingsResetBannerResetButtonText",
50 IDS_AUTOMATIC_SETTINGS_RESET_BANNER_RESET_BUTTON_TEXT }, 51 IDS_AUTOMATIC_SETTINGS_RESET_BANNER_RESET_BUTTON_TEXT },
(...skipping 10 matching lines...) Expand all
61 } 62 }
62 63
63 void AutomaticSettingsResetHandler::RegisterMessages() { 64 void AutomaticSettingsResetHandler::RegisterMessages() {
64 web_ui()->RegisterMessageCallback( 65 web_ui()->RegisterMessageCallback(
65 "onDismissedAutomaticSettingsResetBanner", 66 "onDismissedAutomaticSettingsResetBanner",
66 base::Bind(&OnDismissedAutomaticSettingsResetBanner, 67 base::Bind(&OnDismissedAutomaticSettingsResetBanner,
67 Profile::FromWebUI(web_ui()))); 68 Profile::FromWebUI(web_ui())));
68 } 69 }
69 70
70 } // namespace options 71 } // namespace options
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698