blob: fa4e49691b85a65b551420be69fe3c571a1c7af2 [file] [log] [blame]
// 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:
~ConflictingModuleView() override;
// 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:
void Init() override;
// views::ButtonListener implementation.
void ButtonPressed(views::Button* sender, const ui::Event& event) override;
// views::View implementation.
void GetAccessibleState(ui::AXViewState* state) override;
void ViewHierarchyChanged(
const ViewHierarchyChangedDetails& details) override;
// content::NotificationObserver implementation.
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_