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

Side by Side Diff: chrome/browser/chooser_controller/chooser_controller.h

Issue 2122073004: Display extension name on device chooser title (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@move_chooser_controller_to_chrome_browser
Patch Set: address comments Created 4 years, 5 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 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_CHOOSER_CONTROLLER_CHOOSER_CONTROLLER_H_ 5 #ifndef CHROME_BROWSER_CHOOSER_CONTROLLER_CHOOSER_CONTROLLER_H_
6 #define CHROME_BROWSER_CHOOSER_CONTROLLER_CHOOSER_CONTROLLER_H_ 6 #define CHROME_BROWSER_CHOOSER_CONTROLLER_CHOOSER_CONTROLLER_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/strings/string16.h" 9 #include "base/strings/string16.h"
10 10
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 // Called when GetOption(index) is no longer present, and all later 45 // Called when GetOption(index) is no longer present, and all later
46 // options have been moved earlier by 1 slot. Calling GetOption(index) 46 // options have been moved earlier by 1 slot. Calling GetOption(index)
47 // from inside a call to OnOptionRemoved will NOT see the removed string 47 // from inside a call to OnOptionRemoved will NOT see the removed string
48 // since the options have already been updated. 48 // since the options have already been updated.
49 virtual void OnOptionRemoved(size_t index) = 0; 49 virtual void OnOptionRemoved(size_t index) = 0;
50 50
51 protected: 51 protected:
52 virtual ~Observer() {} 52 virtual ~Observer() {}
53 }; 53 };
54 54
55 // Return the origin URL to be displayed on the chooser title. 55 // Returns the text to be displayed in the chooser title.
56 url::Origin GetOrigin() const; 56 base::string16 GetTitle();
57 57
58 // The number of options users can pick from. For example, it can be 58 // The number of options users can pick from. For example, it can be
59 // the number of USB/Bluetooth device names which are listed in the 59 // the number of USB/Bluetooth device names which are listed in the
60 // chooser so that users can grant permission. 60 // chooser so that users can grant permission.
61 virtual size_t NumOptions() const = 0; 61 virtual size_t NumOptions() const = 0;
62 62
63 // The |index|th option string which is listed in the chooser. 63 // The |index|th option string which is listed in the chooser.
64 virtual base::string16 GetOption(size_t index) const = 0; 64 virtual base::string16 GetOption(size_t index) const = 0;
65 65
66 // These three functions are called just before this object is destroyed: 66 // These three functions are called just before this object is destroyed:
67 67
68 // Called when the user selects the |index|th element from the dialog. 68 // Called when the user selects the |index|th element from the dialog.
69 virtual void Select(size_t index) = 0; 69 virtual void Select(size_t index) = 0;
70 70
71 // Called when the user presses the 'Cancel' button in the dialog. 71 // Called when the user presses the 'Cancel' button in the dialog.
72 virtual void Cancel() = 0; 72 virtual void Cancel() = 0;
73 73
74 // Called when the user clicks outside the dialog or the dialog otherwise 74 // Called when the user clicks outside the dialog or the dialog otherwise
75 // closes without the user taking an explicit action. 75 // closes without the user taking an explicit action.
76 virtual void Close() = 0; 76 virtual void Close() = 0;
77 77
78 // Open help center URL. 78 // Open help center URL.
79 virtual void OpenHelpCenterUrl() const = 0; 79 virtual void OpenHelpCenterUrl() const = 0;
80 80
81 // Only one observer may be registered at a time. 81 // Only one observer may be registered at a time.
82 void set_observer(Observer* observer) { observer_ = observer; } 82 void set_observer(Observer* observer) { observer_ = observer; }
83 Observer* observer() const { return observer_; } 83 Observer* observer() const { return observer_; }
84 84
85 protected:
86 // Return the title prefix to be displayed on the chooser.
87 base::string16 GetTitlePrefix();
88
85 private: 89 private:
86 content::RenderFrameHost* owning_frame_; 90 content::RenderFrameHost* owning_frame_;
91 bool title_prefix_has_quote_ = true;
87 Observer* observer_ = nullptr; 92 Observer* observer_ = nullptr;
88 93
89 DISALLOW_COPY_AND_ASSIGN(ChooserController); 94 DISALLOW_COPY_AND_ASSIGN(ChooserController);
90 }; 95 };
91 96
92 #endif // CHROME_BROWSER_CHOOSER_CONTROLLER_CHOOSER_CONTROLLER_H_ 97 #endif // CHROME_BROWSER_CHOOSER_CONTROLLER_CHOOSER_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698