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

Side by Side Diff: chrome/browser/ui/website_settings/chooser_bubble_delegate.h

Issue 1661063002: Add message and Help Center link to the chooser UI (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: cleaned up code Created 4 years, 10 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_WEBSITE_SETTINGS_CHOOSER_BUBBLE_DELEGATE_H_ 5 #ifndef CHROME_BROWSER_UI_WEBSITE_SETTINGS_CHOOSER_BUBBLE_DELEGATE_H_
6 #define CHROME_BROWSER_UI_WEBSITE_SETTINGS_CHOOSER_BUBBLE_DELEGATE_H_ 6 #define CHROME_BROWSER_UI_WEBSITE_SETTINGS_CHOOSER_BUBBLE_DELEGATE_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "base/strings/string16.h" 11 #include "base/strings/string16.h"
12 #include "components/bubble/bubble_delegate.h" 12 #include "components/bubble/bubble_delegate.h"
13 13
14 class Browser; 14 class Browser;
15 class GURL;
15 16
16 // Subclass ChooserBubbleDelegate to implement a chooser bubble, which has 17 // Subclass ChooserBubbleDelegate to implement a chooser bubble, which has
17 // some introductory text and a list of options that users can pick one of. 18 // some introductory text and a list of options that users can pick one of.
18 // Create an instance of your subclass and pass it to 19 // Create an instance of your subclass and pass it to
19 // BubbleManager::ShowBubble() to show the bubble. Your subclass must define 20 // BubbleManager::ShowBubble() to show the bubble. Your subclass must define
20 // the set of options users can pick from; the actions taken after users 21 // the set of options users can pick from; the actions taken after users
21 // select an item or press the 'Cancel' button or the bubble is closed. 22 // select an item or press the 'Cancel' button or the bubble is closed.
22 // You can also override GetName() to identify the bubble you define for 23 // You can also override GetName() to identify the bubble you define for
23 // collecting metrics. 24 // collecting metrics.
24 // After Select/Cancel/Close is called, this object is destroyed and call back 25 // After Select/Cancel/Close is called, this object is destroyed and call back
(...skipping 20 matching lines...) Expand all
45 // Called when GetOption(index) is no longer present, and all later 46 // Called when GetOption(index) is no longer present, and all later
46 // options have been moved earlier by 1 slot. Calling GetOption(index) 47 // options have been moved earlier by 1 slot. Calling GetOption(index)
47 // from inside a call to OnOptionRemoved will NOT see the removed string 48 // from inside a call to OnOptionRemoved will NOT see the removed string
48 // since the options have already been updated. 49 // since the options have already been updated.
49 virtual void OnOptionRemoved(size_t index) = 0; 50 virtual void OnOptionRemoved(size_t index) = 0;
50 51
51 protected: 52 protected:
52 virtual ~Observer() {} 53 virtual ~Observer() {}
53 }; 54 };
54 55
56 // Open help center URL.
57 void OpenHelpCenterURL() const;
Evan Stade 2016/02/17 23:09:01 nit: should be Url not URL
juncai 2016/02/19 01:51:00 Done.
58
55 // BubbleDelegate: 59 // BubbleDelegate:
56 std::string GetName() const override; 60 std::string GetName() const override;
57 scoped_ptr<BubbleUi> BuildBubbleUi() override; 61 scoped_ptr<BubbleUi> BuildBubbleUi() override;
58 const content::RenderFrameHost* OwningFrame() const override; 62 const content::RenderFrameHost* OwningFrame() const override;
59 63
60 // The number of options users can pick from. For example, it can be 64 // The number of options users can pick from. For example, it can be
61 // the number of USB/Bluetooth device names which are listed in the 65 // the number of USB/Bluetooth device names which are listed in the
62 // chooser bubble so that users can grant permission. 66 // chooser bubble so that users can grant permission.
63 virtual size_t NumOptions() const = 0; 67 virtual size_t NumOptions() const = 0;
64 68
65 // The |index|th option string which is listed in the chooser bubble. 69 // The |index|th option string which is listed in the chooser bubble.
66 virtual const base::string16& GetOption(size_t index) const = 0; 70 virtual const base::string16& GetOption(size_t index) const = 0;
67 71
68 // These three functions are called just before this object is destroyed: 72 // These three functions are called just before this object is destroyed:
69 73
70 // Called when the user selects the |index|th element from the dialog. 74 // Called when the user selects the |index|th element from the dialog.
71 virtual void Select(size_t index) = 0; 75 virtual void Select(size_t index) = 0;
72 76
73 // Called when the user presses the 'Cancel' button in the dialog. 77 // Called when the user presses the 'Cancel' button in the dialog.
74 virtual void Cancel() = 0; 78 virtual void Cancel() = 0;
75 79
76 // Called when the user clicks outside the dialog or the dialog otherwise 80 // Called when the user clicks outside the dialog or the dialog otherwise
77 // closes without the user taking an explicit action. 81 // closes without the user taking an explicit action.
78 virtual void Close() = 0; 82 virtual void Close() = 0;
79 83
84 // Get help center URL.
85 virtual GURL GetHelpCenterURL() const = 0;
86
80 // Only one observer may be registered at a time. 87 // Only one observer may be registered at a time.
81 void set_observer(Observer* observer) { observer_ = observer; } 88 void set_observer(Observer* observer) { observer_ = observer; }
82 Observer* observer() const { return observer_; } 89 Observer* observer() const { return observer_; }
83 90
84 private: 91 private:
85 Browser* browser_; 92 Browser* browser_;
86 const content::RenderFrameHost* const owning_frame_; 93 const content::RenderFrameHost* const owning_frame_;
87 Observer* observer_ = nullptr; 94 Observer* observer_ = nullptr;
88 95
89 DISALLOW_COPY_AND_ASSIGN(ChooserBubbleDelegate); 96 DISALLOW_COPY_AND_ASSIGN(ChooserBubbleDelegate);
90 }; 97 };
91 98
92 #endif // CHROME_BROWSER_UI_WEBSITE_SETTINGS_CHOOSER_BUBBLE_DELEGATE_H_ 99 #endif // CHROME_BROWSER_UI_WEBSITE_SETTINGS_CHOOSER_BUBBLE_DELEGATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698