OLD | NEW |
(Empty) | |
| 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 "grit/generated_resources.h" |
| 11 #include "ui/base/l10n/l10n_util.h" |
| 12 #include "ui/gfx/size.h" |
| 13 |
| 14 using content::WebContents; |
| 15 using content::WebUIMessageHandler; |
| 16 |
| 17 namespace chromeos { |
| 18 |
| 19 namespace { |
| 20 |
| 21 const int kDefaultWidth = 490; |
| 22 const int kDefaultHeight = 235; |
| 23 |
| 24 } // namespace |
| 25 |
| 26 // static |
| 27 void SetTimeDialog::ShowDialog(gfx::NativeWindow owning_window) { |
| 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 |
OLD | NEW |