1// Copyright 2014 The Chromium Authors. All rights reserved. 2// Use of this source code is governed by a BSD-style license that can be 3// found in the LICENSE file. 4 5#include "chrome/browser/chromeos/ui/inline_login_dialog.h" 6 7#include "base/bind.h" 8#include "base/logging.h" 9#include "chrome/browser/signin/signin_promo.h" 10#include "chrome/browser/ui/browser_dialogs.h" 11#include "content/public/browser/web_contents.h" 12#include "ui/views/controls/webview/webview.h" 13#include "ui/views/layout/box_layout.h" 14#include "ui/views/widget/widget.h" 15 16namespace { 17 18const int kGaiaViewHeight = 400; 19const int kGaiaViewWidth = 360; 20 21} // namespace 22 23namespace ui { 24 25// static 26void InlineLoginDialog::Show(content::BrowserContext* context) { 27 InlineLoginDialog* dialog = new InlineLoginDialog(); 28 chrome::ShowWebDialog(NULL, context, dialog); 29} 30 31InlineLoginDialog::InlineLoginDialog() { 32} 33 34InlineLoginDialog::~InlineLoginDialog() { 35} 36 37ModalType InlineLoginDialog::GetDialogModalType() const { 38 return MODAL_TYPE_SYSTEM; 39} 40 41base::string16 InlineLoginDialog::GetDialogTitle() const { 42 return base::string16(); 43} 44 45GURL InlineLoginDialog::GetDialogContentURL() const { 46 return GURL(signin::GetPromoURL(signin::SOURCE_AVATAR_BUBBLE_ADD_ACCOUNT, 47 false /* auto_close */, 48 true /* is_constrained */)); 49} 50 51void InlineLoginDialog::GetWebUIMessageHandlers( 52 std::vector<content::WebUIMessageHandler*>* handlers) const { 53} 54 55void InlineLoginDialog::GetDialogSize(gfx::Size* size) const { 56 *size = gfx::Size(kGaiaViewWidth, kGaiaViewHeight); 57} 58 59std::string InlineLoginDialog::GetDialogArgs() const { 60 return ""; 61} 62 63bool InlineLoginDialog::CanResizeDialog() const { 64 return false; 65} 66 67void InlineLoginDialog::OnDialogClosed(const std::string& json_retval) { 68 delete this; 69} 70 71void InlineLoginDialog::OnCloseContents(content::WebContents* source, 72 bool* out_close_dialog) { 73 if (out_close_dialog) 74 *out_close_dialog = true; 75} 76 77bool InlineLoginDialog::ShouldShowDialogTitle() const { 78 return true; 79} 80 81} // namespace ui 82