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

Side by Side Diff: chrome/browser/ui/webui/ntp/ntp_resource_cache_android.cc

Issue 11362240: Update the incognito NTP text for android (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Update step failed Created 8 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 base::StringPiece new_tab_html(ResourceBundle::GetSharedInstance(). 106 base::StringPiece new_tab_html(ResourceBundle::GetSharedInstance().
107 GetRawDataResource(IDR_NEW_TAB_ANDROID_HTML)); 107 GetRawDataResource(IDR_NEW_TAB_ANDROID_HTML));
108 localized_strings.SetString( 108 localized_strings.SetString(
109 "device", 109 "device",
110 CommandLine::ForCurrentProcess()->HasSwitch(switches::kTabletUI) ? 110 CommandLine::ForCurrentProcess()->HasSwitch(switches::kTabletUI) ?
111 "tablet" : "phone"); 111 "tablet" : "phone");
112 const char* new_tab_link = kLearnMoreIncognitoUrl; 112 const char* new_tab_link = kLearnMoreIncognitoUrl;
113 string16 learnMoreLink = ASCIIToUTF16( 113 string16 learnMoreLink = ASCIIToUTF16(
114 google_util::AppendGoogleLocaleParam(GURL(new_tab_link)).spec()); 114 google_util::AppendGoogleLocaleParam(GURL(new_tab_link)).spec());
115 localized_strings.SetString("content", 115 localized_strings.SetString("content",
116 l10n_util::GetStringFUTF16(IDS_NEW_TAB_OTR_MESSAGE, learnMoreLink)); 116 l10n_util::GetStringFUTF16(
117 IDS_NEW_TAB_OTR_MESSAGE_MOBILE, learnMoreLink));
117 118
118 // Load the new tab page appropriate for this build. 119 // Load the new tab page appropriate for this build.
119 std::string full_html; 120 std::string full_html;
120 121
121 // Inject the template data into the HTML so that it is available before any 122 // Inject the template data into the HTML so that it is available before any
122 // layout is needed. 123 // layout is needed.
123 std::string json_html; 124 std::string json_html;
124 jstemplate_builder::AppendJsonHtml(&localized_strings, &json_html); 125 jstemplate_builder::AppendJsonHtml(&localized_strings, &json_html);
125 126
126 static const base::StringPiece template_data_placeholder( 127 static const base::StringPiece template_data_placeholder(
127 "<!-- template data placeholder -->"); 128 "<!-- template data placeholder -->");
128 size_t pos = new_tab_html.find(template_data_placeholder); 129 size_t pos = new_tab_html.find(template_data_placeholder);
129 130
130 if (pos != base::StringPiece::npos) { 131 if (pos != base::StringPiece::npos) {
131 full_html.assign(new_tab_html.data(), pos); 132 full_html.assign(new_tab_html.data(), pos);
132 full_html.append(json_html); 133 full_html.append(json_html);
133 size_t after_offset = pos + template_data_placeholder.size(); 134 size_t after_offset = pos + template_data_placeholder.size();
134 full_html.append(new_tab_html.data() + after_offset, 135 full_html.append(new_tab_html.data() + after_offset,
135 new_tab_html.size() - after_offset); 136 new_tab_html.size() - after_offset);
136 } else { 137 } else {
137 NOTREACHED(); 138 NOTREACHED();
138 full_html.assign(new_tab_html.data(), new_tab_html.size()); 139 full_html.assign(new_tab_html.data(), new_tab_html.size());
139 } 140 }
140 141
141 new_tab_html_ = base::RefCountedString::TakeString(&full_html); 142 new_tab_html_ = base::RefCountedString::TakeString(&full_html);
142 } 143 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698