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

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

Issue 1235173002: Revert of Chrome user menu shouldn't close if a tab steals focus (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 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.h" 5 #include "chrome/browser/ui/webui/signin/inline_login_handler.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/prefs/pref_service.h" 8 #include "base/prefs/pref_service.h"
9 #include "base/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
11 #include "base/values.h" 11 #include "base/values.h"
12 #include "chrome/browser/browser_process.h" 12 #include "chrome/browser/browser_process.h"
13 #include "chrome/browser/extensions/signin/gaia_auth_extension_loader.h" 13 #include "chrome/browser/extensions/signin/gaia_auth_extension_loader.h"
14 #include "chrome/browser/profiles/profile.h" 14 #include "chrome/browser/profiles/profile.h"
15 #include "chrome/browser/signin/signin_promo.h" 15 #include "chrome/browser/signin/signin_promo.h"
16 #include "chrome/browser/ui/browser_finder.h"
17 #include "chrome/browser/ui/browser_navigator.h" 16 #include "chrome/browser/ui/browser_navigator.h"
18 #include "chrome/browser/ui/browser_window.h"
19 #include "chrome/common/pref_names.h" 17 #include "chrome/common/pref_names.h"
20 #include "components/signin/core/common/profile_management_switches.h"
21 #include "content/public/browser/web_contents.h" 18 #include "content/public/browser/web_contents.h"
22 #include "content/public/browser/web_ui.h" 19 #include "content/public/browser/web_ui.h"
23 #include "google_apis/gaia/gaia_urls.h" 20 #include "google_apis/gaia/gaia_urls.h"
24 #include "net/base/url_util.h" 21 #include "net/base/url_util.h"
25 #include "ui/aura/window.h"
26 22
27 InlineLoginHandler::InlineLoginHandler() {} 23 InlineLoginHandler::InlineLoginHandler() {}
28 24
29 InlineLoginHandler::~InlineLoginHandler() {} 25 InlineLoginHandler::~InlineLoginHandler() {}
30 26
31 void InlineLoginHandler::RegisterMessages() { 27 void InlineLoginHandler::RegisterMessages() {
32 web_ui()->RegisterMessageCallback("initialize", 28 web_ui()->RegisterMessageCallback("initialize",
33 base::Bind(&InlineLoginHandler::HandleInitializeMessage, 29 base::Bind(&InlineLoginHandler::HandleInitializeMessage,
34 base::Unretained(this))); 30 base::Unretained(this)));
35 web_ui()->RegisterMessageCallback("completeLogin", 31 web_ui()->RegisterMessageCallback("completeLogin",
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 main_frame_url = net::AppendOrReplaceQueryParameter( 129 main_frame_url = net::AppendOrReplaceQueryParameter(
134 main_frame_url, signin::kSignInPromoQueryKeyShowAccountManagement, "1"); 130 main_frame_url, signin::kSignInPromoQueryKeyShowAccountManagement, "1");
135 131
136 chrome::NavigateParams params( 132 chrome::NavigateParams params(
137 profile, 133 profile,
138 net::AppendOrReplaceQueryParameter( 134 net::AppendOrReplaceQueryParameter(
139 main_frame_url, signin::kSignInPromoQueryKeyConstrained, "0"), 135 main_frame_url, signin::kSignInPromoQueryKeyConstrained, "0"),
140 ui::PAGE_TRANSITION_AUTO_TOPLEVEL); 136 ui::PAGE_TRANSITION_AUTO_TOPLEVEL);
141 chrome::Navigate(&params); 137 chrome::Navigate(&params);
142 138
143 signin_metrics::Source source = signin::GetSourceForPromoURL(main_frame_url);
144 if (source == signin_metrics::SOURCE_AVATAR_BUBBLE_SIGN_IN ||
145 source == signin_metrics::SOURCE_AVATAR_BUBBLE_ADD_ACCOUNT) {
146 // Close the singleton avatar bubble to reveal the full tab UI.
147 Browser* browser = chrome::FindAnyBrowser(
148 profile, false,
149 chrome::GetHostDesktopTypeForNativeView(web_contents->GetNativeView()));
150 if (browser != nullptr)
151 browser->window()->CloseAvatarBubbleFromAvatarButton();
152 }
153
154 web_ui()->CallJavascriptFunction("inline.login.closeDialog"); 139 web_ui()->CallJavascriptFunction("inline.login.closeDialog");
155 } 140 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/profiles/profile_chooser_view.cc ('k') | chrome/test/base/test_browser_window.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698