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/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/memory/ref_counted_memory.h" | 8 #include "base/memory/ref_counted_memory.h" |
9 #include "base/string16.h" | 9 #include "base/string16.h" |
10 #include "base/string_piece.h" | 10 #include "base/string_piece.h" |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 // Show the profile name in the title and most visited labels if the current | 63 // Show the profile name in the title and most visited labels if the current |
64 // profile is not the default. | 64 // profile is not the default. |
65 DictionaryValue localized_strings; | 65 DictionaryValue localized_strings; |
66 localized_strings.SetBoolean("hasattribution", false); | 66 localized_strings.SetBoolean("hasattribution", false); |
67 localized_strings.SetString("title", | 67 localized_strings.SetString("title", |
68 l10n_util::GetStringUTF16(IDS_NEW_TAB_TITLE)); | 68 l10n_util::GetStringUTF16(IDS_NEW_TAB_TITLE)); |
69 localized_strings.SetString("mostvisited", | 69 localized_strings.SetString("mostvisited", |
70 l10n_util::GetStringUTF16(IDS_NEW_TAB_MOST_VISITED)); | 70 l10n_util::GetStringUTF16(IDS_NEW_TAB_MOST_VISITED)); |
71 localized_strings.SetString("recentlyclosed", | 71 localized_strings.SetString("recentlyclosed", |
72 l10n_util::GetStringUTF16(IDS_NEW_TAB_RECENTLY_CLOSED)); | 72 l10n_util::GetStringUTF16(IDS_NEW_TAB_RECENTLY_CLOSED)); |
| 73 localized_strings.SetString("opentabslastsynced", |
| 74 l10n_util::GetStringUTF16(IDS_SYNC_NTP_OPEN_TABS_LAST_SYNCED)); |
| 75 localized_strings.SetString("elementopeninnewtab", |
| 76 l10n_util::GetStringUTF16(IDS_NEW_TAB_CONTEXT_MENU_OPEN_IN_NEW_TAB)); |
| 77 localized_strings.SetString("elementopeninincognitotab", |
| 78 l10n_util::GetStringUTF16( |
| 79 IDS_NEW_TAB_CONTEXT_MENU_OPEN_IN_INCOGNITO_TAB)); |
| 80 localized_strings.SetString("elementremove", |
| 81 l10n_util::GetStringUTF16(IDS_NEW_TAB_CONTEXT_MENU_REMOVE)); |
| 82 localized_strings.SetString("bookmarkedit", |
| 83 l10n_util::GetStringUTF16(IDS_NEW_TAB_CONTEXT_MENU_EDIT_BOOKMARK)); |
| 84 localized_strings.SetString("bookmarkdelete", |
| 85 l10n_util::GetStringUTF16(IDS_NEW_TAB_CONTEXT_MENU_DELETE_BOOKMARK)); |
| 86 localized_strings.SetString("bookmarkshortcut", |
| 87 l10n_util::GetStringUTF16(IDS_NEW_TAB_CONTEXT_MENU_BOOKMARK_SHORTCUT)); |
| 88 localized_strings.SetString("editfolder", |
| 89 l10n_util::GetStringUTF16(IDS_BOOKMARK_EDIT_FOLDER)); |
| 90 localized_strings.SetString("deletefolder", |
| 91 l10n_util::GetStringUTF16(IDS_BOOKMARK_REMOVE_FOLDER)); |
| 92 localized_strings.SetString("receivedDocuments", |
| 93 l10n_util::GetStringUTF16(IDS_RECEIVED_DOCUMENTS)); |
| 94 localized_strings.SetString("syncPromo", |
| 95 l10n_util::GetStringUTF16(IDS_SYNC_PROMO_DESKTOP_INSTRUCTIONS)); |
| 96 localized_strings.SetString("syncEnableSync", |
| 97 l10n_util::GetStringUTF16(IDS_SYNC_ENABLE_SYNC)); |
| 98 localized_strings.SetString("bookmarkstitle", |
| 99 l10n_util::GetStringUTF16(IDS_ACCNAME_BOOKMARKS)); |
73 | 100 |
74 NewTabPageHandler::GetLocalizedValues(profile_, &localized_strings); | 101 NewTabPageHandler::GetLocalizedValues(profile_, &localized_strings); |
75 | 102 |
76 ChromeURLDataManager::DataSource::SetFontAndTextDirection(&localized_strings); | 103 ChromeURLDataManager::DataSource::SetFontAndTextDirection(&localized_strings); |
77 | 104 |
78 base::StringPiece new_tab_html(ResourceBundle::GetSharedInstance(). | 105 base::StringPiece new_tab_html(ResourceBundle::GetSharedInstance(). |
79 GetRawDataResource(IDR_NEW_TAB_4_HTML, | 106 GetRawDataResource(IDR_NEW_TAB_ANDROID_HTML, |
80 ui::SCALE_FACTOR_NONE)); | 107 ui::SCALE_FACTOR_NONE)); |
81 localized_strings.SetString( | 108 localized_strings.SetString( |
82 "device", | 109 "device", |
83 CommandLine::ForCurrentProcess()->HasSwitch(switches::kTabletUI) ? | 110 CommandLine::ForCurrentProcess()->HasSwitch(switches::kTabletUI) ? |
84 "tablet" : "phone"); | 111 "tablet" : "phone"); |
85 const char* new_tab_link = kLearnMoreIncognitoUrl; | 112 const char* new_tab_link = kLearnMoreIncognitoUrl; |
86 string16 learnMoreLink = ASCIIToUTF16( | 113 string16 learnMoreLink = ASCIIToUTF16( |
87 google_util::AppendGoogleLocaleParam(GURL(new_tab_link)).spec()); | 114 google_util::AppendGoogleLocaleParam(GURL(new_tab_link)).spec()); |
88 localized_strings.SetString("content", | 115 localized_strings.SetString("content", |
89 l10n_util::GetStringFUTF16(IDS_NEW_TAB_OTR_MESSAGE, learnMoreLink)); | 116 l10n_util::GetStringFUTF16(IDS_NEW_TAB_OTR_MESSAGE, learnMoreLink)); |
(...skipping 16 matching lines...) Expand all Loading... |
106 size_t after_offset = pos + template_data_placeholder.size(); | 133 size_t after_offset = pos + template_data_placeholder.size(); |
107 full_html.append(new_tab_html.data() + after_offset, | 134 full_html.append(new_tab_html.data() + after_offset, |
108 new_tab_html.size() - after_offset); | 135 new_tab_html.size() - after_offset); |
109 } else { | 136 } else { |
110 NOTREACHED(); | 137 NOTREACHED(); |
111 full_html.assign(new_tab_html.data(), new_tab_html.size()); | 138 full_html.assign(new_tab_html.data(), new_tab_html.size()); |
112 } | 139 } |
113 | 140 |
114 new_tab_html_ = base::RefCountedString::TakeString(&full_html); | 141 new_tab_html_ = base::RefCountedString::TakeString(&full_html); |
115 } | 142 } |
OLD | NEW |