OLD | NEW |
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/inline_login_ui.h" | 5 #include "chrome/browser/ui/webui/inline_login_ui.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 } | 125 } |
126 | 126 |
127 // Call OneClickSigninSyncStarter to exchange cookies for oauth tokens. | 127 // Call OneClickSigninSyncStarter to exchange cookies for oauth tokens. |
128 // OneClickSigninSyncStarter will delete itself once the job is done. | 128 // OneClickSigninSyncStarter will delete itself once the job is done. |
129 // TODO(guohui): should collect from user whether they want to use | 129 // TODO(guohui): should collect from user whether they want to use |
130 // default sync settings or configure first. | 130 // default sync settings or configure first. |
131 new OneClickSigninSyncStarter( | 131 new OneClickSigninSyncStarter( |
132 profile_, NULL, "0" /* session_index 0 for the default user */, | 132 profile_, NULL, "0" /* session_index 0 for the default user */, |
133 UTF16ToASCII(email), UTF16ToASCII(password), | 133 UTF16ToASCII(email), UTF16ToASCII(password), |
134 OneClickSigninSyncStarter::SYNC_WITH_DEFAULT_SETTINGS, | 134 OneClickSigninSyncStarter::SYNC_WITH_DEFAULT_SETTINGS, |
135 true /* force_same_tab_navigation */, | 135 web_ui()->GetWebContents(), |
136 OneClickSigninSyncStarter::NO_CONFIRMATION, | 136 OneClickSigninSyncStarter::NO_CONFIRMATION, |
137 signin::SOURCE_UNKNOWN, | 137 signin::SOURCE_UNKNOWN, |
138 OneClickSigninSyncStarter::Callback()); | 138 OneClickSigninSyncStarter::Callback()); |
139 web_ui()->CallJavascriptFunction("inline.login.closeDialog"); | 139 web_ui()->CallJavascriptFunction("inline.login.closeDialog"); |
140 #endif | 140 #endif |
141 } | 141 } |
142 | 142 |
143 Profile* profile_; | 143 Profile* profile_; |
144 #if defined(OS_CHROMEOS) | 144 #if defined(OS_CHROMEOS) |
145 scoped_ptr<chromeos::OAuth2TokenFetcher> oauth2_token_fetcher_; | 145 scoped_ptr<chromeos::OAuth2TokenFetcher> oauth2_token_fetcher_; |
146 scoped_ptr<InlineLoginUIOAuth2Delegate> oauth2_delegate_; | 146 scoped_ptr<InlineLoginUIOAuth2Delegate> oauth2_delegate_; |
147 #endif | 147 #endif |
148 | 148 |
149 DISALLOW_COPY_AND_ASSIGN(InlineLoginUIHandler); | 149 DISALLOW_COPY_AND_ASSIGN(InlineLoginUIHandler); |
150 }; | 150 }; |
151 | 151 |
152 } // namespace | 152 } // namespace |
153 | 153 |
154 InlineLoginUI::InlineLoginUI(content::WebUI* web_ui) | 154 InlineLoginUI::InlineLoginUI(content::WebUI* web_ui) |
155 : WebDialogUI(web_ui), | 155 : WebDialogUI(web_ui), |
156 auth_extension_(Profile::FromWebUI(web_ui)) { | 156 auth_extension_(Profile::FromWebUI(web_ui)) { |
157 Profile* profile = Profile::FromWebUI(web_ui); | 157 Profile* profile = Profile::FromWebUI(web_ui); |
158 content::WebUIDataSource::Add(profile, CreateWebUIDataSource()); | 158 content::WebUIDataSource::Add(profile, CreateWebUIDataSource()); |
159 | 159 |
160 web_ui->AddMessageHandler(new InlineLoginUIHandler(profile)); | 160 web_ui->AddMessageHandler(new InlineLoginUIHandler(profile)); |
161 } | 161 } |
162 | 162 |
163 InlineLoginUI::~InlineLoginUI() {} | 163 InlineLoginUI::~InlineLoginUI() {} |
OLD | NEW |