Home | History | Annotate | Download | only in first_run
      1 // Copyright 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 ASH_FIRST_RUN_FIRST_RUN_HELPER_H_
      6 #define ASH_FIRST_RUN_FIRST_RUN_HELPER_H_
      7 
      8 #include "ash/ash_export.h"
      9 #include "base/basictypes.h"
     10 #include "base/observer_list.h"
     11 
     12 namespace gfx {
     13 class Rect;
     14 }
     15 
     16 namespace views {
     17 class Widget;
     18 }
     19 
     20 namespace ash {
     21 
     22 // Interface used by first-run tutorial to manipulate and retreive information
     23 // about shell elements.
     24 // All returned coordinates are in screen coordinate system.
     25 class ASH_EXPORT FirstRunHelper {
     26  public:
     27   class Observer {
     28    public:
     29     // Called when first-run UI was cancelled.
     30     virtual void OnCancelled() = 0;
     31     virtual ~Observer() {}
     32   };
     33 
     34  public:
     35   FirstRunHelper();
     36   virtual ~FirstRunHelper();
     37 
     38   void AddObserver(Observer* observer);
     39   void RemoveObserver(Observer* observer);
     40 
     41   // Returns widget to place tutorial UI into it.
     42   virtual views::Widget* GetOverlayWidget() = 0;
     43 
     44   // Opens and closes app list.
     45   virtual void OpenAppList() = 0;
     46   virtual void CloseAppList() = 0;
     47 
     48   // Returns bounding rectangle of launcher elements.
     49   virtual gfx::Rect GetLauncherBounds() = 0;
     50 
     51   // Returns bounds of application list button.
     52   virtual gfx::Rect GetAppListButtonBounds() = 0;
     53 
     54   // Returns bounds of application list. You must open application list before
     55   // calling this method.
     56   virtual gfx::Rect GetAppListBounds() = 0;
     57 
     58   // Opens and closes system tray bubble.
     59   virtual void OpenTrayBubble() = 0;
     60   virtual void CloseTrayBubble() = 0;
     61 
     62   // Returns |true| iff system tray bubble is opened now.
     63   virtual bool IsTrayBubbleOpened() = 0;
     64 
     65   // Returns bounds of system tray bubble. You must open bubble before calling
     66   // this method.
     67   virtual gfx::Rect GetTrayBubbleBounds() = 0;
     68 
     69   // Returns bounds of help app button from system tray buble. You must open
     70   // bubble before calling this method.
     71   virtual gfx::Rect GetHelpButtonBounds() = 0;
     72 
     73  protected:
     74   ObserverList<Observer>& observers() { return observers_; }
     75 
     76  private:
     77   ObserverList<Observer> observers_;
     78 
     79   DISALLOW_COPY_AND_ASSIGN(FirstRunHelper);
     80 };
     81 
     82 }  // namespace ash
     83 
     84 #endif  // ASH_FIRST_RUN_FIRST_RUN_HELPER_H_
     85 
     86