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/signin/inline_login_handler_impl.h" | 5 #include "chrome/browser/ui/webui/signin/inline_login_handler_impl.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 | 179 |
180 } // namespace | 180 } // namespace |
181 | 181 |
182 InlineLoginHandlerImpl::InlineLoginHandlerImpl() | 182 InlineLoginHandlerImpl::InlineLoginHandlerImpl() |
183 : weak_factory_(this), | 183 : weak_factory_(this), |
184 choose_what_to_sync_(false) { | 184 choose_what_to_sync_(false) { |
185 } | 185 } |
186 | 186 |
187 InlineLoginHandlerImpl::~InlineLoginHandlerImpl() {} | 187 InlineLoginHandlerImpl::~InlineLoginHandlerImpl() {} |
188 | 188 |
| 189 bool InlineLoginHandlerImpl::HandleContextMenu( |
| 190 const content::ContextMenuParams& params) { |
| 191 #ifndef NDEBUG |
| 192 return false; |
| 193 #else |
| 194 return true; |
| 195 #endif |
| 196 } |
| 197 |
189 void InlineLoginHandlerImpl::SetExtraInitParams(base::DictionaryValue& params) { | 198 void InlineLoginHandlerImpl::SetExtraInitParams(base::DictionaryValue& params) { |
190 params.SetString("service", "chromiumsync"); | 199 params.SetString("service", "chromiumsync"); |
191 | 200 |
192 signin::Source source = | 201 content::WebContents* contents = web_ui()->GetWebContents(); |
193 signin::GetSourceForPromoURL(web_ui()->GetWebContents()->GetURL()); | 202 const GURL& current_url = contents->GetURL(); |
| 203 std::string is_constrained; |
| 204 net::GetValueForKeyInQuery(current_url, "constrained", &is_constrained); |
| 205 if (is_constrained == "1") |
| 206 contents->SetDelegate(this); |
| 207 |
| 208 signin::Source source = signin::GetSourceForPromoURL(current_url); |
194 OneClickSigninHelper::LogHistogramValue( | 209 OneClickSigninHelper::LogHistogramValue( |
195 source, one_click_signin::HISTOGRAM_SHOWN); | 210 source, one_click_signin::HISTOGRAM_SHOWN); |
196 } | 211 } |
197 | 212 |
198 void InlineLoginHandlerImpl::CompleteLogin(const base::ListValue* args) { | 213 void InlineLoginHandlerImpl::CompleteLogin(const base::ListValue* args) { |
199 content::WebContents* contents = web_ui()->GetWebContents(); | 214 content::WebContents* contents = web_ui()->GetWebContents(); |
200 const GURL& current_url = contents->GetURL(); | 215 const GURL& current_url = contents->GetURL(); |
201 | 216 |
202 const base::DictionaryValue* dict = NULL; | 217 const base::DictionaryValue* dict = NULL; |
203 args->GetDictionary(0, &dict); | 218 args->GetDictionary(0, &dict); |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
358 TabStripModel* tab_strip_model = browser->tab_strip_model(); | 373 TabStripModel* tab_strip_model = browser->tab_strip_model(); |
359 if (tab_strip_model) { | 374 if (tab_strip_model) { |
360 int index = tab_strip_model->GetIndexOfWebContents(tab); | 375 int index = tab_strip_model->GetIndexOfWebContents(tab); |
361 if (index != TabStripModel::kNoTab) { | 376 if (index != TabStripModel::kNoTab) { |
362 tab_strip_model->ExecuteContextMenuCommand( | 377 tab_strip_model->ExecuteContextMenuCommand( |
363 index, TabStripModel::CommandCloseTab); | 378 index, TabStripModel::CommandCloseTab); |
364 } | 379 } |
365 } | 380 } |
366 } | 381 } |
367 } | 382 } |
OLD | NEW |