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

Unified Diff: chrome/browser/ui/user_manager.cc

Issue 2168953002: Disables the context menu in User Manager's reauth dialog (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comments Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/user_manager.h ('k') | chrome/browser/ui/views/profiles/user_manager_view.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/user_manager.cc
diff --git a/chrome/browser/ui/user_manager.cc b/chrome/browser/ui/user_manager.cc
index 9426c81d64e01ebffce2756e74a102999e78d600..941a29264bc1ddb2ab262abf88c28df0d79ed309 100644
--- a/chrome/browser/ui/user_manager.cc
+++ b/chrome/browser/ui/user_manager.cc
@@ -5,6 +5,7 @@
#include "chrome/browser/ui/user_manager.h"
#include "chrome/browser/signin/signin_promo.h"
+#include "chrome/common/url_constants.h"
#include "components/guest_view/browser/guest_view_manager.h"
#include "google_apis/gaia/gaia_urls.h"
@@ -18,46 +19,36 @@ bool AddToSet(std::set<content::WebContents*>* content_set,
} // namespace
-UserManager::ReauthDialogObserver::ReauthDialogObserver(
- content::WebContents* web_contents, const std::string& email_address)
- : email_address_(email_address) {
- // Observe navigations of the web contents so that the dialog can close itself
- // when the sign in process is done.
- Observe(web_contents);
+UserManager::BaseReauthDialogDelegate::BaseReauthDialogDelegate(
+ content::WebContents* web_contents) : web_contents_(web_contents) {}
+
+bool UserManager::BaseReauthDialogDelegate::HandleContextMenu(
+ const content::ContextMenuParams& params) {
+ // Ignores context menu.
+ return true;
}
-void UserManager::ReauthDialogObserver::DidStopLoading() {
- // If the sign in process reaches the termination URL, close the dialog.
- // Make sure to remove any parts of the URL that gaia might append during
- // signin.
- GURL url = web_contents()->GetURL();
- url::Replacements<char> replacements;
- replacements.ClearQuery();
- replacements.ClearRef();
- if (url.ReplaceComponents(replacements) ==
- GaiaUrls::GetInstance()->signin_completed_continue_url()) {
- CloseReauthDialog();
+void UserManager::BaseReauthDialogDelegate::LoadingStateChanged(
+ content::WebContents* source, bool to_different_document) {
+ if (source->IsLoading())
return;
- }
// If still observing the top level web contents, try to find the embedded
sky 2016/08/02 03:14:08 I think this would be less confusing if you cached
Moe 2016/08/02 15:22:59 Done. In fact since the |source| WebContents is pa
- // webview and observe it instead. The webview may not be found in the
+ // webview and manage that instead. The webview may not be found in the
// initial page load since it loads asynchronously.
- if (url.GetOrigin() !=
- signin::GetReauthURLWithEmail(
- signin_metrics::AccessPoint::ACCESS_POINT_USER_MANAGER,
- signin_metrics::Reason::REASON_UNLOCK, email_address_)
- .GetOrigin()) {
+ GURL url = web_contents_->GetURL();
+ if (url.GetOrigin() != GURL(chrome::kChromeUIChromeSigninURL))
return;
- }
std::set<content::WebContents*> content_set;
guest_view::GuestViewManager* manager =
guest_view::GuestViewManager::FromBrowserContext(
- web_contents()->GetBrowserContext());
+ web_contents_->GetBrowserContext());
if (manager)
- manager->ForEachGuest(web_contents(), base::Bind(&AddToSet, &content_set));
+ manager->ForEachGuest(web_contents_, base::Bind(&AddToSet, &content_set));
DCHECK_LE(content_set.size(), 1U);
- if (!content_set.empty())
- Observe(*content_set.begin());
+ if (!content_set.empty()) {
+ web_contents_ = *content_set.begin();
sky 2016/07/25 14:53:22 How come web_contents_ is reset here? This class t
Moe 2016/08/01 21:44:59 Sorry for the late reply... Because we would need
+ web_contents_->SetDelegate(this);
+ }
}
« no previous file with comments | « chrome/browser/ui/user_manager.h ('k') | chrome/browser/ui/views/profiles/user_manager_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698