OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_SIM_DIALOG_DELEGATE_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_SIM_DIALOG_DELEGATE_H_ |
6 #define CHROME_BROWSER_CHROMEOS_SIM_DIALOG_DELEGATE_H_ | 6 #define CHROME_BROWSER_CHROMEOS_SIM_DIALOG_DELEGATE_H_ |
7 | 7 |
8 #include "base/compiler_specific.h" | |
9 #include "base/macros.h" | 8 #include "base/macros.h" |
10 #include "ui/gfx/native_widget_types.h" | 9 #include "ui/gfx/native_widget_types.h" |
11 #include "ui/web_dialogs/web_dialog_delegate.h" | 10 #include "ui/web_dialogs/web_dialog_delegate.h" |
12 | 11 |
13 namespace chromeos { | 12 namespace chromeos { |
14 | 13 |
15 // SIM unlock dialog displayed in cases when SIM card has to be unlocked. | 14 // SIM unlock dialog displayed in cases when SIM card has to be unlocked. |
16 class SimDialogDelegate : public ui::WebDialogDelegate { | 15 class SimDialogDelegate : public ui::WebDialogDelegate { |
17 public: | 16 public: |
18 // Type of the SIM dialog that is launched. | 17 // Type of the SIM dialog that is launched. |
19 typedef enum SimDialogMode { | 18 typedef enum SimDialogMode { |
20 SIM_DIALOG_UNLOCK = 0, // General unlock flow dialog (PIN/PUK). | 19 SIM_DIALOG_UNLOCK = 0, // General unlock flow dialog (PIN/PUK). |
21 SIM_DIALOG_CHANGE_PIN = 1, // Change PIN dialog. | 20 SIM_DIALOG_CHANGE_PIN = 1, // Change PIN dialog. |
22 SIM_DIALOG_SET_LOCK_ON = 2, // Enable RequirePin restriction. | 21 SIM_DIALOG_SET_LOCK_ON = 2, // Enable RequirePin restriction. |
23 SIM_DIALOG_SET_LOCK_OFF = 3, // Disable RequirePin restriction. | 22 SIM_DIALOG_SET_LOCK_OFF = 3, // Disable RequirePin restriction. |
24 } SimDialogMode; | 23 } SimDialogMode; |
25 | 24 |
26 explicit SimDialogDelegate(SimDialogMode dialog_mode); | 25 explicit SimDialogDelegate(SimDialogMode dialog_mode); |
27 | 26 |
28 // Shows the SIM unlock dialog box with one of the specified modes. | 27 // Shows the SIM unlock dialog box with one of the specified modes. If the |
| 28 // |owning_window| is null the dialog is placed in the appropriate modal |
| 29 // dialog container on the primary display. |
29 static void ShowDialog(gfx::NativeWindow owning_window, SimDialogMode mode); | 30 static void ShowDialog(gfx::NativeWindow owning_window, SimDialogMode mode); |
30 | 31 |
31 private: | 32 private: |
32 ~SimDialogDelegate() override; | 33 ~SimDialogDelegate() override; |
33 | 34 |
34 // Overridden from ui::WebDialogDelegate: | 35 // Overridden from ui::WebDialogDelegate: |
35 ui::ModalType GetDialogModalType() const override; | 36 ui::ModalType GetDialogModalType() const override; |
36 base::string16 GetDialogTitle() const override; | 37 base::string16 GetDialogTitle() const override; |
37 GURL GetDialogContentURL() const override; | 38 GURL GetDialogContentURL() const override; |
38 void GetWebUIMessageHandlers( | 39 void GetWebUIMessageHandlers( |
39 std::vector<content::WebUIMessageHandler*>* handlers) const override; | 40 std::vector<content::WebUIMessageHandler*>* handlers) const override; |
40 void GetDialogSize(gfx::Size* size) const override; | 41 void GetDialogSize(gfx::Size* size) const override; |
41 std::string GetDialogArgs() const override; | 42 std::string GetDialogArgs() const override; |
42 void OnDialogClosed(const std::string& json_retval) override; | 43 void OnDialogClosed(const std::string& json_retval) override; |
43 void OnCloseContents(content::WebContents* source, | 44 void OnCloseContents(content::WebContents* source, |
44 bool* out_close_dialog) override; | 45 bool* out_close_dialog) override; |
45 bool ShouldShowDialogTitle() const override; | 46 bool ShouldShowDialogTitle() const override; |
46 bool HandleContextMenu(const content::ContextMenuParams& params) override; | 47 bool HandleContextMenu(const content::ContextMenuParams& params) override; |
47 | 48 |
48 SimDialogMode dialog_mode_; | 49 SimDialogMode dialog_mode_; |
49 | 50 |
50 DISALLOW_COPY_AND_ASSIGN(SimDialogDelegate); | 51 DISALLOW_COPY_AND_ASSIGN(SimDialogDelegate); |
51 }; | 52 }; |
52 | 53 |
53 } // namespace chromeos | 54 } // namespace chromeos |
54 | 55 |
55 #endif // CHROME_BROWSER_CHROMEOS_SIM_DIALOG_DELEGATE_H_ | 56 #endif // CHROME_BROWSER_CHROMEOS_SIM_DIALOG_DELEGATE_H_ |
OLD | NEW |