Home | History | Annotate | Download | only in infobars
      1 // Copyright (c) 2010 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_FRAME_INFOBARS_INFOBAR_MANAGER_H_
      6 #define CHROME_FRAME_INFOBARS_INFOBAR_MANAGER_H_
      7 
      8 #include <windows.h>
      9 
     10 class InfobarContent;
     11 
     12 enum InfobarType {
     13   FIRST_INFOBAR_TYPE = 0,
     14   TOP_INFOBAR = 0,          // Infobar at the top.
     15   BOTTOM_INFOBAR = 1,       // Infobar at the bottom.
     16   END_OF_INFOBAR_TYPE = 2
     17 };
     18 
     19 // Creates and manages infobars at the top or bottom of an IE content window.
     20 // Instances must only be retrieved and used within the UI thread of the IE
     21 // content window.
     22 class InfobarManager {
     23  public:
     24   // Returns an InfobarManager for the specified IE tab window. Caller does not
     25   // own the pointer (resources will be freed when the window is destroyed).
     26   //
     27   // The pointer may be invalidated by further processing of window events, and
     28   // as such should be immediately discarded after use.
     29   //
     30   // Returns NULL in case of failure.
     31   static InfobarManager* Get(HWND tab_window);
     32 
     33   virtual ~InfobarManager();
     34 
     35   // Shows the supplied content in an infobar of the specified type.
     36   // Normally, InfobarContent::InstallInFrame will be called with an interface
     37   // the content may use to interact with the Infobar facility.
     38   //
     39   // InfobarContent is deleted when the Infobar facility is finished with the
     40   // content (either through failure or when successfully hidden).
     41   virtual bool Show(InfobarContent* content, InfobarType type) = 0;
     42 
     43   // Hides the infobar of the specified type.
     44   virtual void Hide(InfobarType type) = 0;
     45 
     46   // Hides all infobars.
     47   virtual void HideAll() = 0;
     48 };  // class InfobarManager
     49 
     50 #endif  // CHROME_FRAME_INFOBARS_INFOBAR_MANAGER_H_
     51