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