Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_handler.h" | 5 #include "chrome/browser/ui/webui/sync_promo/sync_promo_handler.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 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 193 | 193 |
| 194 void SyncPromoHandler::HandleCloseSyncPromo(const base::ListValue* args) { | 194 void SyncPromoHandler::HandleCloseSyncPromo(const base::ListValue* args) { |
| 195 CloseSyncSetup(); | 195 CloseSyncSetup(); |
| 196 | 196 |
| 197 // If the user has signed in then set the pref to show them NTP bubble | 197 // If the user has signed in then set the pref to show them NTP bubble |
| 198 // confirming that they're signed in. | 198 // confirming that they're signed in. |
| 199 std::string username = prefs_->GetString(prefs::kGoogleServicesUsername); | 199 std::string username = prefs_->GetString(prefs::kGoogleServicesUsername); |
| 200 if (!username.empty()) | 200 if (!username.empty()) |
| 201 prefs_->SetBoolean(prefs::kSyncPromoShowNTPBubble, true); | 201 prefs_->SetBoolean(prefs::kSyncPromoShowNTPBubble, true); |
| 202 | 202 |
| 203 GURL url = SyncPromoUI::GetNextPageURLForSyncPromoURL( | 203 Browser* browser = |
| 204 web_ui()->GetWebContents()->GetURL()); | 204 BrowserList::FindBrowserWithWebContents(web_ui()->GetWebContents()); |
|
sky
2012/01/23 16:09:54
Add a comment as to why you need this.
sail
2012/01/23 17:06:56
Done.
| |
| 205 OpenURLParams params( | 205 if (browser && !browser->IsAttemptingToCloseBrowser()) { |
| 206 url, Referrer(), CURRENT_TAB, content::PAGE_TRANSITION_LINK, false); | 206 GURL url = SyncPromoUI::GetNextPageURLForSyncPromoURL( |
| 207 web_ui()->GetWebContents()->OpenURL(params); | 207 web_ui()->GetWebContents()->GetURL()); |
| 208 OpenURLParams params( | |
| 209 url, Referrer(), CURRENT_TAB, content::PAGE_TRANSITION_LINK, false); | |
| 210 web_ui()->GetWebContents()->OpenURL(params); | |
| 211 } | |
| 208 } | 212 } |
| 209 | 213 |
| 210 void SyncPromoHandler::HandleInitializeSyncPromo(const base::ListValue* args) { | 214 void SyncPromoHandler::HandleInitializeSyncPromo(const base::ListValue* args) { |
| 211 // If the promo is also the Chrome launch page, we want to show the title and | 215 // If the promo is also the Chrome launch page, we want to show the title and |
| 212 // log an event if we are running an experiment. | 216 // log an event if we are running an experiment. |
| 213 bool is_launch_page = SyncPromoUI::GetIsLaunchPageForSyncPromoURL( | 217 bool is_launch_page = SyncPromoUI::GetIsLaunchPageForSyncPromoURL( |
| 214 web_ui()->GetWebContents()->GetURL()); | 218 web_ui()->GetWebContents()->GetURL()); |
| 215 if (is_launch_page && sync_promo_trial::IsExperimentActive()) | 219 if (is_launch_page && sync_promo_trial::IsExperimentActive()) |
| 216 sync_promo_trial::RecordUserSawMessage(); | 220 sync_promo_trial::RecordUserSawMessage(); |
| 217 base::FundamentalValue visible(is_launch_page); | 221 base::FundamentalValue visible(is_launch_page); |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 293 Profile* profile = Profile::FromWebUI(web_ui()); | 297 Profile* profile = Profile::FromWebUI(web_ui()); |
| 294 sync_promo_trial::RecordUserSignedInWithTrialBrand(is_start_up, profile); | 298 sync_promo_trial::RecordUserSignedInWithTrialBrand(is_start_up, profile); |
| 295 } | 299 } |
| 296 } | 300 } |
| 297 | 301 |
| 298 void SyncPromoHandler::RecordUserFlowAction(int action) { | 302 void SyncPromoHandler::RecordUserFlowAction(int action) { |
| 299 // Send an enumeration to our single user flow histogram. | 303 // Send an enumeration to our single user flow histogram. |
| 300 UMA_HISTOGRAM_ENUMERATION("SyncPromo.UserFlow", action, | 304 UMA_HISTOGRAM_ENUMERATION("SyncPromo.UserFlow", action, |
| 301 SYNC_PROMO_BUCKET_BOUNDARY); | 305 SYNC_PROMO_BUCKET_BOUNDARY); |
| 302 } | 306 } |
| OLD | NEW |