Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(288)

Side by Side Diff: components/infobars/core/confirm_infobar_delegate.h

Issue 1157733005: Make 'Google Smart Lock' a hyperlink in the password infobar on Mac. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 COMPONENTS_INFOBARS_CORE_CONFIRM_INFOBAR_DELEGATE_H_ 5 #ifndef COMPONENTS_INFOBARS_CORE_CONFIRM_INFOBAR_DELEGATE_H_
6 #define COMPONENTS_INFOBARS_CORE_CONFIRM_INFOBAR_DELEGATE_H_ 6 #define COMPONENTS_INFOBARS_CORE_CONFIRM_INFOBAR_DELEGATE_H_
7 7
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/strings/string16.h" 9 #include "base/strings/string16.h"
10 #include "components/infobars/core/infobar_delegate.h" 10 #include "components/infobars/core/infobar_delegate.h"
11 #include "components/infobars/core/infobar_manager.h" 11 #include "components/infobars/core/infobar_manager.h"
12 #include "ui/gfx/range/range.h"
12 13
13 namespace infobars { 14 namespace infobars {
14 class InfoBar; 15 class InfoBar;
15 class InfoBarManager; 16 class InfoBarManager;
16 } 17 }
17 18
18 // An interface derived from InfoBarDelegate implemented by objects wishing to 19 // An interface derived from InfoBarDelegate implemented by objects wishing to
19 // control a ConfirmInfoBar. 20 // control a ConfirmInfoBar.
20 class ConfirmInfoBarDelegate : public infobars::InfoBarDelegate { 21 class ConfirmInfoBarDelegate : public infobars::InfoBarDelegate {
21 public: 22 public:
22 enum InfoBarButton { 23 enum InfoBarButton {
23 BUTTON_NONE = 0, 24 BUTTON_NONE = 0,
24 BUTTON_OK = 1 << 0, 25 BUTTON_OK = 1 << 0,
25 BUTTON_CANCEL = 1 << 1, 26 BUTTON_CANCEL = 1 << 1,
26 }; 27 };
27 28
28 ~ConfirmInfoBarDelegate() override; 29 ~ConfirmInfoBarDelegate() override;
29 30
30 // Returns the InfoBar type to be displayed for the InfoBar. 31 // Returns the InfoBar type to be displayed for the InfoBar.
31 InfoBarAutomationType GetInfoBarAutomationType() const override; 32 InfoBarAutomationType GetInfoBarAutomationType() const override;
32 33
33 // Returns the message string to be displayed for the InfoBar. 34 // Returns the message string to be displayed for the InfoBar.
34 virtual base::string16 GetMessageText() const = 0; 35 virtual base::string16 GetMessageText() const = 0;
35 36
37 // Defines the message substring to be displayed as a link.
38 virtual gfx::Range GetMessageLinkRange() const;
39
36 // Returns the buttons to be shown for this InfoBar. 40 // Returns the buttons to be shown for this InfoBar.
37 virtual int GetButtons() const; 41 virtual int GetButtons() const;
38 42
39 // Returns the label for the specified button. The default implementation 43 // Returns the label for the specified button. The default implementation
40 // returns "OK" for the OK button and "Cancel" for the Cancel button. 44 // returns "OK" for the OK button and "Cancel" for the Cancel button.
41 virtual base::string16 GetButtonLabel(InfoBarButton button) const; 45 virtual base::string16 GetButtonLabel(InfoBarButton button) const;
42 46
43 // Returns whether or not the OK button will trigger a UAC elevation prompt on 47 // Returns whether or not the OK button will trigger a UAC elevation prompt on
44 // Windows. 48 // Windows.
45 virtual bool OKButtonTriggersUACPrompt() const; 49 virtual bool OKButtonTriggersUACPrompt() const;
46 50
47 // Called when the OK button is pressed. If this function returns true, the 51 // Called when the OK button is pressed. If this function returns true, the
48 // infobar is then immediately closed. Subclasses MUST NOT return true if in 52 // infobar is then immediately closed. Subclasses MUST NOT return true if in
49 // handling this call something triggers the infobar to begin closing. 53 // handling this call something triggers the infobar to begin closing.
50 virtual bool Accept(); 54 virtual bool Accept();
51 55
52 // Called when the Cancel button is pressed. If this function returns true, 56 // Called when the Cancel button is pressed. If this function returns true,
53 // the infobar is then immediately closed. Subclasses MUST NOT return true if 57 // the infobar is then immediately closed. Subclasses MUST NOT return true if
54 // in handling this call something triggers the infobar to begin closing. 58 // in handling this call something triggers the infobar to begin closing.
55 virtual bool Cancel(); 59 virtual bool Cancel();
56 60
57 // Returns the text of the link to be displayed, if any. Otherwise returns 61 // Returns the text of the link to be displayed after the message, if
58 // and empty string. 62 // any. Otherwise returns and empty string.
gone 2015/06/05 17:44:25 nit: while you're here, and -> an
59 virtual base::string16 GetLinkText() const; 63 virtual base::string16 GetLinkText() const;
60 64
61 // Called when the Link (if any) is clicked. The |disposition| specifies how 65 // Called when the Link (if any) is clicked. The |disposition| specifies how
62 // the resulting document should be loaded (based on the event flags present 66 // the resulting document should be loaded (based on the event flags present
63 // when the link was clicked). If this function returns true, the infobar is 67 // when the link was clicked). If this function returns true, the infobar is
64 // then immediately closed. Subclasses MUST NOT return true if in handling 68 // then immediately closed. Subclasses MUST NOT return true if in handling
65 // this call something triggers the infobar to begin closing. 69 // this call something triggers the infobar to begin closing.
66 virtual bool LinkClicked(WindowOpenDisposition disposition); 70 virtual bool LinkClicked(WindowOpenDisposition disposition);
67 71
68 protected: 72 protected:
69 ConfirmInfoBarDelegate(); 73 ConfirmInfoBarDelegate();
70 74
71 private: 75 private:
72 // InfoBarDelegate: 76 // InfoBarDelegate:
73 bool EqualsDelegate(infobars::InfoBarDelegate* delegate) const override; 77 bool EqualsDelegate(infobars::InfoBarDelegate* delegate) const override;
74 ConfirmInfoBarDelegate* AsConfirmInfoBarDelegate() override; 78 ConfirmInfoBarDelegate* AsConfirmInfoBarDelegate() override;
75 79
76 DISALLOW_COPY_AND_ASSIGN(ConfirmInfoBarDelegate); 80 DISALLOW_COPY_AND_ASSIGN(ConfirmInfoBarDelegate);
77 }; 81 };
78 82
79 #endif // COMPONENTS_INFOBARS_CORE_CONFIRM_INFOBAR_DELEGATE_H_ 83 #endif // COMPONENTS_INFOBARS_CORE_CONFIRM_INFOBAR_DELEGATE_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/infobars/confirm_infobar_controller.mm ('k') | components/infobars/core/confirm_infobar_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698