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/set_time_dialog.h" 6 7#include "chrome/browser/profiles/profile_manager.h" 8#include "chrome/browser/ui/browser_dialogs.h" 9#include "chrome/common/url_constants.h" 10#include "content/public/browser/user_metrics.h" 11#include "ui/gfx/size.h" 12 13using content::WebContents; 14using content::WebUIMessageHandler; 15 16namespace chromeos { 17 18namespace { 19 20const int kDefaultWidth = 490; 21const int kDefaultHeight = 235; 22 23} // namespace 24 25// static 26void SetTimeDialog::ShowDialog(gfx::NativeWindow owning_window) { 27 content::RecordAction(base::UserMetricsAction("Options_SetTimeDialog_Show")); 28 chrome::ShowWebDialog(owning_window, 29 ProfileManager::GetActiveUserProfile(), 30 new SetTimeDialog()); 31} 32 33SetTimeDialog::SetTimeDialog() { 34} 35 36SetTimeDialog::~SetTimeDialog() { 37} 38 39ui::ModalType SetTimeDialog::GetDialogModalType() const { 40 return ui::MODAL_TYPE_SYSTEM; 41} 42 43base::string16 SetTimeDialog::GetDialogTitle() const { 44 return base::string16(); 45} 46 47GURL SetTimeDialog::GetDialogContentURL() const { 48 return GURL(chrome::kChromeUISetTimeURL); 49} 50 51void SetTimeDialog::GetWebUIMessageHandlers( 52 std::vector<WebUIMessageHandler*>* handlers) const { 53} 54 55void SetTimeDialog::GetDialogSize(gfx::Size* size) const { 56 size->SetSize(kDefaultWidth, kDefaultHeight); 57} 58 59std::string SetTimeDialog::GetDialogArgs() const { 60 return std::string(); 61} 62 63void SetTimeDialog::OnDialogClosed(const std::string& json_retval) { 64 delete this; 65} 66 67void SetTimeDialog::OnCloseContents(WebContents* source, 68 bool* out_close_dialog) { 69 if (out_close_dialog) 70 *out_close_dialog = true; 71} 72 73bool SetTimeDialog::ShouldShowDialogTitle() const { 74 return false; 75} 76 77bool SetTimeDialog::HandleContextMenu( 78 const content::ContextMenuParams& params) { 79 // Disable context menu. 80 return true; 81} 82 83} // namespace chromeos 84