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

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

Issue 8983012: Get rid of content::NavigationController in cc file and use "using" instead. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 11 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) 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"
11 #include "chrome/browser/prefs/pref_service.h" 11 #include "chrome/browser/prefs/pref_service.h"
12 #include "chrome/browser/profiles/profile.h" 12 #include "chrome/browser/profiles/profile.h"
13 #include "chrome/browser/sync/profile_sync_service.h" 13 #include "chrome/browser/sync/profile_sync_service.h"
14 #include "chrome/browser/sync/sync_setup_flow.h" 14 #include "chrome/browser/sync/sync_setup_flow.h"
15 #include "chrome/browser/tabs/tab_strip_model.h" 15 #include "chrome/browser/tabs/tab_strip_model.h"
16 #include "chrome/browser/ui/browser.h" 16 #include "chrome/browser/ui/browser.h"
17 #include "chrome/browser/ui/browser_list.h" 17 #include "chrome/browser/ui/browser_list.h"
18 #include "chrome/browser/ui/webui/sync_promo/sync_promo_trial.h" 18 #include "chrome/browser/ui/webui/sync_promo/sync_promo_trial.h"
19 #include "chrome/browser/ui/webui/sync_promo/sync_promo_ui.h" 19 #include "chrome/browser/ui/webui/sync_promo/sync_promo_ui.h"
20 #include "chrome/common/chrome_notification_types.h" 20 #include "chrome/common/chrome_notification_types.h"
21 #include "chrome/common/extensions/extension_constants.h" 21 #include "chrome/common/extensions/extension_constants.h"
22 #include "chrome/common/pref_names.h" 22 #include "chrome/common/pref_names.h"
23 #include "chrome/common/url_constants.h" 23 #include "chrome/common/url_constants.h"
24 #include "content/public/browser/navigation_controller.h" 24 #include "content/public/browser/navigation_controller.h"
25 #include "content/public/browser/navigation_entry.h" 25 #include "content/public/browser/navigation_entry.h"
26 #include "content/public/browser/notification_details.h" 26 #include "content/public/browser/notification_details.h"
27 #include "content/public/browser/notification_service.h" 27 #include "content/public/browser/notification_service.h"
28 #include "content/public/browser/web_contents.h" 28 #include "content/public/browser/web_contents.h"
29 29
30 using content::NavigationController;
30 using content::OpenURLParams; 31 using content::OpenURLParams;
31 using content::Referrer; 32 using content::Referrer;
32 33
33 namespace { 34 namespace {
34 35
35 // User actions on the sync promo (aka "Sign in to Chrome"). 36 // User actions on the sync promo (aka "Sign in to Chrome").
36 enum SyncPromoUserFlowActionEnums { 37 enum SyncPromoUserFlowActionEnums {
37 SYNC_PROMO_VIEWED, 38 SYNC_PROMO_VIEWED,
38 SYNC_PROMO_LEARN_MORE_CLICKED, 39 SYNC_PROMO_LEARN_MORE_CLICKED,
39 SYNC_PROMO_ACCOUNT_HELP_CLICKED, 40 SYNC_PROMO_ACCOUNT_HELP_CLICKED,
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 // Keep a reference to the preferences service for convenience and it's 85 // Keep a reference to the preferences service for convenience and it's
85 // probably a little faster that getting it via Profile::FromWebUI() every 86 // probably a little faster that getting it via Profile::FromWebUI() every
86 // time we need to interact with preferences. 87 // time we need to interact with preferences.
87 prefs_ = Profile::FromWebUI(web_ui())->GetPrefs(); 88 prefs_ = Profile::FromWebUI(web_ui())->GetPrefs();
88 DCHECK(prefs_); 89 DCHECK(prefs_);
89 // Ignore events from view-source:chrome://syncpromo. 90 // Ignore events from view-source:chrome://syncpromo.
90 if (!web_ui()->web_contents()->GetController().GetActiveEntry()-> 91 if (!web_ui()->web_contents()->GetController().GetActiveEntry()->
91 IsViewSourceMode()) { 92 IsViewSourceMode()) {
92 // Listen to see if the tab we're in gets closed. 93 // Listen to see if the tab we're in gets closed.
93 registrar_.Add(this, content::NOTIFICATION_TAB_CLOSING, 94 registrar_.Add(this, content::NOTIFICATION_TAB_CLOSING,
94 content::Source<content::NavigationController>( 95 content::Source<NavigationController>(
95 &web_ui()->web_contents()->GetController())); 96 &web_ui()->web_contents()->GetController()));
96 // Listen to see if the window we're in gets closed. 97 // Listen to see if the window we're in gets closed.
97 registrar_.Add(this, chrome::NOTIFICATION_BROWSER_CLOSING, 98 registrar_.Add(this, chrome::NOTIFICATION_BROWSER_CLOSING,
98 content::NotificationService::AllSources()); 99 content::NotificationService::AllSources());
99 } 100 }
100 101
101 web_ui()->RegisterMessageCallback("SyncPromo:Close", 102 web_ui()->RegisterMessageCallback("SyncPromo:Close",
102 base::Bind(&SyncPromoHandler::HandleCloseSyncPromo, 103 base::Bind(&SyncPromoHandler::HandleCloseSyncPromo,
103 base::Unretained(this))); 104 base::Unretained(this)));
104 web_ui()->RegisterMessageCallback("SyncPromo:Initialize", 105 web_ui()->RegisterMessageCallback("SyncPromo:Initialize",
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 Profile* profile = Profile::FromWebUI(web_ui()); 293 Profile* profile = Profile::FromWebUI(web_ui());
293 sync_promo_trial::RecordUserSignedInWithTrialBrand(is_start_up, profile); 294 sync_promo_trial::RecordUserSignedInWithTrialBrand(is_start_up, profile);
294 } 295 }
295 } 296 }
296 297
297 void SyncPromoHandler::RecordUserFlowAction(int action) { 298 void SyncPromoHandler::RecordUserFlowAction(int action) {
298 // Send an enumeration to our single user flow histogram. 299 // Send an enumeration to our single user flow histogram.
299 UMA_HISTOGRAM_ENUMERATION("SyncPromo.UserFlow", action, 300 UMA_HISTOGRAM_ENUMERATION("SyncPromo.UserFlow", action,
300 SYNC_PROMO_BUCKET_BOUNDARY); 301 SYNC_PROMO_BUCKET_BOUNDARY);
301 } 302 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/cloud_print_signin_dialog.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