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