Home | History | Annotate | Download | only in views
      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 CHROME_BROWSER_UI_VIEWS_COLOR_CHOOSER_AURA_H_
      6 #define CHROME_BROWSER_UI_VIEWS_COLOR_CHOOSER_AURA_H_
      7 
      8 #include "base/basictypes.h"
      9 #include "base/compiler_specific.h"
     10 #include "content/public/browser/color_chooser.h"
     11 #include "ui/views/color_chooser/color_chooser_listener.h"
     12 
     13 namespace content {
     14 class WebContents;
     15 }
     16 
     17 namespace views {
     18 class ColorChooserView;
     19 class Widget;
     20 }
     21 
     22 // TODO(mukai): rename this as -Ash and move to c/b/ui/ash after Linux-aura
     23 // switches to its native color chooser.
     24 class ColorChooserAura : public content::ColorChooser,
     25                          public views::ColorChooserListener {
     26  public:
     27   static ColorChooserAura* Open(content::WebContents* web_contents,
     28                                 SkColor initial_color);
     29 
     30  private:
     31   ColorChooserAura(content::WebContents* web_contents, SkColor initial_color);
     32 
     33   // content::ColorChooser overrides:
     34   virtual void End() OVERRIDE;
     35   virtual void SetSelectedColor(SkColor color) OVERRIDE;
     36 
     37   // views::ColorChooserListener overrides:
     38   virtual void OnColorChosen(SkColor color) OVERRIDE;
     39   virtual void OnColorChooserDialogClosed() OVERRIDE;
     40 
     41   void DidEndColorChooser();
     42 
     43   // The actual view of the color chooser.  No ownership because its parent
     44   // view will take care of its lifetime.
     45   views::ColorChooserView* view_;
     46 
     47   // The widget for the color chooser.  No ownership because it's released
     48   // automatically when closed.
     49   views::Widget* widget_;
     50 
     51   // The web contents invoking the color chooser.  No ownership because it will
     52   // outlive this class.
     53   content::WebContents* web_contents_;
     54 
     55   DISALLOW_COPY_AND_ASSIGN(ColorChooserAura);
     56 };
     57 
     58 #endif  // CHROME_BROWSER_UI_VIEWS_COLOR_CHOOSER_AURA_H_
     59