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

Side by Side Diff: chrome/browser/ui/webui/sync_setup_handler.cc

Issue 12380034: Merge 184110 (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1410/src/
Patch Set: Created 7 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
« no previous file with comments | « chrome/browser/ui/sync/signin_histogram.h ('k') | chrome/chrome_browser_ui.gypi » ('j') | 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) 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_setup_handler.h" 5 #include "chrome/browser/ui/webui/sync_setup_handler.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/bind_helpers.h" 9 #include "base/bind_helpers.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
11 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
12 #include "base/i18n/time_formatting.h" 12 #include "base/i18n/time_formatting.h"
13 #include "base/json/json_reader.h" 13 #include "base/json/json_reader.h"
14 #include "base/json/json_writer.h" 14 #include "base/json/json_writer.h"
15 #include "base/metrics/histogram.h"
15 #include "base/prefs/pref_service.h" 16 #include "base/prefs/pref_service.h"
16 #include "base/utf_string_conversions.h" 17 #include "base/utf_string_conversions.h"
17 #include "base/values.h" 18 #include "base/values.h"
18 #include "chrome/app/chrome_command_ids.h" 19 #include "chrome/app/chrome_command_ids.h"
19 #include "chrome/browser/google/google_util.h" 20 #include "chrome/browser/google/google_util.h"
20 #include "chrome/browser/lifetime/application_lifetime.h" 21 #include "chrome/browser/lifetime/application_lifetime.h"
21 #include "chrome/browser/profiles/profile.h" 22 #include "chrome/browser/profiles/profile.h"
22 #include "chrome/browser/profiles/profile_info_cache.h" 23 #include "chrome/browser/profiles/profile_info_cache.h"
23 #include "chrome/browser/profiles/profile_manager.h" 24 #include "chrome/browser/profiles/profile_manager.h"
24 #include "chrome/browser/profiles/profile_metrics.h" 25 #include "chrome/browser/profiles/profile_metrics.h"
25 #include "chrome/browser/signin/signin_manager.h" 26 #include "chrome/browser/signin/signin_manager.h"
26 #include "chrome/browser/signin/signin_manager_factory.h" 27 #include "chrome/browser/signin/signin_manager_factory.h"
27 #include "chrome/browser/sync/profile_sync_service.h" 28 #include "chrome/browser/sync/profile_sync_service.h"
28 #include "chrome/browser/sync/profile_sync_service_factory.h" 29 #include "chrome/browser/sync/profile_sync_service_factory.h"
29 #include "chrome/browser/ui/browser_finder.h" 30 #include "chrome/browser/ui/browser_finder.h"
30 #include "chrome/browser/ui/browser_navigator.h" 31 #include "chrome/browser/ui/browser_navigator.h"
32 #include "chrome/browser/ui/sync/signin_histogram.h"
31 #include "chrome/browser/ui/tabs/tab_strip_model.h" 33 #include "chrome/browser/ui/tabs/tab_strip_model.h"
32 #include "chrome/browser/ui/webui/signin/login_ui_service.h" 34 #include "chrome/browser/ui/webui/signin/login_ui_service.h"
33 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" 35 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h"
34 #include "chrome/browser/ui/webui/sync_promo/sync_promo_ui.h" 36 #include "chrome/browser/ui/webui/sync_promo/sync_promo_ui.h"
35 #include "chrome/common/chrome_switches.h" 37 #include "chrome/common/chrome_switches.h"
36 #include "chrome/common/pref_names.h" 38 #include "chrome/common/pref_names.h"
37 #include "chrome/common/url_constants.h" 39 #include "chrome/common/url_constants.h"
38 #include "content/public/browser/render_view_host.h" 40 #include "content/public/browser/render_view_host.h"
39 #include "content/public/browser/web_contents.h" 41 #include "content/public/browser/web_contents.h"
40 #include "content/public/browser/web_contents_delegate.h" 42 #include "content/public/browser/web_contents_delegate.h"
(...skipping 572 matching lines...) Expand 10 before | Expand all | Expand 10 after
613 browser = new Browser(Browser::CreateParams( 615 browser = new Browser(Browser::CreateParams(
614 Browser::TYPE_TABBED, GetProfile(), chrome::GetActiveDesktop())); 616 Browser::TYPE_TABBED, GetProfile(), chrome::GetActiveDesktop()));
615 } 617 }
616 618
617 // If the signin manager already has an authenticated username, this is a 619 // If the signin manager already has an authenticated username, this is a
618 // re-auth scenario, and we need to ensure that the user signs in with the 620 // re-auth scenario, and we need to ensure that the user signs in with the
619 // same email address. 621 // same email address.
620 std::string email = SigninManagerFactory::GetForProfile( 622 std::string email = SigninManagerFactory::GetForProfile(
621 browser->profile())->GetAuthenticatedUsername(); 623 browser->profile())->GetAuthenticatedUsername();
622 if (!email.empty()) { 624 if (!email.empty()) {
625 UMA_HISTOGRAM_ENUMERATION("Signin.Reauth",
626 signin::HISTOGRAM_SHOWN,
627 signin::HISTOGRAM_MAX);
623 std::string fragment("Email="); 628 std::string fragment("Email=");
624 fragment += email; 629 fragment += email;
625 GURL::Replacements replacements; 630 GURL::Replacements replacements;
626 replacements.SetRefStr(fragment); 631 replacements.SetRefStr(fragment);
627 url = url.ReplaceComponents(replacements); 632 url = url.ReplaceComponents(replacements);
628 } 633 }
629 634
630 active_gaia_signin_tab_ = browser->OpenURL( 635 active_gaia_signin_tab_ = browser->OpenURL(
631 content::OpenURLParams(url, content::Referrer(), SINGLETON_TAB, 636 content::OpenURLParams(url, content::Referrer(), SINGLETON_TAB,
632 content::PAGE_TRANSITION_AUTO_BOOKMARK, false)); 637 content::PAGE_TRANSITION_AUTO_BOOKMARK, false));
(...skipping 673 matching lines...) Expand 10 before | Expand all | Expand 10 after
1306 if (i != current_profile_index && AreUserNamesEqual( 1311 if (i != current_profile_index && AreUserNamesEqual(
1307 cache.GetUserNameOfProfileAtIndex(i), username_utf16)) { 1312 cache.GetUserNameOfProfileAtIndex(i), username_utf16)) {
1308 *error_message = l10n_util::GetStringUTF16( 1313 *error_message = l10n_util::GetStringUTF16(
1309 IDS_SYNC_USER_NAME_IN_USE_ERROR); 1314 IDS_SYNC_USER_NAME_IN_USE_ERROR);
1310 return false; 1315 return false;
1311 } 1316 }
1312 } 1317 }
1313 1318
1314 return true; 1319 return true;
1315 } 1320 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/sync/signin_histogram.h ('k') | chrome/chrome_browser_ui.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698