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

Side by Side Diff: chrome/browser/ui/chrome_pages.cc

Issue 11316299: Enable web-based sign in flow by default. Can use command line argument (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 8 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) 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/chrome_pages.h" 5 #include "chrome/browser/ui/chrome_pages.h"
6 6
7 #include "base/command_line.h"
8 #include "base/logging.h" 7 #include "base/logging.h"
9 #include "base/string_number_conversions.h" 8 #include "base/string_number_conversions.h"
10 #include "base/stringprintf.h" 9 #include "base/stringprintf.h"
11 #include "chrome/browser/download/download_shelf.h" 10 #include "chrome/browser/download/download_shelf.h"
12 #include "chrome/browser/profiles/profile.h" 11 #include "chrome/browser/profiles/profile.h"
13 #include "chrome/browser/sync/profile_sync_service.h" 12 #include "chrome/browser/sync/profile_sync_service.h"
14 #include "chrome/browser/sync/profile_sync_service_factory.h" 13 #include "chrome/browser/sync/profile_sync_service_factory.h"
15 #include "chrome/browser/ui/browser.h" 14 #include "chrome/browser/ui/browser.h"
16 #include "chrome/browser/ui/browser_navigator.h" 15 #include "chrome/browser/ui/browser_navigator.h"
17 #include "chrome/browser/ui/browser_window.h" 16 #include "chrome/browser/ui/browser_window.h"
18 #include "chrome/browser/ui/singleton_tabs.h" 17 #include "chrome/browser/ui/singleton_tabs.h"
18 #include "chrome/browser/ui/sync/one_click_signin_helper.h"
19 #include "chrome/browser/ui/webui/options/content_settings_handler.h" 19 #include "chrome/browser/ui/webui/options/content_settings_handler.h"
20 #include "chrome/browser/ui/webui/signin/login_ui_service.h" 20 #include "chrome/browser/ui/webui/signin/login_ui_service.h"
21 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" 21 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h"
22 #include "chrome/common/chrome_switches.h"
23 #include "chrome/common/net/url_util.h" 22 #include "chrome/common/net/url_util.h"
24 #include "chrome/common/url_constants.h" 23 #include "chrome/common/url_constants.h"
25 #include "content/public/browser/user_metrics.h" 24 #include "content/public/browser/user_metrics.h"
26 #include "google_apis/gaia/gaia_urls.h" 25 #include "google_apis/gaia/gaia_urls.h"
27 #include "googleurl/src/gurl.h" 26 #include "googleurl/src/gurl.h"
28 27
29 using content::UserMetricsAction; 28 using content::UserMetricsAction;
30 29
31 namespace chrome { 30 namespace chrome {
32 namespace { 31 namespace {
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 } 176 }
178 177
179 void ShowSyncSetup(Browser* browser, SyncPromoUI::Source source) { 178 void ShowSyncSetup(Browser* browser, SyncPromoUI::Source source) {
180 Profile* original_profile = browser->profile()->GetOriginalProfile(); 179 Profile* original_profile = browser->profile()->GetOriginalProfile();
181 ProfileSyncService* service = 180 ProfileSyncService* service =
182 ProfileSyncServiceFactory::GetInstance()->GetForProfile( 181 ProfileSyncServiceFactory::GetInstance()->GetForProfile(
183 original_profile); 182 original_profile);
184 if (service->HasSyncSetupCompleted()) { 183 if (service->HasSyncSetupCompleted()) {
185 ShowSettings(browser); 184 ShowSettings(browser);
186 } else { 185 } else {
187 const bool use_web_flow = CommandLine::ForCurrentProcess()->HasSwitch( 186 const bool use_web_flow = OneClickSigninHelper::UseWebBasedSigninFlow();
188 switches::kUseWebBasedSigninFlow);
189 const bool show_promo = 187 const bool show_promo =
190 SyncPromoUI::ShouldShowSyncPromo(browser->profile()); 188 SyncPromoUI::ShouldShowSyncPromo(browser->profile());
191 189
192 LoginUIService* login = LoginUIServiceFactory::GetForProfile( 190 LoginUIService* login = LoginUIServiceFactory::GetForProfile(
193 original_profile); 191 original_profile);
194 if (use_web_flow || (show_promo && login->current_login_ui() == NULL)) { 192 if (use_web_flow || (show_promo && login->current_login_ui() == NULL)) {
195 NavigateToSingletonTab(browser, GURL(SyncPromoUI::GetSyncPromoURL(GURL(), 193 NavigateToSingletonTab(browser, GURL(SyncPromoUI::GetSyncPromoURL(GURL(),
196 source, 194 source,
197 false))); 195 false)));
198 } else { 196 } else {
199 login->ShowLoginUI(browser); 197 login->ShowLoginUI(browser);
200 } 198 }
201 } 199 }
202 } 200 }
203 201
204 void ShowGaiaSignin(Browser* browser, 202 void ShowGaiaSignin(Browser* browser,
205 const std::string& service, 203 const std::string& service,
206 const GURL& continue_url) { 204 const GURL& continue_url) {
207 GURL url(GaiaUrls::GetInstance()->service_login_url()); 205 GURL url(GaiaUrls::GetInstance()->service_login_url());
208 url = chrome_common_net::AppendQueryParameter(url, "service", service); 206 url = chrome_common_net::AppendQueryParameter(url, "service", service);
209 if (continue_url.is_valid()) 207 if (continue_url.is_valid())
210 url = chrome_common_net::AppendQueryParameter(url, 208 url = chrome_common_net::AppendQueryParameter(url,
211 "continue", 209 "continue",
212 continue_url.spec()); 210 continue_url.spec());
213 NavigateToSingletonTab(browser, url); 211 NavigateToSingletonTab(browser, url);
214 } 212 }
215 213
216 } // namespace chrome 214 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698