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

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

Issue 8956050: Rename TabContents::controller() to GetController and put it into the WebContents interface. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years 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) 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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 } 83 }
84 84
85 WebUIMessageHandler* SyncPromoHandler::Attach(WebUI* web_ui) { 85 WebUIMessageHandler* SyncPromoHandler::Attach(WebUI* web_ui) {
86 DCHECK(web_ui); 86 DCHECK(web_ui);
87 // Keep a reference to the preferences service for convenience and it's 87 // Keep a reference to the preferences service for convenience and it's
88 // probably a little faster that getting it via Profile::FromWebUI() every 88 // probably a little faster that getting it via Profile::FromWebUI() every
89 // time we need to interact with preferences. 89 // time we need to interact with preferences.
90 prefs_ = Profile::FromWebUI(web_ui)->GetPrefs(); 90 prefs_ = Profile::FromWebUI(web_ui)->GetPrefs();
91 DCHECK(prefs_); 91 DCHECK(prefs_);
92 // Ignore events from view-source:chrome://syncpromo. 92 // Ignore events from view-source:chrome://syncpromo.
93 if (!web_ui->tab_contents()->controller().GetActiveEntry()-> 93 if (!web_ui->tab_contents()->GetController().GetActiveEntry()->
94 IsViewSourceMode()) { 94 IsViewSourceMode()) {
95 // Listen to see if the tab we're in gets closed. 95 // Listen to see if the tab we're in gets closed.
96 registrar_.Add(this, content::NOTIFICATION_TAB_CLOSING, 96 registrar_.Add(this, content::NOTIFICATION_TAB_CLOSING,
97 content::Source<NavigationController>( 97 content::Source<NavigationController>(
98 &web_ui->tab_contents()->controller())); 98 &web_ui->tab_contents()->GetController()));
99 // Listen to see if the window we're in gets closed. 99 // Listen to see if the window we're in gets closed.
100 registrar_.Add(this, chrome::NOTIFICATION_BROWSER_CLOSING, 100 registrar_.Add(this, chrome::NOTIFICATION_BROWSER_CLOSING,
101 content::NotificationService::AllSources()); 101 content::NotificationService::AllSources());
102 } 102 }
103 return SyncSetupHandler::Attach(web_ui); 103 return SyncSetupHandler::Attach(web_ui);
104 } 104 }
105 105
106 void SyncPromoHandler::RegisterMessages() { 106 void SyncPromoHandler::RegisterMessages() {
107 web_ui_->RegisterMessageCallback("SyncPromo:Close", 107 web_ui_->RegisterMessageCallback("SyncPromo:Close",
108 base::Bind(&SyncPromoHandler::HandleCloseSyncPromo, 108 base::Bind(&SyncPromoHandler::HandleCloseSyncPromo,
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 int adjusted = GetViewCount() + amount; 285 int adjusted = GetViewCount() + amount;
286 prefs_->SetInteger(prefs::kSyncPromoViewCount, adjusted); 286 prefs_->SetInteger(prefs::kSyncPromoViewCount, adjusted);
287 return adjusted; 287 return adjusted;
288 } 288 }
289 289
290 void SyncPromoHandler::RecordUserFlowAction(int action) { 290 void SyncPromoHandler::RecordUserFlowAction(int action) {
291 // Send an enumeration to our single user flow histogram. 291 // Send an enumeration to our single user flow histogram.
292 UMA_HISTOGRAM_ENUMERATION("SyncPromo.UserFlow", action, 292 UMA_HISTOGRAM_ENUMERATION("SyncPromo.UserFlow", action,
293 SYNC_PROMO_BUCKET_BOUNDARY); 293 SYNC_PROMO_BUCKET_BOUNDARY);
294 } 294 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/print_preview_handler.cc ('k') | chrome/browser/ui/webui/web_ui_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698