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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 DCHECK(io_data); | 129 DCHECK(io_data); |
130 io_data->set_reverse_autologin_pending_email(std::string()); | 130 io_data->set_reverse_autologin_pending_email(std::string()); |
131 } | 131 } |
132 | 132 |
133 // Determines the source of the sign in and the continue URL. Its either one | 133 // Determines the source of the sign in and the continue URL. Its either one |
134 // of the known sign in access point (first run, NTP, menu, settings) or its | 134 // of the known sign in access point (first run, NTP, menu, settings) or its |
135 // an implicit sign in via another Google property. In the former case, | 135 // an implicit sign in via another Google property. In the former case, |
136 // "service" is also checked to make sure its "chromiumsync". | 136 // "service" is also checked to make sure its "chromiumsync". |
137 SyncPromoUI::Source GetSigninSource(const GURL& url, GURL* continue_url) { | 137 SyncPromoUI::Source GetSigninSource(const GURL& url, GURL* continue_url) { |
138 std::string value; | 138 std::string value; |
139 chrome_common_net::GetValueForKeyInQuery(url, "service", &value); | 139 net::GetValueForKeyInQuery(url, "service", &value); |
140 bool possibly_an_explicit_signin = value == "chromiumsync"; | 140 bool possibly_an_explicit_signin = value == "chromiumsync"; |
141 | 141 |
142 // Find the final continue URL for this sign in. In some cases, Gaia can | 142 // Find the final continue URL for this sign in. In some cases, Gaia can |
143 // continue to itself, with the original continue URL buried under a couple | 143 // continue to itself, with the original continue URL buried under a couple |
144 // of layers of indirection. Peel those layers away. | 144 // of layers of indirection. Peel those layers away. |
145 GURL local_continue_url = url; | 145 GURL local_continue_url = url; |
146 do { | 146 do { |
147 local_continue_url = | 147 local_continue_url = |
148 SyncPromoUI::GetNextPageURLForSyncPromoURL(local_continue_url); | 148 SyncPromoUI::GetNextPageURLForSyncPromoURL(local_continue_url); |
149 } while (gaia::IsGaiaSignonRealm(local_continue_url.GetOrigin())); | 149 } while (gaia::IsGaiaSignonRealm(local_continue_url.GetOrigin())); |
(...skipping 783 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
933 break; | 933 break; |
934 } | 934 } |
935 } | 935 } |
936 | 936 |
937 RedirectToNTP(); | 937 RedirectToNTP(); |
938 } | 938 } |
939 | 939 |
940 void OneClickSigninHelper::SigninSuccess() { | 940 void OneClickSigninHelper::SigninSuccess() { |
941 RedirectToNTP(); | 941 RedirectToNTP(); |
942 } | 942 } |
OLD | NEW |