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

Side by Side Diff: chrome/browser/ui/webui/sync_promo/sync_promo_handler2.cc

Issue 9730021: Remove experimental sync promo layouts (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: a Created 8 years, 9 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 | Annotate | Revision Log
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/sync_promo/sync_promo_handler2.h" 5 #include "chrome/browser/ui/webui/sync_promo/sync_promo_handler2.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "base/time.h" 10 #include "base/time.h"
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 Browser* browser = 201 Browser* browser =
202 BrowserList::FindBrowserWithWebContents(web_ui()->GetWebContents()); 202 BrowserList::FindBrowserWithWebContents(web_ui()->GetWebContents());
203 if (!browser || !browser->IsAttemptingToCloseBrowser()) { 203 if (!browser || !browser->IsAttemptingToCloseBrowser()) {
204 GURL url = SyncPromoUI::GetNextPageURLForSyncPromoURL( 204 GURL url = SyncPromoUI::GetNextPageURLForSyncPromoURL(
205 web_ui_->tab_contents()->GetURL()); 205 web_ui_->tab_contents()->GetURL());
206 web_ui_->tab_contents()->OpenURL(url, GURL(), CURRENT_TAB, 206 web_ui_->tab_contents()->OpenURL(url, GURL(), CURRENT_TAB,
207 content::PAGE_TRANSITION_LINK); 207 content::PAGE_TRANSITION_LINK);
208 } 208 }
209 } 209 }
210 210
211 int SyncPromoHandler2::GetPromoVersion() {
212 switch (SyncPromoUI::GetSyncPromoVersion()) {
213 case SyncPromoUI::VERSION_DEFAULT:
214 return 0;
215 case SyncPromoUI::VERSION_DEVICES:
216 return 1;
217 case SyncPromoUI::VERSION_VERBOSE:
218 return 2;
219 case SyncPromoUI::VERSION_SIMPLE:
220 return 3;
221 case SyncPromoUI::VERSION_DIALOG:
222 // Use the simple sync promo layout for the dialog version.
223 return 3;
224 default:
225 NOTREACHED();
226 return 0;
227 }
228 }
229
230 void SyncPromoHandler2::HandleInitializeSyncPromo(const base::ListValue* args) { 211 void SyncPromoHandler2::HandleInitializeSyncPromo(const base::ListValue* args) {
231 base::FundamentalValue version(GetPromoVersion()); 212 // TODO(sail): The version argument is going away, remove this.
213 base::FundamentalValue version(3);
232 web_ui_->CallJavascriptFunction("SyncSetupOverlay.showPromoVersion", 214 web_ui_->CallJavascriptFunction("SyncSetupOverlay.showPromoVersion",
233 version); 215 version);
234 216
235 OpenSyncSetup(); 217 OpenSyncSetup();
236 // We don't need to compute anything for this, just do this every time. 218 // We don't need to compute anything for this, just do this every time.
237 RecordUserFlowAction(SYNC_PROMO_VIEWED); 219 RecordUserFlowAction(SYNC_PROMO_VIEWED);
238 // Increment view count first and show natural numbers in stats rather than 0 220 // Increment view count first and show natural numbers in stats rather than 0
239 // based starting point (if it happened to be our first time showing this). 221 // based starting point (if it happened to be our first time showing this).
240 IncrementViewCountBy(1); 222 IncrementViewCountBy(1);
241 // Record +1 for every view. This is the only thing we record that's not part 223 // Record +1 for every view. This is the only thing we record that's not part
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 // static variables that won't work if the name changes on differnt calls. 290 // static variables that won't work if the name changes on differnt calls.
309 if (!histogram_name_.empty()) { 291 if (!histogram_name_.empty()) {
310 base::Histogram* histogram = base::LinearHistogram::FactoryGet( 292 base::Histogram* histogram = base::LinearHistogram::FactoryGet(
311 histogram_name_, 1, SYNC_PROMO_BUCKET_BOUNDARY, 293 histogram_name_, 1, SYNC_PROMO_BUCKET_BOUNDARY,
312 SYNC_PROMO_BUCKET_BOUNDARY + 1, base::Histogram::kNoFlags); 294 SYNC_PROMO_BUCKET_BOUNDARY + 1, base::Histogram::kNoFlags);
313 histogram->Add(action); 295 histogram->Add(action);
314 } 296 }
315 } 297 }
316 298
317 } // namespace options2 299 } // namespace options2
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698