Chromium Code Reviews| 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_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 |
| 11 namespace content { | 11 namespace content { |
| 12 class RenderFrameHost; | 12 class RenderFrameHost; |
| 13 } | 13 } |
| 14 | 14 |
| 15 // Subclass ChooserController to implement a chooser, which has some | 15 // Subclass ChooserController to implement a chooser, which has some |
| 16 // introductory text and a list of options that users can pick one of. | 16 // introductory text and a list of options that users can pick one of. |
| 17 // Your subclass must define the set of options users can pick from; | 17 // Your subclass must define the set of options users can pick from; |
| 18 // the actions taken after users select an item or press the 'Cancel' | 18 // the actions taken after users select an item or press the 'Cancel' |
| 19 // button or the chooser is closed. | 19 // button or the chooser is closed. |
| 20 // After Select/Cancel/Close is called, this object is destroyed and | 20 // After Select/Cancel/Close is called, this object is destroyed and |
| 21 // calls back into it are not allowed. | 21 // calls back into it are not allowed. |
| 22 class ChooserController { | 22 class ChooserController { |
| 23 public: | 23 public: |
| 24 explicit ChooserController(content::RenderFrameHost* owner); | 24 ChooserController(content::RenderFrameHost* owner, |
| 25 int title_string_id_origin, | |
| 26 int title_string_id_extension); | |
| 25 virtual ~ChooserController(); | 27 virtual ~ChooserController(); |
| 26 | 28 |
| 27 // Since the set of options can change while the UI is visible an | 29 // Since the set of options can change while the UI is visible an |
| 28 // implementation should register an observer. | 30 // implementation should register an observer. |
| 29 class Observer { | 31 class Observer { |
| 30 public: | 32 public: |
| 31 // Called after the options list is initialized for the first time. | 33 // Called after the options list is initialized for the first time. |
| 32 // OnOptionsInitialized should only be called once. | 34 // OnOptionsInitialized should only be called once. |
| 33 virtual void OnOptionsInitialized() = 0; | 35 virtual void OnOptionsInitialized() = 0; |
| 34 | 36 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 76 | 78 |
| 77 // Open help center URL. | 79 // Open help center URL. |
| 78 virtual void OpenHelpCenterUrl() const = 0; | 80 virtual void OpenHelpCenterUrl() const = 0; |
| 79 | 81 |
| 80 // Only one observer may be registered at a time. | 82 // Only one observer may be registered at a time. |
| 81 void set_observer(Observer* observer) { observer_ = observer; } | 83 void set_observer(Observer* observer) { observer_ = observer; } |
| 82 Observer* observer() const { return observer_; } | 84 Observer* observer() const { return observer_; } |
| 83 | 85 |
| 84 private: | 86 private: |
| 85 content::RenderFrameHost* owning_frame_; | 87 content::RenderFrameHost* owning_frame_; |
| 88 int title_string_id_origin_; | |
| 89 int title_string_id_extension_; | |
|
Reilly Grant (use Gerrit)
2016/07/13 20:40:08
These three can all be const:
content::RenderFram
juncai
2016/07/13 23:03:26
Done.
| |
| 86 Observer* observer_ = nullptr; | 90 Observer* observer_ = nullptr; |
| 87 | 91 |
| 88 DISALLOW_COPY_AND_ASSIGN(ChooserController); | 92 DISALLOW_COPY_AND_ASSIGN(ChooserController); |
| 89 }; | 93 }; |
| 90 | 94 |
| 91 #endif // CHROME_BROWSER_CHOOSER_CONTROLLER_CHOOSER_CONTROLLER_H_ | 95 #endif // CHROME_BROWSER_CHOOSER_CONTROLLER_CHOOSER_CONTROLLER_H_ |
| OLD | NEW |