Home | History | Annotate | Download | only in sync
      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
      3 // found in the LICENSE file.
      4 
      5 #include "chrome/browser/ui/sync/inline_login_dialog.h"
      6 
      7 #include "chrome/browser/profiles/profile.h"
      8 #include "chrome/browser/ui/browser_dialogs.h"
      9 #include "chrome/common/url_constants.h"
     10 #include "ui/gfx/size.h"
     11 #include "url/gurl.h"
     12 
     13 // static
     14 void InlineLoginDialog::Show(Profile* profile) {
     15   chrome::ShowWebDialog(NULL, profile, new InlineLoginDialog(profile));
     16 }
     17 
     18 InlineLoginDialog::InlineLoginDialog(Profile* profile)
     19     : profile_(profile) {
     20 }
     21 
     22 ui::ModalType InlineLoginDialog::GetDialogModalType() const {
     23   return ui::MODAL_TYPE_SYSTEM;
     24 }
     25 
     26 string16 InlineLoginDialog::GetDialogTitle() const {
     27   return string16();
     28 }
     29 
     30 GURL InlineLoginDialog::GetDialogContentURL() const {
     31   return GURL(chrome::kChromeUIInlineLoginURL);
     32 }
     33 
     34 void InlineLoginDialog::GetWebUIMessageHandlers(
     35     std::vector<content::WebUIMessageHandler*>* handlers) const {
     36 }
     37 
     38 void InlineLoginDialog::GetDialogSize(gfx::Size* size) const {
     39   size->SetSize(380, 290);
     40 }
     41 
     42 std::string InlineLoginDialog::GetDialogArgs() const {
     43   return "[]";
     44 }
     45 
     46 void InlineLoginDialog::OnDialogClosed(const std::string& json_retval) {
     47   delete this;
     48 }
     49 
     50 void InlineLoginDialog::OnCloseContents(
     51     content::WebContents* source, bool* out_close_dialog) {
     52   if (out_close_dialog)
     53     *out_close_dialog = true;
     54 }
     55 
     56 bool InlineLoginDialog::ShouldShowDialogTitle() const {
     57   return false;
     58 }
     59 
     60 bool InlineLoginDialog::HandleContextMenu(
     61     const content::ContextMenuParams& params) {
     62   return true;
     63 }
     64