Home | History | Annotate | Download | only in chromeos
      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_BROWSER_CHROMEOS_WM_OVERVIEW_SNAPSHOT_H_
      6 #define CHROME_BROWSER_CHROMEOS_WM_OVERVIEW_SNAPSHOT_H_
      7 #pragma once
      8 
      9 #include "third_party/skia/include/core/SkBitmap.h"
     10 #include "views/controls/image_view.h"
     11 #include "views/view.h"
     12 #include "views/widget/widget_gtk.h"
     13 
     14 class Browser;
     15 
     16 namespace chromeos {
     17 
     18 // WmOverviewSnapshot contains a snapshot image of the tab at the
     19 // given index.
     20 class WmOverviewSnapshot : public views::WidgetGtk {
     21  public:
     22   WmOverviewSnapshot();
     23   void Init(const gfx::Size& size, Browser* browser, int index);
     24 
     25   void SetImage(const SkBitmap& image);
     26 
     27   void UpdateIndex(Browser* browser, int index);
     28   int index() const { return index_; }
     29 
     30   // Returns the size of the snapshot widget.
     31   gfx::Size size() const {
     32     // TODO(beng): this should not be written as an accessor...
     33     return GetClientAreaScreenBounds().size();
     34   }
     35 
     36   // Has the snapshot been configured? This is true after SetSnapshot
     37   // is invoked.
     38   bool configured_snapshot() const { return configured_snapshot_; }
     39 
     40   // This resets the configured_snapshot flag for this snapshot so it will
     41   // get reloaded the next time we check.
     42   void reload_snapshot() { configured_snapshot_ = false; }
     43 
     44  private:
     45   // This control is the contents view for this widget.
     46   views::ImageView* snapshot_view_;
     47 
     48   // This is the tab index of the snapshot in the associated browser.
     49   int index_;
     50 
     51   // This indicates whether or not the snapshot has been configured.
     52   bool configured_snapshot_;
     53 
     54   DISALLOW_COPY_AND_ASSIGN(WmOverviewSnapshot);
     55 };
     56 
     57 }  // namespace chromeos
     58 
     59 #endif  // CHROME_BROWSER_CHROMEOS_WM_OVERVIEW_SNAPSHOT_H_
     60