1// Copyright (c) 2011 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_GTK_INFOBARS_EXTENSION_INFOBAR_GTK_H_
6#define CHROME_BROWSER_UI_GTK_INFOBARS_EXTENSION_INFOBAR_GTK_H_
7#pragma once
8
9#include "chrome/browser/extensions/extension_infobar_delegate.h"
10#include "chrome/browser/extensions/image_loading_tracker.h"
11#include "chrome/browser/ui/gtk/extensions/extension_view_gtk.h"
12#include "chrome/browser/ui/gtk/infobars/infobar_gtk.h"
13#include "ui/gfx/gtk_util.h"
14
15class ExtensionInfobarDelegate;
16class ExtensionResource;
17class ExtensionViewGtk;
18
19class ExtensionInfoBarGtk : public InfoBar,
20                            public ImageLoadingTracker::Observer,
21                            public ExtensionViewGtk::Container {
22 public:
23  explicit ExtensionInfoBarGtk(ExtensionInfoBarDelegate* delegate);
24  virtual ~ExtensionInfoBarGtk();
25
26  // Overridden from ImageLoadingTracker::Observer:
27  virtual void OnImageLoaded(
28      SkBitmap* image, const ExtensionResource& resource, int index);
29
30  // ExtensionViewGtk::Container implementation
31  virtual void OnExtensionPreferredSizeChanged(ExtensionViewGtk* view,
32                                               const gfx::Size& new_size);
33
34 private:
35  // Build the widgets of the Infobar.
36  void BuildWidgets();
37
38  CHROMEGTK_CALLBACK_1(ExtensionInfoBarGtk, void, OnSizeAllocate,
39                       GtkAllocation*);
40
41  ImageLoadingTracker tracker_;
42
43  ExtensionInfoBarDelegate* delegate_;
44
45  ExtensionViewGtk* view_;
46
47  DISALLOW_COPY_AND_ASSIGN(ExtensionInfoBarGtk);
48};
49
50#endif  // CHROME_BROWSER_UI_GTK_INFOBARS_EXTENSION_INFOBAR_GTK_H_
51