Home | History | Annotate | Download | only in chromeos
      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 
     13 using content::WebContents;
     14 using content::WebUIMessageHandler;
     15 
     16 namespace chromeos {
     17 
     18 namespace {
     19 
     20 const int kDefaultWidth = 490;
     21 const int kDefaultHeight = 235;
     22 
     23 }  // namespace
     24 
     25 // static
     26 void 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 
     33 SetTimeDialog::SetTimeDialog() {
     34 }
     35 
     36 SetTimeDialog::~SetTimeDialog() {
     37 }
     38 
     39 ui::ModalType SetTimeDialog::GetDialogModalType() const {
     40   return ui::MODAL_TYPE_SYSTEM;
     41 }
     42 
     43 base::string16 SetTimeDialog::GetDialogTitle() const {
     44   return base::string16();
     45 }
     46 
     47 GURL SetTimeDialog::GetDialogContentURL() const {
     48   return GURL(chrome::kChromeUISetTimeURL);
     49 }
     50 
     51 void SetTimeDialog::GetWebUIMessageHandlers(
     52     std::vector<WebUIMessageHandler*>* handlers) const {
     53 }
     54 
     55 void SetTimeDialog::GetDialogSize(gfx::Size* size) const {
     56   size->SetSize(kDefaultWidth, kDefaultHeight);
     57 }
     58 
     59 std::string SetTimeDialog::GetDialogArgs() const {
     60   return std::string();
     61 }
     62 
     63 void SetTimeDialog::OnDialogClosed(const std::string& json_retval) {
     64   delete this;
     65 }
     66 
     67 void SetTimeDialog::OnCloseContents(WebContents* source,
     68                                     bool* out_close_dialog) {
     69   if (out_close_dialog)
     70     *out_close_dialog = true;
     71 }
     72 
     73 bool SetTimeDialog::ShouldShowDialogTitle() const {
     74   return false;
     75 }
     76 
     77 bool SetTimeDialog::HandleContextMenu(
     78     const content::ContextMenuParams& params) {
     79   // Disable context menu.
     80   return true;
     81 }
     82 
     83 }  // namespace chromeos
     84