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" |
11 #include "base/utf_string_conversions.h" | 11 #include "base/utf_string_conversions.h" |
12 #include "base/values.h" | 12 #include "base/values.h" |
13 #include "chrome/browser/google/google_util.h" | 13 #include "chrome/browser/google/google_util.h" |
14 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
15 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" | 15 #include "chrome/browser/ui/webui/web_ui_util.h" |
16 #include "chrome/common/chrome_switches.h" | 16 #include "chrome/common/chrome_switches.h" |
17 #include "chrome/common/jstemplate_builder.h" | 17 #include "chrome/common/jstemplate_builder.h" |
18 #include "content/public/browser/browser_thread.h" | 18 #include "content/public/browser/browser_thread.h" |
19 #include "content/public/browser/notification_service.h" | 19 #include "content/public/browser/notification_service.h" |
20 #include "grit/browser_resources.h" | 20 #include "grit/browser_resources.h" |
21 #include "grit/generated_resources.h" | 21 #include "grit/generated_resources.h" |
22 #include "ui/base/l10n/l10n_util.h" | 22 #include "ui/base/l10n/l10n_util.h" |
23 #include "ui/base/resource/resource_bundle.h" | 23 #include "ui/base/resource/resource_bundle.h" |
24 | 24 |
25 using content::BrowserThread; | 25 using content::BrowserThread; |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 l10n_util::GetStringUTF16(IDS_BOOKMARK_REMOVE_FOLDER)); | 95 l10n_util::GetStringUTF16(IDS_BOOKMARK_REMOVE_FOLDER)); |
96 localized_strings.SetString("receivedDocuments", | 96 localized_strings.SetString("receivedDocuments", |
97 l10n_util::GetStringUTF16(IDS_RECEIVED_DOCUMENTS)); | 97 l10n_util::GetStringUTF16(IDS_RECEIVED_DOCUMENTS)); |
98 localized_strings.SetString("syncPromo", | 98 localized_strings.SetString("syncPromo", |
99 l10n_util::GetStringUTF16(IDS_SYNC_PROMO_DESKTOP_INSTRUCTIONS)); | 99 l10n_util::GetStringUTF16(IDS_SYNC_PROMO_DESKTOP_INSTRUCTIONS)); |
100 localized_strings.SetString("syncEnableSync", | 100 localized_strings.SetString("syncEnableSync", |
101 l10n_util::GetStringUTF16(IDS_SYNC_ENABLE_SYNC)); | 101 l10n_util::GetStringUTF16(IDS_SYNC_ENABLE_SYNC)); |
102 localized_strings.SetString("bookmarkstitle", | 102 localized_strings.SetString("bookmarkstitle", |
103 l10n_util::GetStringUTF16(IDS_ACCNAME_BOOKMARKS)); | 103 l10n_util::GetStringUTF16(IDS_ACCNAME_BOOKMARKS)); |
104 | 104 |
105 URLDataSource::SetFontAndTextDirection(&localized_strings); | 105 web_ui_util::SetFontAndTextDirection(&localized_strings); |
106 | 106 |
107 base::StringPiece new_tab_html(ResourceBundle::GetSharedInstance(). | 107 base::StringPiece new_tab_html(ResourceBundle::GetSharedInstance(). |
108 GetRawDataResource(IDR_NEW_TAB_ANDROID_HTML)); | 108 GetRawDataResource(IDR_NEW_TAB_ANDROID_HTML)); |
109 localized_strings.SetString( | 109 localized_strings.SetString( |
110 "device", | 110 "device", |
111 CommandLine::ForCurrentProcess()->HasSwitch(switches::kTabletUI) ? | 111 CommandLine::ForCurrentProcess()->HasSwitch(switches::kTabletUI) ? |
112 "tablet" : "phone"); | 112 "tablet" : "phone"); |
113 const char* new_tab_link = kLearnMoreIncognitoUrl; | 113 const char* new_tab_link = kLearnMoreIncognitoUrl; |
114 string16 learnMoreLink = ASCIIToUTF16( | 114 string16 learnMoreLink = ASCIIToUTF16( |
115 google_util::AppendGoogleLocaleParam(GURL(new_tab_link)).spec()); | 115 google_util::AppendGoogleLocaleParam(GURL(new_tab_link)).spec()); |
(...skipping 19 matching lines...) Expand all Loading... |
135 size_t after_offset = pos + template_data_placeholder.size(); | 135 size_t after_offset = pos + template_data_placeholder.size(); |
136 full_html.append(new_tab_html.data() + after_offset, | 136 full_html.append(new_tab_html.data() + after_offset, |
137 new_tab_html.size() - after_offset); | 137 new_tab_html.size() - after_offset); |
138 } else { | 138 } else { |
139 NOTREACHED(); | 139 NOTREACHED(); |
140 full_html.assign(new_tab_html.data(), new_tab_html.size()); | 140 full_html.assign(new_tab_html.data(), new_tab_html.size()); |
141 } | 141 } |
142 | 142 |
143 new_tab_html_ = base::RefCountedString::TakeString(&full_html); | 143 new_tab_html_ = base::RefCountedString::TakeString(&full_html); |
144 } | 144 } |
OLD | NEW |