summaryrefslogtreecommitdiffstats
path: root/chrome/browser/extensions/extension_shelf.h
blob: b31419990fb1b5c1b8a5f97d86c4a50b6b51eae0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// Copyright (c) 2009 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_SHELF_H_
#define CHROME_BROWSER_EXTENSIONS_EXTENSION_SHELF_H_

#include "chrome/browser/extensions/extensions_service.h"
#include "app/gfx/chrome_canvas.h"
#include "chrome/common/notification_observer.h"
#include "views/view.h"

class Browser;

class ExtensionShelf : public views::View,
                       public NotificationObserver {
 public:
  explicit ExtensionShelf(Browser* browser);
  virtual ~ExtensionShelf();

  // View
  virtual void Paint(ChromeCanvas* canvas);
  virtual gfx::Size GetPreferredSize();
  virtual void Layout();

  // NotificationService method.
  virtual void Observe(NotificationType type,
                       const NotificationSource& source,
                       const NotificationDetails& details);

  bool AddExtensionViews(const ExtensionList* extensions);
  bool HasExtensionViews();

 protected:
  // View
  virtual void ChildPreferredSizeChanged(View* child);

 private:
  // Inits the background bitmap.
  void InitBackground(ChromeCanvas* canvas, const SkRect& subset);

  Browser* browser_;

  // Background bitmap to draw under extension views.
  SkBitmap background_;

  DISALLOW_COPY_AND_ASSIGN(ExtensionShelf);
};

#endif  // CHROME_BROWSER_EXTENSIONS_EXTENSION_SHELF_H_