1// Copyright (c) 2011 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#ifndef CHROME_BROWSER_CHROMEOS_SIM_DIALOG_DELEGATE_H_
6#define CHROME_BROWSER_CHROMEOS_SIM_DIALOG_DELEGATE_H_
7
8#include "chrome/browser/ui/webui/html_dialog_ui.h"
9#include "ui/gfx/native_widget_types.h"
10
11namespace chromeos {
12
13// SIM unlock dialog displayed in cases when SIM card has to be unlocked.
14class SimDialogDelegate : public HtmlDialogUIDelegate {
15 public:
16  // Type of the SIM dialog that is launched.
17  typedef enum SimDialogMode {
18    SIM_DIALOG_UNLOCK       = 0,  // General unlock flow dialog (PIN/PUK).
19    SIM_DIALOG_CHANGE_PIN   = 1,  // Change PIN dialog.
20    SIM_DIALOG_SET_LOCK_ON  = 2,  // Enable RequirePin restriction.
21    SIM_DIALOG_SET_LOCK_OFF = 3,  // Disable RequirePin restriction.
22  } SimDialogMode;
23
24  explicit SimDialogDelegate(SimDialogMode dialog_mode);
25
26  // Shows the SIM unlock dialog box with one of the specified modes.
27  static void ShowDialog(gfx::NativeWindow owning_window, SimDialogMode mode);
28
29 private:
30  ~SimDialogDelegate();
31
32  // Overridden from HtmlDialogUI::Delegate:
33  virtual bool IsDialogModal() const;
34  virtual std::wstring GetDialogTitle() const;
35  virtual GURL GetDialogContentURL() const;
36  virtual void GetWebUIMessageHandlers(
37      std::vector<WebUIMessageHandler*>* handlers) const;
38  virtual void GetDialogSize(gfx::Size* size) const;
39  virtual std::string GetDialogArgs() const;
40  virtual void OnDialogClosed(const std::string& json_retval);
41  virtual void OnCloseContents(TabContents* source, bool* out_close_dialog);
42  virtual bool ShouldShowDialogTitle() const;
43
44  SimDialogMode dialog_mode_;
45
46  DISALLOW_COPY_AND_ASSIGN(SimDialogDelegate);
47};
48
49}  // namespace chromeos
50
51#endif  // CHROME_BROWSER_CHROMEOS_SIM_DIALOG_DELEGATE_H_
52