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