OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_UI_VIEWS_CONFLICTING_MODULE_VIEW_WIN_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_CONFLICTING_MODULE_VIEW_WIN_H_ |
6 #define CHROME_BROWSER_UI_VIEWS_CONFLICTING_MODULE_VIEW_WIN_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_CONFLICTING_MODULE_VIEW_WIN_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "content/public/browser/notification_observer.h" | 9 #include "chrome/browser/win/enumerate_modules_model.h" |
10 #include "content/public/browser/notification_registrar.h" | |
11 #include "ui/views/bubble/bubble_dialog_delegate.h" | 10 #include "ui/views/bubble/bubble_dialog_delegate.h" |
12 #include "url/gurl.h" | 11 #include "url/gurl.h" |
13 | 12 |
14 class Browser; | 13 class Browser; |
15 | 14 |
16 // This is the class that implements the UI for the bubble showing that there | 15 // This is the class that implements the UI for the bubble showing that there |
17 // is a 3rd party module loaded that conflicts with Chrome. | 16 // is a 3rd party module loaded that conflicts with Chrome. |
18 class ConflictingModuleView : public views::BubbleDialogDelegateView, | 17 class ConflictingModuleView : public views::BubbleDialogDelegateView, |
19 public content::NotificationObserver { | 18 public EnumerateModulesModel::Observer { |
20 public: | 19 public: |
21 ConflictingModuleView(views::View* anchor_view, | 20 ConflictingModuleView(views::View* anchor_view, |
22 Browser* browser, | 21 Browser* browser, |
23 const GURL& help_center_url); | 22 const GURL& help_center_url); |
24 | 23 |
25 // Show the Disabled Extension bubble, if needed. | 24 // Show the Disabled Extension bubble, if needed. |
26 static void MaybeShow(Browser* browser, views::View* anchor_view); | 25 static void MaybeShow(Browser* browser, views::View* anchor_view); |
27 | 26 |
28 private: | 27 private: |
29 ~ConflictingModuleView() override; | 28 ~ConflictingModuleView() override; |
30 | 29 |
31 // Shows the bubble and updates the counter for how often it has been shown. | 30 // Shows the bubble and updates the counter for how often it has been shown. |
32 void ShowBubble(); | 31 void ShowBubble(); |
33 | 32 |
34 // views::BubbleDialogDelegateView implementation: | 33 // views::BubbleDialogDelegateView implementation: |
35 void OnWidgetClosing(views::Widget* widget) override; | 34 void OnWidgetClosing(views::Widget* widget) override; |
36 bool Accept() override; | 35 bool Accept() override; |
37 base::string16 GetDialogButtonLabel(ui::DialogButton button) const override; | 36 base::string16 GetDialogButtonLabel(ui::DialogButton button) const override; |
38 void Init() override; | 37 void Init() override; |
39 | 38 |
40 // views::View implementation. | 39 // views::View implementation. |
41 void GetAccessibleState(ui::AXViewState* state) override; | 40 void GetAccessibleState(ui::AXViewState* state) override; |
42 | 41 |
43 // content::NotificationObserver implementation. | 42 // EnumerateModulesModel::Observer: |
44 void Observe( | 43 void OnConflictsAcknowledged() override; |
45 int type, | |
46 const content::NotificationSource& source, | |
47 const content::NotificationDetails& details) override; | |
48 | 44 |
49 Browser* browser_; | 45 Browser* browser_; |
50 | 46 |
51 content::NotificationRegistrar registrar_; | |
52 | |
53 // The link to the help center for this conflict. | 47 // The link to the help center for this conflict. |
54 GURL help_center_url_; | 48 GURL help_center_url_; |
55 | 49 |
56 DISALLOW_COPY_AND_ASSIGN(ConflictingModuleView); | 50 DISALLOW_COPY_AND_ASSIGN(ConflictingModuleView); |
57 }; | 51 }; |
58 | 52 |
59 #endif // CHROME_BROWSER_UI_VIEWS_CONFLICTING_MODULE_VIEW_WIN_H_ | 53 #endif // CHROME_BROWSER_UI_VIEWS_CONFLICTING_MODULE_VIEW_WIN_H_ |
OLD | NEW |