11e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)// Copyright (c) 2013 The Chromium Authors. All rights reserved.
21e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be
31e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)// found in the LICENSE file.
41e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)
51e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)#ifndef CHROME_BROWSER_UI_VIEWS_CONFLICTING_MODULE_VIEW_WIN_H_
61e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)#define CHROME_BROWSER_UI_VIEWS_CONFLICTING_MODULE_VIEW_WIN_H_
71e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)
81e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)#include "content/public/browser/notification_observer.h"
91e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)#include "content/public/browser/notification_registrar.h"
101e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)#include "ui/views/bubble/bubble_delegate.h"
111e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)#include "ui/views/controls/button/button.h"
121e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)#include "url/gurl.h"
131e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)
141e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)class Browser;
151e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)
161e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)namespace views {
171e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)class Label;
181e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)class LabelButton;
191e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)}
201e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)
211e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)// This is the class that implements the UI for the bubble showing that there
221e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)// is a 3rd party module loaded that conflicts with Chrome.
231e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)class ConflictingModuleView : public views::BubbleDelegateView,
241e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)                              public views::ButtonListener,
251e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)                              public content::NotificationObserver {
261e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) public:
271e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)  ConflictingModuleView(views::View* anchor_view,
281e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)                        Browser* browser,
291e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)                        const GURL& help_center_url);
301e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)
311e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)  // Show the Disabled Extension bubble, if needed.
321e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)  static void MaybeShow(Browser* browser, views::View* anchor_view);
331e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)
341e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) private:
351e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)  virtual ~ConflictingModuleView();
361e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)
371e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)  // Shows the bubble and updates the counter for how often it has been shown.
381e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)  void ShowBubble();
391e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)
401e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)  // Dismiss and make sure the bubble is not shown again. This bubble is a
411e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)  // single-appearance bubble.
421e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)  void DismissBubble();
431e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)
441e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)  // views::BubbleDelegateView implementation:
451e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)  virtual void Init() OVERRIDE;
461e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)
471e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)  // views::ButtonListener implementation.
481e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)  virtual void ButtonPressed(views::Button* sender,
491e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)                             const ui::Event& event) OVERRIDE;
501e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)
511e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)  // views::View implementation.
52a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  virtual void GetAccessibleState(ui::AXViewState* state) OVERRIDE;
531e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)  virtual void ViewHierarchyChanged(
541e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)      const ViewHierarchyChangedDetails& details) OVERRIDE;
551e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)
561e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)  // content::NotificationObserver implementation.
571e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)  virtual void Observe(
581e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)    int type,
591e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)    const content::NotificationSource& source,
601e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)    const content::NotificationDetails& details) OVERRIDE;
611e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)
621e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)  Browser* browser_;
631e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)
641e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)  content::NotificationRegistrar registrar_;
651e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)
661e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)  // The headline, labels and buttons on the bubble.
671e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)  views::Label* explanation_;
681e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)  views::LabelButton* learn_more_button_;
691e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)  views::LabelButton* not_now_button_;
701e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)
711e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)  // The link to the help center for this conflict.
721e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)  GURL help_center_url_;
731e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)
741e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)  DISALLOW_COPY_AND_ASSIGN(ConflictingModuleView);
751e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)};
761e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)
771e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)#endif  // CHROME_BROWSER_UI_VIEWS_CONFLICTING_MODULE_VIEW_WIN_H_
78