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

Side by Side Diff: chrome/browser/ui/webui/signin/inline_login_handler_impl.cc

Issue 2653953009: Convert InlineLoginHandlerImpl to use the new navigation callbacks. (Closed)
Patch Set: Created 3 years, 10 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/signin/inline_login_handler_impl.h" 5 #include "chrome/browser/ui/webui/signin/inline_login_handler_impl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 #include "components/signin/core/browser/about_signin_internals.h" 54 #include "components/signin/core/browser/about_signin_internals.h"
55 #include "components/signin/core/browser/account_tracker_service.h" 55 #include "components/signin/core/browser/account_tracker_service.h"
56 #include "components/signin/core/browser/profile_oauth2_token_service.h" 56 #include "components/signin/core/browser/profile_oauth2_token_service.h"
57 #include "components/signin/core/browser/signin_error_controller.h" 57 #include "components/signin/core/browser/signin_error_controller.h"
58 #include "components/signin/core/browser/signin_header_helper.h" 58 #include "components/signin/core/browser/signin_header_helper.h"
59 #include "components/signin/core/browser/signin_investigator.h" 59 #include "components/signin/core/browser/signin_investigator.h"
60 #include "components/signin/core/browser/signin_metrics.h" 60 #include "components/signin/core/browser/signin_metrics.h"
61 #include "components/signin/core/common/profile_management_switches.h" 61 #include "components/signin/core/common/profile_management_switches.h"
62 #include "components/signin/core/common/signin_pref_names.h" 62 #include "components/signin/core/common/signin_pref_names.h"
63 #include "components/strings/grit/components_strings.h" 63 #include "components/strings/grit/components_strings.h"
64 #include "content/public/browser/navigation_handle.h"
64 #include "content/public/browser/storage_partition.h" 65 #include "content/public/browser/storage_partition.h"
65 #include "content/public/browser/user_metrics.h" 66 #include "content/public/browser/user_metrics.h"
66 #include "content/public/browser/web_ui.h" 67 #include "content/public/browser/web_ui.h"
67 #include "google_apis/gaia/gaia_auth_fetcher.h" 68 #include "google_apis/gaia/gaia_auth_fetcher.h"
68 #include "google_apis/gaia/gaia_auth_util.h" 69 #include "google_apis/gaia/gaia_auth_util.h"
69 #include "google_apis/gaia/gaia_constants.h" 70 #include "google_apis/gaia/gaia_constants.h"
70 #include "google_apis/gaia/gaia_urls.h" 71 #include "google_apis/gaia/gaia_urls.h"
71 #include "net/base/url_util.h" 72 #include "net/base/url_util.h"
72 #include "ui/base/l10n/l10n_util.h" 73 #include "ui/base/l10n/l10n_util.h"
73 74
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 } 389 }
389 390
390 InlineLoginHandlerImpl::InlineLoginHandlerImpl() 391 InlineLoginHandlerImpl::InlineLoginHandlerImpl()
391 : confirm_untrusted_signin_(false), 392 : confirm_untrusted_signin_(false),
392 weak_factory_(this) { 393 weak_factory_(this) {
393 } 394 }
394 395
395 InlineLoginHandlerImpl::~InlineLoginHandlerImpl() {} 396 InlineLoginHandlerImpl::~InlineLoginHandlerImpl() {}
396 397
397 // This method is not called with webview sign in enabled. 398 // This method is not called with webview sign in enabled.
398 void InlineLoginHandlerImpl::DidCommitProvisionalLoadForFrame( 399 void InlineLoginHandlerImpl::DidFinishNavigation(
399 content::RenderFrameHost* render_frame_host, 400 content::NavigationHandle* navigation_handle) {
400 const GURL& url, 401 if (!web_contents() ||
401 ui::PageTransition transition_type) { 402 !navigation_handle->HasCommitted() ||
402 if (!web_contents()) 403 navigation_handle->IsErrorPage()) {
403 return; 404 return;
405 }
404 406
405 // Returns early if this is not a gaia webview navigation. 407 // Returns early if this is not a gaia webview navigation.
406 content::RenderFrameHost* gaia_frame = 408 content::RenderFrameHost* gaia_frame =
407 signin::GetAuthFrame(web_contents(), "signin-frame"); 409 signin::GetAuthFrame(web_contents(), "signin-frame");
408 if (render_frame_host != gaia_frame) 410 if (navigation_handle->GetRenderFrameHost() != gaia_frame)
409 return; 411 return;
410 412
411 // Loading any untrusted (e.g., HTTP) URLs in the privileged sign-in process 413 // Loading any untrusted (e.g., HTTP) URLs in the privileged sign-in process
412 // will require confirmation before the sign in takes effect. 414 // will require confirmation before the sign in takes effect.
413 const GURL kGaiaExtOrigin( 415 const GURL kGaiaExtOrigin(
414 GaiaUrls::GetInstance()->signin_completed_continue_url().GetOrigin()); 416 GaiaUrls::GetInstance()->signin_completed_continue_url().GetOrigin());
415 if (!url.is_empty()) { 417 if (!navigation_handle->GetURL().is_empty()) {
achuithb 2017/01/27 01:11:16 Does it make sense to have a stack var for navigat
jam 2017/01/27 01:39:05 the getter returns a const reference, so it's the
416 GURL origin(url.GetOrigin()); 418 GURL origin(navigation_handle->GetURL().GetOrigin());
417 if (url.spec() != url::kAboutBlankURL && 419 if (navigation_handle->GetURL().spec() != url::kAboutBlankURL &&
418 origin != kGaiaExtOrigin && 420 origin != kGaiaExtOrigin &&
419 !gaia::IsGaiaSignonRealm(origin)) { 421 !gaia::IsGaiaSignonRealm(origin)) {
420 confirm_untrusted_signin_ = true; 422 confirm_untrusted_signin_ = true;
421 } 423 }
422 } 424 }
423 } 425 }
424 426
425 // static 427 // static
426 bool InlineLoginHandlerImpl::CanOffer(Profile* profile, 428 bool InlineLoginHandlerImpl::CanOffer(Profile* profile,
427 CanOfferFor can_offer_for, 429 CanOfferFor can_offer_for,
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after
872 } 874 }
873 875
874 if (show_account_management) { 876 if (show_account_management) {
875 browser->window()->ShowAvatarBubbleFromAvatarButton( 877 browser->window()->ShowAvatarBubbleFromAvatarButton(
876 BrowserWindow::AVATAR_BUBBLE_MODE_ACCOUNT_MANAGEMENT, 878 BrowserWindow::AVATAR_BUBBLE_MODE_ACCOUNT_MANAGEMENT,
877 signin::ManageAccountsParams(), 879 signin::ManageAccountsParams(),
878 signin_metrics::AccessPoint::ACCESS_POINT_AVATAR_BUBBLE_SIGN_IN); 880 signin_metrics::AccessPoint::ACCESS_POINT_AVATAR_BUBBLE_SIGN_IN);
879 } 881 }
880 } 882 }
881 } 883 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698