summaryrefslogtreecommitdiffstats
path: root/chrome/browser/ui/views/conflicting_module_view_win.h
blob: 04bd6b123259417a67f05cf9a0670b372e662b71 (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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
// Copyright (c) 2013 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_UI_VIEWS_CONFLICTING_MODULE_VIEW_WIN_H_
#define CHROME_BROWSER_UI_VIEWS_CONFLICTING_MODULE_VIEW_WIN_H_

#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
#include "ui/views/bubble/bubble_delegate.h"
#include "ui/views/controls/button/button.h"
#include "url/gurl.h"

class Browser;

namespace views {
class Label;
class LabelButton;
}

// This is the class that implements the UI for the bubble showing that there
// is a 3rd party module loaded that conflicts with Chrome.
class ConflictingModuleView : public views::BubbleDelegateView,
                              public views::ButtonListener,
                              public content::NotificationObserver {
 public:
  ConflictingModuleView(views::View* anchor_view,
                        Browser* browser,
                        const GURL& help_center_url);

  // Show the Disabled Extension bubble, if needed.
  static void MaybeShow(Browser* browser, views::View* anchor_view);

 private:
  virtual ~ConflictingModuleView();

  // Shows the bubble and updates the counter for how often it has been shown.
  void ShowBubble();

  // Dismiss and make sure the bubble is not shown again. This bubble is a
  // single-appearance bubble.
  void DismissBubble();

  // views::BubbleDelegateView implementation:
  virtual void Init() OVERRIDE;

  // views::ButtonListener implementation.
  virtual void ButtonPressed(views::Button* sender,
                             const ui::Event& event) OVERRIDE;

  // views::View implementation.
  virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE;
  virtual void ViewHierarchyChanged(
      const ViewHierarchyChangedDetails& details) OVERRIDE;

  // content::NotificationObserver implementation.
  virtual void Observe(
    int type,
    const content::NotificationSource& source,
    const content::NotificationDetails& details) OVERRIDE;

  Browser* browser_;

  content::NotificationRegistrar registrar_;

  // The headline, labels and buttons on the bubble.
  views::Label* explanation_;
  views::LabelButton* learn_more_button_;
  views::LabelButton* not_now_button_;

  // The link to the help center for this conflict.
  GURL help_center_url_;

  DISALLOW_COPY_AND_ASSIGN(ConflictingModuleView);
};

#endif  // CHROME_BROWSER_UI_VIEWS_CONFLICTING_MODULE_VIEW_WIN_H_