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, |
grt (UTC plus 2)
2016/07/14 06:31:16
how about distinct buckets for "didn't interact" a
Patrick Monette
2016/07/14 17:42:57
Fixed this recently
https://codereview.chromium.or
grt (UTC plus 2)
2016/07/14 18:54:15
Damn, you're good!
| |
49 NUM_INFO_BAR_USER_INTERACTION_TYPES | 49 NUM_INFO_BAR_USER_INTERACTION_TYPES |
50 }; | 50 }; |
51 | 51 |
52 void AllowExpiry(); | 52 void AllowExpiry(); |
53 | 53 |
54 // ConfirmInfoBarDelegate: | 54 // ConfirmInfoBarDelegate: |
55 Type GetInfoBarType() const override; | 55 Type GetInfoBarType() const override; |
56 infobars::InfoBarDelegate::InfoBarIdentifier GetIdentifier() const override; | 56 infobars::InfoBarDelegate::InfoBarIdentifier GetIdentifier() const override; |
57 int GetIconId() const override; | 57 int GetIconId() const override; |
58 gfx::VectorIconId GetVectorIconId() const override; | 58 gfx::VectorIconId GetVectorIconId() const override; |
59 #if defined(OS_WIN) | 59 #if defined(OS_WIN) |
60 gfx::Image GetIcon() const override; | 60 gfx::Image GetIcon() const override; |
61 #endif // defined(OS_WIN) | 61 #endif // defined(OS_WIN) |
62 bool ShouldExpire(const NavigationDetails& details) const override; | 62 bool ShouldExpire(const NavigationDetails& details) const override; |
63 void InfoBarDismissed() override; | 63 void InfoBarDismissed() override; |
64 base::string16 GetMessageText() const override; | 64 base::string16 GetMessageText() const override; |
65 int GetButtons() const override; | |
65 base::string16 GetButtonLabel(InfoBarButton button) const override; | 66 base::string16 GetButtonLabel(InfoBarButton button) const override; |
66 bool OKButtonTriggersUACPrompt() const override; | 67 bool OKButtonTriggersUACPrompt() const override; |
67 bool Accept() override; | 68 bool Accept() override; |
68 bool Cancel() override; | |
69 | 69 |
70 // Declared virtual so tests can override. | 70 // Declared virtual so tests can override. |
71 virtual scoped_refptr<shell_integration::DefaultBrowserWorker> | 71 virtual scoped_refptr<shell_integration::DefaultBrowserWorker> |
72 CreateDefaultBrowserWorker( | 72 CreateDefaultBrowserWorker( |
73 const shell_integration::DefaultWebClientWorkerCallback& callback); | 73 const shell_integration::DefaultWebClientWorkerCallback& callback); |
74 | 74 |
75 // Removes the infobar when the worker is finished setting the default | 75 // Removes the infobar when the worker is finished setting the default |
76 // browser. Only used if the StickyDefaultBrowserPrompt experiment is | 76 // browser. Only used if the StickyDefaultBrowserPrompt experiment is |
77 // enabled. | 77 // enabled. |
78 void OnSetAsDefaultFinished(shell_integration::DefaultWebClientState state); | 78 void OnSetAsDefaultFinished(shell_integration::DefaultWebClientState state); |
79 | 79 |
80 // The WebContents's corresponding profile. | 80 // The WebContents's corresponding profile. |
81 Profile* profile_; | 81 Profile* profile_; |
82 | 82 |
83 scoped_refptr<base::SingleThreadTaskRunner> thread_task_runner_; | 83 scoped_refptr<base::SingleThreadTaskRunner> thread_task_runner_; |
84 | 84 |
85 // Whether the info bar should be dismissed on the next navigation. | 85 // Whether the info bar should be dismissed on the next navigation. |
86 bool should_expire_; | 86 bool should_expire_; |
87 | 87 |
88 // Used to delay the expiration of the info-bar. | 88 // Used to delay the expiration of the info-bar. |
89 base::WeakPtrFactory<DefaultBrowserInfoBarDelegate> weak_factory_; | 89 base::WeakPtrFactory<DefaultBrowserInfoBarDelegate> weak_factory_; |
90 | 90 |
91 DISALLOW_COPY_AND_ASSIGN(DefaultBrowserInfoBarDelegate); | 91 DISALLOW_COPY_AND_ASSIGN(DefaultBrowserInfoBarDelegate); |
92 }; | 92 }; |
93 | 93 |
94 } // namespace chrome | 94 } // namespace chrome |
95 | 95 |
96 #endif // CHROME_BROWSER_UI_STARTUP_DEFAULT_BROWSER_INFOBAR_DELEGATE_H_ | 96 #endif // CHROME_BROWSER_UI_STARTUP_DEFAULT_BROWSER_INFOBAR_DELEGATE_H_ |
OLD | NEW |