Home | History | Annotate | Download | only in charger_replace
      1 // Copyright (c) 2013 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_CHARGER_REPLACE_CHARGER_REPLACEMENT_DIALOG_H_
      6 #define CHROME_BROWSER_CHROMEOS_CHARGER_REPLACE_CHARGER_REPLACEMENT_DIALOG_H_
      7 
      8 #include "ui/gfx/native_widget_types.h"
      9 #include "ui/web_dialogs/web_dialog_delegate.h"
     10 
     11 namespace chromeos {
     12 
     13 class ChargerReplacementHandler;
     14 
     15 // Spring charger replacement dialog.
     16 class ChargerReplacementDialog : public ui::WebDialogDelegate {
     17  public:
     18   explicit ChargerReplacementDialog(gfx::NativeWindow parent_window);
     19   virtual ~ChargerReplacementDialog();
     20 
     21   // True if ChargerReplacementDialog should be shown.
     22   static bool ShouldShowDialog();
     23 
     24   // True if ChargerReplacementDialog is visible.
     25   static bool IsDialogVisible();
     26 
     27   static void SetFocusOnChargerDialogIfVisible();
     28 
     29   void Show();
     30   void set_can_close(bool can_close) { can_close_ = can_close; }
     31 
     32  private:
     33   // ui::WebDialogDelegate implementation.
     34   virtual ui::ModalType GetDialogModalType() const OVERRIDE;
     35   virtual base::string16 GetDialogTitle() const OVERRIDE;
     36   virtual GURL GetDialogContentURL() const OVERRIDE;
     37   virtual void GetWebUIMessageHandlers(
     38       std::vector<content::WebUIMessageHandler*>* handlers) const OVERRIDE;
     39   virtual void GetMinimumDialogSize(gfx::Size* size) const OVERRIDE;
     40   virtual void GetDialogSize(gfx::Size* size) const OVERRIDE;
     41   virtual std::string GetDialogArgs() const OVERRIDE;
     42   virtual bool CanCloseDialog() const OVERRIDE;
     43   // NOTE: This function deletes this object at the end.
     44   virtual void OnDialogClosed(const std::string& json_retval) OVERRIDE;
     45   virtual void OnCloseContents(
     46       content::WebContents* source, bool* out_close_dialog) OVERRIDE;
     47   virtual bool ShouldShowDialogTitle() const OVERRIDE;
     48   virtual bool HandleContextMenu(
     49       const content::ContextMenuParams& params) OVERRIDE;
     50 
     51   static bool is_window_visible_;
     52   static gfx::NativeWindow current_window_;
     53 
     54   const gfx::NativeWindow parent_window_;
     55   bool can_close_;
     56   ChargerReplacementHandler* charger_replacement_handler_;
     57 
     58   DISALLOW_COPY_AND_ASSIGN(ChargerReplacementDialog);
     59 };
     60 
     61 }  // namespace chromeos
     62 
     63 #endif  // CHROME_BROWSER_CHROMEOS_CHARGER_REPLACE_CHARGER_REPLACEMENT_DIALOG_H_
     64