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 #ifndef CHROME_BROWSER_CHROMEOS_SET_TIME_DIALOG_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_SET_TIME_DIALOG_H_ |
6 #define CHROME_BROWSER_CHROMEOS_SET_TIME_DIALOG_H_ | 6 #define CHROME_BROWSER_CHROMEOS_SET_TIME_DIALOG_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "base/values.h" | 12 #include "base/values.h" |
13 #include "ui/gfx/native_widget_types.h" | 13 #include "ui/gfx/native_widget_types.h" |
14 #include "ui/web_dialogs/web_dialog_delegate.h" | 14 #include "ui/web_dialogs/web_dialog_delegate.h" |
15 | 15 |
16 namespace chromeos { | 16 namespace chromeos { |
17 | 17 |
18 // Set Time dialog for setting the system time, date and time zone. | 18 // Set Time dialog for setting the system time, date and time zone. |
19 class SetTimeDialog : public ui::WebDialogDelegate { | 19 class SetTimeDialog : public ui::WebDialogDelegate { |
20 public: | 20 public: |
| 21 // Shows the dialog as a child of |parent|, for example the webui settings |
| 22 // window. |
| 23 static void ShowDialogInParent(gfx::NativeWindow parent); |
| 24 |
| 25 // Shows the dialog in a given container in the ash window hierarchy. Used |
| 26 // when there is no explicit parent, for example at the login screen where |
| 27 // the general settings window is not available. |container_id| is an |
| 28 // an ash window container id. See ash/public/cpp/shell_window_ids.h. |
| 29 static void ShowDialogInContainer(int container_id); |
| 30 |
| 31 private: |
21 SetTimeDialog(); | 32 SetTimeDialog(); |
22 ~SetTimeDialog() override; | 33 ~SetTimeDialog() override; |
23 | 34 |
24 static void ShowDialog(gfx::NativeWindow owning_window); | 35 static void ShowDialogImpl(gfx::NativeWindow parent, int container_id); |
25 | 36 |
26 private: | |
27 // ui::WebDialogDelegate: | 37 // ui::WebDialogDelegate: |
28 ui::ModalType GetDialogModalType() const override; | 38 ui::ModalType GetDialogModalType() const override; |
29 base::string16 GetDialogTitle() const override; | 39 base::string16 GetDialogTitle() const override; |
30 GURL GetDialogContentURL() const override; | 40 GURL GetDialogContentURL() const override; |
31 void GetWebUIMessageHandlers( | 41 void GetWebUIMessageHandlers( |
32 std::vector<content::WebUIMessageHandler*>* handlers) const override; | 42 std::vector<content::WebUIMessageHandler*>* handlers) const override; |
33 void GetDialogSize(gfx::Size* size) const override; | 43 void GetDialogSize(gfx::Size* size) const override; |
34 std::string GetDialogArgs() const override; | 44 std::string GetDialogArgs() const override; |
35 void OnDialogClosed(const std::string& json_retval) override; | 45 void OnDialogClosed(const std::string& json_retval) override; |
36 void OnCloseContents(content::WebContents* source, | 46 void OnCloseContents(content::WebContents* source, |
37 bool* out_close_dialog) override; | 47 bool* out_close_dialog) override; |
38 bool ShouldShowDialogTitle() const override; | 48 bool ShouldShowDialogTitle() const override; |
39 bool HandleContextMenu(const content::ContextMenuParams& params) override; | 49 bool HandleContextMenu(const content::ContextMenuParams& params) override; |
40 | 50 |
41 DISALLOW_COPY_AND_ASSIGN(SetTimeDialog); | 51 DISALLOW_COPY_AND_ASSIGN(SetTimeDialog); |
42 }; | 52 }; |
43 | 53 |
44 } // namespace chromeos | 54 } // namespace chromeos |
45 | 55 |
46 #endif // CHROME_BROWSER_CHROMEOS_SET_TIME_DIALOG_H_ | 56 #endif // CHROME_BROWSER_CHROMEOS_SET_TIME_DIALOG_H_ |
OLD | NEW |