OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_STARTUP_DEFAULT_BROWSER_INFOBAR_DELEGATE_H_ | 5 #ifndef CHROME_BROWSER_UI_STARTUP_DEFAULT_BROWSER_INFOBAR_DELEGATE_H_ |
6 #define CHROME_BROWSER_UI_STARTUP_DEFAULT_BROWSER_INFOBAR_DELEGATE_H_ | 6 #define CHROME_BROWSER_UI_STARTUP_DEFAULT_BROWSER_INFOBAR_DELEGATE_H_ |
7 | 7 |
8 #include "base/feature_list.h" | 8 #include "base/feature_list.h" |
9 #include "chrome/browser/infobars/infobar_service.h" | 9 #include "chrome/browser/infobars/infobar_service.h" |
10 #include "chrome/browser/shell_integration.h" | 10 #include "chrome/browser/shell_integration.h" |
(...skipping 24 matching lines...) Expand all Loading... |
35 protected: | 35 protected: |
36 explicit DefaultBrowserInfoBarDelegate(Profile* profile); | 36 explicit DefaultBrowserInfoBarDelegate(Profile* profile); |
37 ~DefaultBrowserInfoBarDelegate() override; | 37 ~DefaultBrowserInfoBarDelegate() override; |
38 | 38 |
39 private: | 39 private: |
40 // Possible user interactions with the default browser info bar. | 40 // Possible user interactions with the default browser info bar. |
41 // Do not modify the ordering as it is important for UMA. | 41 // Do not modify the ordering as it is important for UMA. |
42 enum InfoBarUserInteraction { | 42 enum InfoBarUserInteraction { |
43 // The user clicked the "OK" (i.e., "Set as default") button. | 43 // The user clicked the "OK" (i.e., "Set as default") button. |
44 ACCEPT_INFO_BAR = 0, | 44 ACCEPT_INFO_BAR = 0, |
45 // The user clicked the "Cancel" (i.e., "Don't ask again") button. | 45 // The cancel button is deprecated. |
46 CANCEL_INFO_BAR = 1, | 46 // CANCEL_INFO_BAR = 1, |
47 // The user did not interact with the info bar. | 47 // The user did not interact with the info bar. |
48 IGNORE_INFO_BAR = 2, | 48 IGNORE_INFO_BAR = 2, |
49 // The user explicitly closed the infobar. | 49 // The user explicitly closed the infobar. |
50 DISMISS_INFO_BAR = 3, | 50 DISMISS_INFO_BAR = 3, |
51 NUM_INFO_BAR_USER_INTERACTION_TYPES | 51 NUM_INFO_BAR_USER_INTERACTION_TYPES |
52 }; | 52 }; |
53 | 53 |
54 void AllowExpiry(); | 54 void AllowExpiry(); |
55 | 55 |
56 // ConfirmInfoBarDelegate: | 56 // ConfirmInfoBarDelegate: |
57 Type GetInfoBarType() const override; | 57 Type GetInfoBarType() const override; |
58 infobars::InfoBarDelegate::InfoBarIdentifier GetIdentifier() const override; | 58 infobars::InfoBarDelegate::InfoBarIdentifier GetIdentifier() const override; |
59 int GetIconId() const override; | 59 int GetIconId() const override; |
60 gfx::VectorIconId GetVectorIconId() const override; | 60 gfx::VectorIconId GetVectorIconId() const override; |
61 #if defined(OS_WIN) | 61 #if defined(OS_WIN) |
62 gfx::Image GetIcon() const override; | 62 gfx::Image GetIcon() const override; |
63 #endif // defined(OS_WIN) | 63 #endif // defined(OS_WIN) |
64 bool ShouldExpire(const NavigationDetails& details) const override; | 64 bool ShouldExpire(const NavigationDetails& details) const override; |
65 void InfoBarDismissed() override; | 65 void InfoBarDismissed() override; |
66 base::string16 GetMessageText() const override; | 66 base::string16 GetMessageText() const override; |
| 67 int GetButtons() const override; |
67 base::string16 GetButtonLabel(InfoBarButton button) const override; | 68 base::string16 GetButtonLabel(InfoBarButton button) const override; |
68 bool OKButtonTriggersUACPrompt() const override; | 69 bool OKButtonTriggersUACPrompt() const override; |
69 bool Accept() override; | 70 bool Accept() override; |
70 bool Cancel() override; | |
71 | 71 |
72 // Declared virtual so tests can override. | 72 // Declared virtual so tests can override. |
73 virtual scoped_refptr<shell_integration::DefaultBrowserWorker> | 73 virtual scoped_refptr<shell_integration::DefaultBrowserWorker> |
74 CreateDefaultBrowserWorker( | 74 CreateDefaultBrowserWorker( |
75 const shell_integration::DefaultWebClientWorkerCallback& callback); | 75 const shell_integration::DefaultWebClientWorkerCallback& callback); |
76 | 76 |
77 // Removes the infobar when the worker is finished setting the default | 77 // Removes the infobar when the worker is finished setting the default |
78 // browser. Only used if the StickyDefaultBrowserPrompt experiment is | 78 // browser. Only used if the StickyDefaultBrowserPrompt experiment is |
79 // enabled. | 79 // enabled. |
80 void OnSetAsDefaultFinished(shell_integration::DefaultWebClientState state); | 80 void OnSetAsDefaultFinished(shell_integration::DefaultWebClientState state); |
(...skipping 11 matching lines...) Expand all Loading... |
92 | 92 |
93 // Used to delay the expiration of the info-bar. | 93 // Used to delay the expiration of the info-bar. |
94 base::WeakPtrFactory<DefaultBrowserInfoBarDelegate> weak_factory_; | 94 base::WeakPtrFactory<DefaultBrowserInfoBarDelegate> weak_factory_; |
95 | 95 |
96 DISALLOW_COPY_AND_ASSIGN(DefaultBrowserInfoBarDelegate); | 96 DISALLOW_COPY_AND_ASSIGN(DefaultBrowserInfoBarDelegate); |
97 }; | 97 }; |
98 | 98 |
99 } // namespace chrome | 99 } // namespace chrome |
100 | 100 |
101 #endif // CHROME_BROWSER_UI_STARTUP_DEFAULT_BROWSER_INFOBAR_DELEGATE_H_ | 101 #endif // CHROME_BROWSER_UI_STARTUP_DEFAULT_BROWSER_INFOBAR_DELEGATE_H_ |
OLD | NEW |