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

Side by Side Diff: chrome/browser/search/local_ntp_source.cc

Issue 14685004: Add finch flag for rendering a recently closed link on the local ntp. (Closed) Base URL: https://git.chromium.org/chromium/src.git@master
Patch Set: Rebase. Created 7 years, 6 months 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
« no previous file with comments | « chrome/browser/resources/local_ntp/local_ntp.js ('k') | chrome/browser/search/search.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/search/local_ntp_source.h" 5 #include "chrome/browser/search/local_ntp_source.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/memory/ref_counted_memory.h" 8 #include "base/memory/ref_counted_memory.h"
9 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
11 #include "base/values.h" 11 #include "base/values.h"
12 #include "chrome/browser/search/search.h"
12 #include "chrome/common/url_constants.h" 13 #include "chrome/common/url_constants.h"
13 #include "googleurl/src/gurl.h" 14 #include "googleurl/src/gurl.h"
14 #include "grit/browser_resources.h" 15 #include "grit/browser_resources.h"
15 #include "grit/generated_resources.h" 16 #include "grit/generated_resources.h"
16 #include "grit/ui_resources.h" 17 #include "grit/ui_resources.h"
17 #include "net/url_request/url_request.h" 18 #include "net/url_request/url_request.h"
18 #include "ui/base/l10n/l10n_util.h" 19 #include "ui/base/l10n/l10n_util.h"
19 #include "ui/base/resource/resource_bundle.h" 20 #include "ui/base/resource/resource_bundle.h"
20 #include "ui/webui/jstemplate_builder.h" 21 #include "ui/webui/jstemplate_builder.h"
21 22
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 // Adds a localized string keyed by resource id to the dictionary. 65 // Adds a localized string keyed by resource id to the dictionary.
65 void AddString(base::DictionaryValue* dictionary, 66 void AddString(base::DictionaryValue* dictionary,
66 const std::string& key, 67 const std::string& key,
67 int resource_id) { 68 int resource_id) {
68 dictionary->SetString(key, l10n_util::GetStringUTF16(resource_id)); 69 dictionary->SetString(key, l10n_util::GetStringUTF16(resource_id));
69 } 70 }
70 71
71 // Returns a JS dictionary of translated strings for the local NTP. 72 // Returns a JS dictionary of translated strings for the local NTP.
72 std::string GetTranslatedStrings() { 73 std::string GetTranslatedStrings() {
73 base::DictionaryValue translated_strings; 74 base::DictionaryValue translated_strings;
75 if (chrome::ShouldShowRecentTabsOnNTP())
76 AddString(&translated_strings, "recentTabs", IDS_RECENT_TABS_MENU);
74 AddString(&translated_strings, "thumbnailRemovedNotification", 77 AddString(&translated_strings, "thumbnailRemovedNotification",
75 IDS_NEW_TAB_THUMBNAIL_REMOVED_NOTIFICATION); 78 IDS_NEW_TAB_THUMBNAIL_REMOVED_NOTIFICATION);
76 AddString(&translated_strings, "removeThumbnailTooltip", 79 AddString(&translated_strings, "removeThumbnailTooltip",
77 IDS_NEW_TAB_REMOVE_THUMBNAIL_TOOLTIP); 80 IDS_NEW_TAB_REMOVE_THUMBNAIL_TOOLTIP);
78 AddString(&translated_strings, "undoThumbnailRemove", 81 AddString(&translated_strings, "undoThumbnailRemove",
79 IDS_NEW_TAB_UNDO_THUMBNAIL_REMOVE); 82 IDS_NEW_TAB_UNDO_THUMBNAIL_REMOVE);
80 AddString(&translated_strings, "restoreThumbnailsShort", 83 AddString(&translated_strings, "restoreThumbnailsShort",
81 IDS_NEW_TAB_RESTORE_THUMBNAILS_SHORT_LINK); 84 IDS_NEW_TAB_RESTORE_THUMBNAILS_SHORT_LINK);
82 AddString(&translated_strings, "attributionIntro", 85 AddString(&translated_strings, "attributionIntro",
83 IDS_NEW_TAB_ATTRIBUTION_INTRO); 86 IDS_NEW_TAB_ATTRIBUTION_INTRO);
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 } 149 }
147 return false; 150 return false;
148 } 151 }
149 152
150 std::string LocalNtpSource::GetContentSecurityPolicyFrameSrc() const { 153 std::string LocalNtpSource::GetContentSecurityPolicyFrameSrc() const {
151 // Allow embedding of suggestion and most visited iframes. 154 // Allow embedding of suggestion and most visited iframes.
152 return base::StringPrintf("frame-src %s %s;", 155 return base::StringPrintf("frame-src %s %s;",
153 chrome::kChromeSearchSuggestionUrl, 156 chrome::kChromeSearchSuggestionUrl,
154 chrome::kChromeSearchMostVisitedUrl); 157 chrome::kChromeSearchMostVisitedUrl);
155 } 158 }
OLDNEW
« no previous file with comments | « chrome/browser/resources/local_ntp/local_ntp.js ('k') | chrome/browser/search/search.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698