Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_UI_WEBSITE_SETTINGS_CHOOSER_OPTIONS_H_ | |
| 6 #define CHROME_BROWSER_UI_WEBSITE_SETTINGS_CHOOSER_OPTIONS_H_ | |
| 7 | |
| 8 #include <string> | |
| 9 #include <vector> | |
| 10 | |
| 11 #include "base/macros.h" | |
| 12 #include "base/strings/string16.h" | |
| 13 | |
| 14 // Stores all the available chooser options, handle options initialization, | |
| 15 // option added/removed. | |
| 16 class ChooserOptions { | |
| 17 public: | |
| 18 ChooserOptions() {} | |
| 19 virtual ~ChooserOptions() {} | |
| 20 | |
| 21 class Observer { | |
| 22 public: | |
| 23 virtual void OnOptionsInitialized() = 0; | |
|
Jeffrey Yasskin
2015/12/07 23:57:55
Is there a guarantee that OnOptionsInitialized() i
juncai
2015/12/08 20:16:29
Yes, it is called only once at the ChooserBubbleDe
| |
| 24 virtual void OnOptionAdded(int index) = 0; | |
| 25 virtual void OnOptionRemoved(int index) = 0; | |
| 26 | |
| 27 protected: | |
| 28 virtual ~Observer() {} | |
| 29 }; | |
| 30 | |
| 31 virtual const std::vector<base::string16>& GetOptions() const = 0; | |
| 32 virtual void Select(int index) = 0; | |
|
Jeffrey Yasskin
2015/12/07 23:57:54
Does a call to Select() indicate that the ChooserO
juncai
2015/12/08 20:16:29
Yes.
| |
| 33 | |
| 34 void set_observer(Observer* observer) { observer_ = observer; } | |
| 35 Observer* observer() const { return observer_; } | |
| 36 | |
| 37 private: | |
| 38 Observer* observer_ = nullptr; | |
| 39 DISALLOW_COPY_AND_ASSIGN(ChooserOptions); | |
| 40 }; | |
| 41 | |
| 42 #endif // CHROME_BROWSER_UI_WEBSITE_SETTINGS_CHOOSER_OPTIONS_H_ | |
| OLD | NEW |