| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/ntp/ntp_resource_cache.h" | 5 #include "chrome/browser/ui/webui/ntp/ntp_resource_cache.h" |
| 6 | 6 |
| 7 #include "base/string16.h" | 7 #include "base/string16.h" |
| 8 #include "base/string_piece.h" | 8 #include "base/string_piece.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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 const content::NotificationDetails& details) { | 53 const content::NotificationDetails& details) { |
| 54 // No notifications necessary in Android. | 54 // No notifications necessary in Android. |
| 55 } | 55 } |
| 56 | 56 |
| 57 void NTPResourceCache::CreateNewTabHTML() { | 57 void NTPResourceCache::CreateNewTabHTML() { |
| 58 // TODO(estade): these strings should be defined in their relevant handlers | 58 // TODO(estade): these strings should be defined in their relevant handlers |
| 59 // (in GetLocalizedValues) and should have more legible names. | 59 // (in GetLocalizedValues) and should have more legible names. |
| 60 // Show the profile name in the title and most visited labels if the current | 60 // Show the profile name in the title and most visited labels if the current |
| 61 // profile is not the default. | 61 // profile is not the default. |
| 62 DictionaryValue localized_strings; | 62 DictionaryValue localized_strings; |
| 63 localized_strings.SetString("hasattribution", "false"); | 63 localized_strings.SetBoolean("hasattribution", false); |
| 64 localized_strings.SetString("title", | 64 localized_strings.SetString("title", |
| 65 l10n_util::GetStringUTF16(IDS_NEW_TAB_TITLE)); | 65 l10n_util::GetStringUTF16(IDS_NEW_TAB_TITLE)); |
| 66 localized_strings.SetString("mostvisited", | 66 localized_strings.SetString("mostvisited", |
| 67 l10n_util::GetStringUTF16(IDS_NEW_TAB_MOST_VISITED)); | 67 l10n_util::GetStringUTF16(IDS_NEW_TAB_MOST_VISITED)); |
| 68 localized_strings.SetString("recentlyclosed", | 68 localized_strings.SetString("recentlyclosed", |
| 69 l10n_util::GetStringUTF16(IDS_NEW_TAB_RECENTLY_CLOSED)); | 69 l10n_util::GetStringUTF16(IDS_NEW_TAB_RECENTLY_CLOSED)); |
| 70 | 70 |
| 71 NewTabPageHandler::GetLocalizedValues(profile_, &localized_strings); | 71 NewTabPageHandler::GetLocalizedValues(profile_, &localized_strings); |
| 72 | 72 |
| 73 ChromeURLDataManager::DataSource::SetFontAndTextDirection(&localized_strings); | 73 ChromeURLDataManager::DataSource::SetFontAndTextDirection(&localized_strings); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 99 size_t after_offset = pos + template_data_placeholder.size(); | 99 size_t after_offset = pos + template_data_placeholder.size(); |
| 100 full_html.append(new_tab_html.data() + after_offset, | 100 full_html.append(new_tab_html.data() + after_offset, |
| 101 new_tab_html.size() - after_offset); | 101 new_tab_html.size() - after_offset); |
| 102 } else { | 102 } else { |
| 103 NOTREACHED(); | 103 NOTREACHED(); |
| 104 full_html.assign(new_tab_html.data(), new_tab_html.size()); | 104 full_html.assign(new_tab_html.data(), new_tab_html.size()); |
| 105 } | 105 } |
| 106 | 106 |
| 107 new_tab_html_ = base::RefCountedString::TakeString(&full_html); | 107 new_tab_html_ = base::RefCountedString::TakeString(&full_html); |
| 108 } | 108 } |
| OLD | NEW |