| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/chromeos/set_time_dialog.h" | 5 #include "chrome/browser/chromeos/set_time_dialog.h" |
| 6 | 6 |
| 7 #include "ash/public/cpp/shell_window_ids.h" | 7 #include "ash/public/cpp/shell_window_ids.h" |
| 8 #include "chrome/browser/profiles/profile_manager.h" | 8 #include "chrome/browser/profiles/profile_manager.h" |
| 9 #include "chrome/browser/ui/ash/web_dialog_util.h" | 9 #include "chrome/browser/ui/browser_dialogs.h" |
| 10 #include "chrome/common/url_constants.h" | 10 #include "chrome/common/url_constants.h" |
| 11 #include "content/public/browser/user_metrics.h" | 11 #include "content/public/browser/user_metrics.h" |
| 12 #include "ui/gfx/geometry/size.h" | 12 #include "ui/gfx/geometry/size.h" |
| 13 | 13 |
| 14 using content::WebContents; | 14 using content::WebContents; |
| 15 using content::WebUIMessageHandler; | 15 using content::WebUIMessageHandler; |
| 16 | 16 |
| 17 namespace chromeos { | 17 namespace chromeos { |
| 18 | 18 |
| 19 namespace { | 19 namespace { |
| 20 | 20 |
| 21 const int kDefaultWidth = 490; | 21 const int kDefaultWidth = 490; |
| 22 const int kDefaultHeight = 235; | 22 const int kDefaultHeight = 235; |
| 23 | 23 |
| 24 } // namespace | 24 } // namespace |
| 25 | 25 |
| 26 // static | 26 // static |
| 27 void SetTimeDialog::ShowDialogInParent(gfx::NativeWindow parent) { | 27 void SetTimeDialog::ShowDialogInParent(gfx::NativeWindow parent) { |
| 28 DCHECK(parent); | 28 DCHECK(parent); |
| 29 ShowDialogImpl(parent, ash::kShellWindowId_Invalid); | 29 content::RecordAction(base::UserMetricsAction("Options_SetTimeDialog_Show")); |
| 30 chrome::ShowWebDialog(parent, ProfileManager::GetActiveUserProfile(), |
| 31 new SetTimeDialog()); |
| 30 } | 32 } |
| 31 | 33 |
| 32 // static | 34 // static |
| 33 void SetTimeDialog::ShowDialogInContainer(int container_id) { | 35 void SetTimeDialog::ShowDialogInContainer(int container_id) { |
| 34 DCHECK_NE(container_id, ash::kShellWindowId_Invalid); | 36 DCHECK_NE(container_id, ash::kShellWindowId_Invalid); |
| 35 ShowDialogImpl(nullptr, container_id); | 37 content::RecordAction(base::UserMetricsAction("Options_SetTimeDialog_Show")); |
| 38 chrome::ShowWebDialogInContainer(container_id, |
| 39 ProfileManager::GetActiveUserProfile(), |
| 40 new SetTimeDialog()); |
| 36 } | 41 } |
| 37 | 42 |
| 38 SetTimeDialog::SetTimeDialog() { | 43 SetTimeDialog::SetTimeDialog() { |
| 39 } | 44 } |
| 40 | 45 |
| 41 SetTimeDialog::~SetTimeDialog() { | 46 SetTimeDialog::~SetTimeDialog() { |
| 42 } | 47 } |
| 43 | 48 |
| 44 // static | |
| 45 void SetTimeDialog::ShowDialogImpl(gfx::NativeWindow parent, int container_id) { | |
| 46 DCHECK(parent || container_id != ash::kShellWindowId_Invalid); | |
| 47 content::RecordAction(base::UserMetricsAction("Options_SetTimeDialog_Show")); | |
| 48 chrome::ShowWebDialogWithContainer(parent, container_id, | |
| 49 ProfileManager::GetActiveUserProfile(), | |
| 50 new SetTimeDialog()); | |
| 51 } | |
| 52 | |
| 53 ui::ModalType SetTimeDialog::GetDialogModalType() const { | 49 ui::ModalType SetTimeDialog::GetDialogModalType() const { |
| 54 return ui::MODAL_TYPE_SYSTEM; | 50 return ui::MODAL_TYPE_SYSTEM; |
| 55 } | 51 } |
| 56 | 52 |
| 57 base::string16 SetTimeDialog::GetDialogTitle() const { | 53 base::string16 SetTimeDialog::GetDialogTitle() const { |
| 58 return base::string16(); | 54 return base::string16(); |
| 59 } | 55 } |
| 60 | 56 |
| 61 GURL SetTimeDialog::GetDialogContentURL() const { | 57 GURL SetTimeDialog::GetDialogContentURL() const { |
| 62 return GURL(chrome::kChromeUISetTimeURL); | 58 return GURL(chrome::kChromeUISetTimeURL); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 87 return false; | 83 return false; |
| 88 } | 84 } |
| 89 | 85 |
| 90 bool SetTimeDialog::HandleContextMenu( | 86 bool SetTimeDialog::HandleContextMenu( |
| 91 const content::ContextMenuParams& params) { | 87 const content::ContextMenuParams& params) { |
| 92 // Disable context menu. | 88 // Disable context menu. |
| 93 return true; | 89 return true; |
| 94 } | 90 } |
| 95 | 91 |
| 96 } // namespace chromeos | 92 } // namespace chromeos |
| OLD | NEW |