OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 <string> | 5 #include <string> |
6 | 6 |
7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 list_value.Append(tip_dict); | 92 list_value.Append(tip_dict); |
93 tips_cache_->SetInteger(WebResourceService::kCurrentTipPrefName, | 93 tips_cache_->SetInteger(WebResourceService::kCurrentTipPrefName, |
94 tip_index); | 94 tip_index); |
95 // Send list of web resource items back out to the DOM. | 95 // Send list of web resource items back out to the DOM. |
96 dom_ui_->CallJavascriptFunction(L"tips", list_value); | 96 dom_ui_->CallJavascriptFunction(L"tips", list_value); |
97 } | 97 } |
98 | 98 |
99 // static | 99 // static |
100 void TipsHandler::RegisterUserPrefs(PrefService* prefs) { | 100 void TipsHandler::RegisterUserPrefs(PrefService* prefs) { |
101 prefs->RegisterDictionaryPref(prefs::kNTPWebResourceCache); | 101 prefs->RegisterDictionaryPref(prefs::kNTPWebResourceCache); |
102 prefs->RegisterStringPref(prefs::kNTPLogoResourceServer, | 102 prefs->RegisterStringPref(prefs::kNTPWebResourceServer, |
103 WebResourceService::kDefaultResourceServer); | 103 WebResourceService::kDefaultWebResourceServer); |
104 } | 104 } |
105 | 105 |
106 bool TipsHandler::IsValidURL(const std::wstring& url_string) { | 106 bool TipsHandler::IsValidURL(const std::wstring& url_string) { |
107 GURL url(WideToUTF8(url_string)); | 107 GURL url(WideToUTF8(url_string)); |
108 return !url.is_empty() && (url.SchemeIs(chrome::kHttpScheme) || | 108 return !url.is_empty() && (url.SchemeIs(chrome::kHttpScheme) || |
109 url.SchemeIs(chrome::kHttpsScheme)); | 109 url.SchemeIs(chrome::kHttpsScheme)); |
110 } | 110 } |
OLD | NEW |