summaryrefslogtreecommitdiffstats
path: root/chrome/browser/extensions/crashed_extension_infobar.h
blob: 1508ae5246545f9cefd6d30610734f3f92d9d356 (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
51
52
// 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_CRASHED_EXTENSION_INFOBAR_H_
#define CHROME_BROWSER_EXTENSIONS_CRASHED_EXTENSION_INFOBAR_H_
#pragma once

#include <string>

#include "base/basictypes.h"
#include "chrome/browser/tab_contents/infobar_delegate.h"

class Extension;
class ExtensionsService;
class SkBitmap;

// This infobar will be displayed when an extension process crashes. It allows
// the user to reload the crashed extension.
class CrashedExtensionInfoBarDelegate : public ConfirmInfoBarDelegate {
 public:
  // |tab_contents| should point to the TabContents the infobar will be added
  // to. |extension| should be the crashed extension, and |extensions_service|
  // the ExtensionsService which manages that extension.
  CrashedExtensionInfoBarDelegate(TabContents* tab_contents,
                                  ExtensionsService* extensions_service,
                                  const Extension* extension);

  const std::string extension_id() { return extension_id_; }

  // InfoBarDelegate
  virtual CrashedExtensionInfoBarDelegate* AsCrashedExtensionInfoBarDelegate();

  // ConfirmInfoBarDelegate
  virtual string16 GetMessageText() const;
  virtual void InfoBarClosed();
  virtual SkBitmap* GetIcon() const;
  virtual int GetButtons() const;
  virtual string16 GetButtonLabel(
      ConfirmInfoBarDelegate::InfoBarButton button) const;
  virtual bool Accept();

 private:
  ExtensionsService* extensions_service_;

  const std::string extension_id_;
  const std::string extension_name_;

  DISALLOW_COPY_AND_ASSIGN(CrashedExtensionInfoBarDelegate);
};

#endif  // CHROME_BROWSER_EXTENSIONS_CRASHED_EXTENSION_INFOBAR_H_