| OLD | NEW |
| 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/sync/one_click_signin_helper.h" | 5 #include "chrome/browser/ui/sync/one_click_signin_helper.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <functional> | 8 #include <functional> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 #include "chrome/browser/sync/sync_prefs.h" | 36 #include "chrome/browser/sync/sync_prefs.h" |
| 37 #include "chrome/browser/tab_contents/tab_util.h" | 37 #include "chrome/browser/tab_contents/tab_util.h" |
| 38 #include "chrome/browser/ui/browser_finder.h" | 38 #include "chrome/browser/ui/browser_finder.h" |
| 39 #include "chrome/browser/ui/browser_window.h" | 39 #include "chrome/browser/ui/browser_window.h" |
| 40 #include "chrome/browser/ui/sync/one_click_signin_histogram.h" | 40 #include "chrome/browser/ui/sync/one_click_signin_histogram.h" |
| 41 #include "chrome/browser/ui/sync/one_click_signin_infobar_delegate.h" | 41 #include "chrome/browser/ui/sync/one_click_signin_infobar_delegate.h" |
| 42 #include "chrome/browser/ui/sync/one_click_signin_sync_starter.h" | 42 #include "chrome/browser/ui/sync/one_click_signin_sync_starter.h" |
| 43 #include "chrome/common/chrome_notification_types.h" | 43 #include "chrome/common/chrome_notification_types.h" |
| 44 #include "chrome/common/chrome_switches.h" | 44 #include "chrome/common/chrome_switches.h" |
| 45 #include "chrome/common/chrome_version_info.h" | 45 #include "chrome/common/chrome_version_info.h" |
| 46 #include "chrome/common/net/url_util.h" | |
| 47 #include "chrome/common/pref_names.h" | 46 #include "chrome/common/pref_names.h" |
| 48 #include "chrome/common/url_constants.h" | 47 #include "chrome/common/url_constants.h" |
| 49 #include "content/public/browser/browser_thread.h" | 48 #include "content/public/browser/browser_thread.h" |
| 50 #include "content/public/browser/page_navigator.h" | 49 #include "content/public/browser/page_navigator.h" |
| 51 #include "content/public/browser/web_contents.h" | 50 #include "content/public/browser/web_contents.h" |
| 52 #include "content/public/browser/web_contents_view.h" | 51 #include "content/public/browser/web_contents_view.h" |
| 53 #include "content/public/common/frame_navigate_params.h" | 52 #include "content/public/common/frame_navigate_params.h" |
| 54 #include "content/public/common/page_transition_types.h" | 53 #include "content/public/common/page_transition_types.h" |
| 55 #include "content/public/common/password_form.h" | 54 #include "content/public/common/password_form.h" |
| 56 #include "google_apis/gaia/gaia_auth_util.h" | 55 #include "google_apis/gaia/gaia_auth_util.h" |
| 57 #include "google_apis/gaia/gaia_urls.h" | 56 #include "google_apis/gaia/gaia_urls.h" |
| 58 #include "googleurl/src/gurl.h" | 57 #include "googleurl/src/gurl.h" |
| 59 #include "grit/chromium_strings.h" | 58 #include "grit/chromium_strings.h" |
| 60 #include "grit/generated_resources.h" | 59 #include "grit/generated_resources.h" |
| 61 #include "grit/theme_resources.h" | 60 #include "grit/theme_resources.h" |
| 61 #include "net/base/url_util.h" |
| 62 #include "net/cookies/cookie_monster.h" | 62 #include "net/cookies/cookie_monster.h" |
| 63 #include "net/url_request/url_request.h" | 63 #include "net/url_request/url_request.h" |
| 64 #include "ui/base/l10n/l10n_util.h" | 64 #include "ui/base/l10n/l10n_util.h" |
| 65 #include "ui/base/resource/resource_bundle.h" | 65 #include "ui/base/resource/resource_bundle.h" |
| 66 | 66 |
| 67 DEFINE_WEB_CONTENTS_USER_DATA_KEY(OneClickSigninHelper); | 67 DEFINE_WEB_CONTENTS_USER_DATA_KEY(OneClickSigninHelper); |
| 68 | 68 |
| 69 namespace { | 69 namespace { |
| 70 | 70 |
| 71 // Set to true if this chrome instance is in the blue-button-on-white-bar | 71 // Set to true if this chrome instance is in the blue-button-on-white-bar |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 DCHECK(io_data); | 128 DCHECK(io_data); |
| 129 io_data->set_reverse_autologin_pending_email(std::string()); | 129 io_data->set_reverse_autologin_pending_email(std::string()); |
| 130 } | 130 } |
| 131 | 131 |
| 132 // Determines the source of the sign in and the continue URL. Its either one | 132 // Determines the source of the sign in and the continue URL. Its either one |
| 133 // of the known sign in access point (first run, NTP, menu, settings) or its | 133 // of the known sign in access point (first run, NTP, menu, settings) or its |
| 134 // an implicit sign in via another Google property. In the former case, | 134 // an implicit sign in via another Google property. In the former case, |
| 135 // "service" is also checked to make sure its "chromiumsync". | 135 // "service" is also checked to make sure its "chromiumsync". |
| 136 SyncPromoUI::Source GetSigninSource(const GURL& url, GURL* continue_url) { | 136 SyncPromoUI::Source GetSigninSource(const GURL& url, GURL* continue_url) { |
| 137 std::string value; | 137 std::string value; |
| 138 chrome_common_net::GetValueForKeyInQuery(url, "service", &value); | 138 net::GetValueForKeyInQuery(url, "service", &value); |
| 139 bool possibly_an_explicit_signin = value == "chromiumsync"; | 139 bool possibly_an_explicit_signin = value == "chromiumsync"; |
| 140 | 140 |
| 141 // Find the final continue URL for this sign in. In some cases, Gaia can | 141 // Find the final continue URL for this sign in. In some cases, Gaia can |
| 142 // continue to itself, with the original continue URL buried under a couple | 142 // continue to itself, with the original continue URL buried under a couple |
| 143 // of layers of indirection. Peel those layers away. | 143 // of layers of indirection. Peel those layers away. |
| 144 GURL local_continue_url = url; | 144 GURL local_continue_url = url; |
| 145 do { | 145 do { |
| 146 local_continue_url = | 146 local_continue_url = |
| 147 SyncPromoUI::GetNextPageURLForSyncPromoURL(local_continue_url); | 147 SyncPromoUI::GetNextPageURLForSyncPromoURL(local_continue_url); |
| 148 } while (gaia::IsGaiaSignonRealm(local_continue_url.GetOrigin())); | 148 } while (gaia::IsGaiaSignonRealm(local_continue_url.GetOrigin())); |
| (...skipping 783 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 932 break; | 932 break; |
| 933 } | 933 } |
| 934 } | 934 } |
| 935 | 935 |
| 936 RedirectToNTP(); | 936 RedirectToNTP(); |
| 937 } | 937 } |
| 938 | 938 |
| 939 void OneClickSigninHelper::SigninSuccess() { | 939 void OneClickSigninHelper::SigninSuccess() { |
| 940 RedirectToNTP(); | 940 RedirectToNTP(); |
| 941 } | 941 } |
| OLD | NEW |