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

Side by Side Diff: chrome/browser/dom_ui/new_tab_page_sync_handler.cc

Issue 420004: Remove old bookmark sync promo from new tab page.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 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 | « chrome/browser/dom_ui/new_tab_page_sync_handler.h ('k') | 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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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/dom_ui/new_tab_page_sync_handler.h" 5 #include "chrome/browser/dom_ui/new_tab_page_sync_handler.h"
6 6
7 #include "app/l10n_util.h" 7 #include "app/l10n_util.h"
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 #include "base/values.h" 9 #include "base/values.h"
10 #include "chrome/browser/net/chrome_url_request_context.h" 10 #include "chrome/browser/net/chrome_url_request_context.h"
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 118
119 void NewTabPageSyncHandler::BuildAndSendSyncStatus() { 119 void NewTabPageSyncHandler::BuildAndSendSyncStatus() {
120 DCHECK(!waiting_for_initial_page_load_); 120 DCHECK(!waiting_for_initial_page_load_);
121 121
122 // Hide the sync status section if sync is disabled entirely. 122 // Hide the sync status section if sync is disabled entirely.
123 if (!sync_service_) { 123 if (!sync_service_) {
124 HideSyncStatusSection(); 124 HideSyncStatusSection();
125 return; 125 return;
126 } 126 }
127 127
128 // We show the sync promotion if sync has not been enabled and the user is 128 // Don't show sync status if setup is not complete.
129 // logged in to Google Accounts. If the user is not signed in to GA, we
130 // should hide the sync status section entirely.
131 if (!sync_service_->HasSyncSetupCompleted()) { 129 if (!sync_service_->HasSyncSetupCompleted()) {
132 if (!sync_service_->SetupInProgress() && IsGoogleGAIACookieInstalled()) {
133 SendSyncMessageToPage(PROMOTION,
134 WideToUTF8(l10n_util::GetString(IDS_SYNC_NTP_PROMOTION_MESSAGE)),
135 WideToUTF8(l10n_util::GetString(IDS_SYNC_NTP_START_NOW_LINK_LABEL)));
136 }
137 return; 130 return;
138 } 131 }
139 132
140 // Once sync has been enabled, the supported "sync statuses" for the NNTP 133 // Once sync has been enabled, the supported "sync statuses" for the NNTP
141 // from the user's perspective are: 134 // from the user's perspective are:
142 // 135 //
143 // "Sync error", when we can't authenticate or establish a connection with 136 // "Sync error", when we can't authenticate or establish a connection with
144 // the sync server (appropriate information appended to 137 // the sync server (appropriate information appended to
145 // message). 138 // message).
146 string16 status_msg; 139 string16 status_msg;
(...skipping 28 matching lines...) Expand all
175 MessageType type, std::string msg, 168 MessageType type, std::string msg,
176 std::string linktext) { 169 std::string linktext) {
177 DictionaryValue value; 170 DictionaryValue value;
178 std::string msgtype; 171 std::string msgtype;
179 std::wstring user; 172 std::wstring user;
180 std::string title = 173 std::string title =
181 WideToUTF8(l10n_util::GetString(IDS_SYNC_NTP_SYNC_SECTION_TITLE)); 174 WideToUTF8(l10n_util::GetString(IDS_SYNC_NTP_SYNC_SECTION_TITLE));
182 std::string linkurl; 175 std::string linkurl;
183 switch (type) { 176 switch (type) {
184 case HIDE: 177 case HIDE:
185 case PROMOTION:
186 msgtype = "presynced"; 178 msgtype = "presynced";
187 break; 179 break;
188 case SYNC_ERROR: 180 case SYNC_ERROR:
189 title = 181 title =
190 WideToUTF8( 182 WideToUTF8(
191 l10n_util::GetString(IDS_SYNC_NTP_SYNC_SECTION_ERROR_TITLE)); 183 l10n_util::GetString(IDS_SYNC_NTP_SYNC_SECTION_ERROR_TITLE));
192 msgtype = "error"; 184 msgtype = "error";
193 break; 185 break;
194 default: 186 default:
195 NOTREACHED(); 187 NOTREACHED();
(...skipping 22 matching lines...) Expand all
218 if (linkurl.empty()) { 210 if (linkurl.empty()) {
219 value.SetBoolean(L"linkurlisset", false); 211 value.SetBoolean(L"linkurlisset", false);
220 } else { 212 } else {
221 value.SetBoolean(L"linkurlisset", true); 213 value.SetBoolean(L"linkurlisset", true);
222 value.SetString(L"linkurl", linkurl); 214 value.SetString(L"linkurl", linkurl);
223 } 215 }
224 } 216 }
225 } 217 }
226 dom_ui_->CallJavascriptFunction(L"syncMessageChanged", value); 218 dom_ui_->CallJavascriptFunction(L"syncMessageChanged", value);
227 } 219 }
OLDNEW
« no previous file with comments | « chrome/browser/dom_ui/new_tab_page_sync_handler.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698