| Index: chrome/browser/ui/webui/signin/inline_login_handler_impl.cc
|
| ===================================================================
|
| --- chrome/browser/ui/webui/signin/inline_login_handler_impl.cc (revision 251944)
|
| +++ chrome/browser/ui/webui/signin/inline_login_handler_impl.cc (working copy)
|
| @@ -4,6 +4,7 @@
|
|
|
| #include "chrome/browser/ui/webui/signin/inline_login_handler_impl.h"
|
|
|
| +#include "base/atomic_sequence_num.h"
|
| #include "base/bind.h"
|
| #include "base/prefs/pref_service.h"
|
| #include "base/strings/string_number_conversions.h"
|
| @@ -19,7 +20,6 @@
|
| #include "chrome/browser/ui/sync/one_click_signin_helper.h"
|
| #include "chrome/browser/ui/tabs/tab_strip_model.h"
|
| #include "chrome/common/pref_names.h"
|
| -#include "chrome/common/url_constants.h"
|
| #include "content/public/browser/storage_partition.h"
|
| #include "content/public/browser/web_contents.h"
|
| #include "content/public/browser/web_ui.h"
|
| @@ -30,10 +30,13 @@
|
|
|
| namespace {
|
|
|
| +// Global SequenceNumber used for generating unique webview partition IDs.
|
| +base::StaticAtomicSequenceNumber next_partition_id;
|
| +
|
| } // empty namespace
|
|
|
| InlineLoginHandlerImpl::InlineLoginHandlerImpl()
|
| - : weak_factory_(this), choose_what_to_sync_(false) {
|
| + : weak_factory_(this), choose_what_to_sync_(false), partition_id_("") {
|
| }
|
|
|
| InlineLoginHandlerImpl::~InlineLoginHandlerImpl() {}
|
| @@ -47,7 +50,7 @@
|
| }
|
|
|
| void InlineLoginHandlerImpl::SetExtraInitParams(base::DictionaryValue& params) {
|
| - params.SetInteger("authMode", InlineLoginHandler::kDesktopAuthMode);
|
| + params.SetInteger("authMode", InlineLoginHandler::kInlineAuthMode);
|
|
|
| const GURL& current_url = web_ui()->GetWebContents()->GetURL();
|
| signin::Source source = signin::GetSourceForPromoURL(current_url);
|
| @@ -89,6 +92,13 @@
|
| net::GetValueForKeyInQuery(current_url, "readOnlyEmail", &read_only_email);
|
| if (!read_only_email.empty())
|
| params.SetString("readOnlyEmail", read_only_email);
|
| +
|
| + net::GetValueForKeyInQuery(current_url, "partitionId", &partition_id_);
|
| + if (partition_id_.empty()) {
|
| + partition_id_ =
|
| + "gaia-webview-" + base::IntToString(next_partition_id.GetNext());
|
| + }
|
| + params.SetString("partitionId", partition_id_);
|
| }
|
|
|
|
|
| @@ -101,6 +111,8 @@
|
| GURL main_frame_url(web_contents->GetURL());
|
| main_frame_url = net::AppendOrReplaceQueryParameter(
|
| main_frame_url, "frameUrl", UTF16ToASCII(url_str));
|
| + main_frame_url = net::AppendOrReplaceQueryParameter(
|
| + main_frame_url, "partitionId", partition_id_);
|
| chrome::NavigateParams params(
|
| Profile::FromWebUI(web_ui()),
|
| net::AppendOrReplaceQueryParameter(main_frame_url, "constrained", "0"),
|
| @@ -111,7 +123,7 @@
|
| }
|
|
|
| void InlineLoginHandlerImpl::CompleteLogin(const base::ListValue* args) {
|
| - DCHECK(email_.empty() && password_.empty() && session_index_.empty());
|
| + DCHECK(email_.empty() && password_.empty());
|
|
|
| content::WebContents* contents = web_ui()->GetWebContents();
|
| const GURL& current_url = contents->GetURL();
|
| @@ -150,10 +162,6 @@
|
| }
|
| }
|
|
|
| - base::string16 session_index;
|
| - dict->GetString("sessionIndex", &session_index);
|
| - session_index_ = UTF16ToASCII(session_index);
|
| - DCHECK(!session_index_.empty());
|
| dict->GetBoolean("chooseWhatToSync", &choose_what_to_sync_);
|
|
|
| signin::Source source = signin::GetSourceForPromoURL(current_url);
|
| @@ -172,12 +180,13 @@
|
| content::StoragePartition* partition =
|
| content::BrowserContext::GetStoragePartitionForSite(
|
| contents->GetBrowserContext(),
|
| - GURL(chrome::kChromeUIChromeSigninURL));
|
| + GURL("chrome-guest://mfffpogegjflfpflabcdkioaeobkgjik/?" +
|
| + partition_id_));
|
|
|
| auth_fetcher_.reset(new GaiaAuthFetcher(this,
|
| GaiaConstants::kChromeSource,
|
| partition->GetURLRequestContext()));
|
| - auth_fetcher_->StartCookieForOAuthCodeExchange(session_index_);
|
| + auth_fetcher_->StartCookieForOAuthCodeExchange("0");
|
| }
|
|
|
| void InlineLoginHandlerImpl::OnClientOAuthCodeSuccess(
|
| @@ -244,7 +253,6 @@
|
|
|
| email_.clear();
|
| password_.clear();
|
| - session_index_.clear();
|
| web_ui()->CallJavascriptFunction("inline.login.closeDialog");
|
| }
|
|
|
| @@ -268,7 +276,6 @@
|
|
|
| email_.clear();
|
| password_.clear();
|
| - session_index_.clear();
|
| }
|
|
|
| void InlineLoginHandlerImpl::SyncStarterCallback(
|
|
|