Revert "Reland c91b178b07b0d - Delete dead signin code (SigninGlobalError)"
[chromium-blink-merge.git] / chrome / browser / media_galleries / media_galleries_dialog_controller.h
blobc8e016e86bf755351d7827e8e6ce0b2763fe1d65
1 // Copyright 2014 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.
5 #ifndef CHROME_BROWSER_MEDIA_GALLERIES_MEDIA_GALLERIES_DIALOG_CONTROLLER_H_
6 #define CHROME_BROWSER_MEDIA_GALLERIES_MEDIA_GALLERIES_DIALOG_CONTROLLER_H_
8 #include <vector>
10 #include "base/strings/string16.h"
11 #include "chrome/browser/media_galleries/media_galleries_preferences.h"
13 namespace content {
14 class WebContents;
17 namespace ui {
18 class MenuModel;
21 class MediaGalleriesDialogController;
23 // The view.
24 class MediaGalleriesDialog {
25 public:
26 virtual ~MediaGalleriesDialog();
28 // Tell the dialog to update its display list of galleries.
29 virtual void UpdateGalleries() = 0;
31 // Constructs a platform-specific dialog owned and controlled by |controller|.
32 static MediaGalleriesDialog* Create(
33 MediaGalleriesDialogController* controller);
34 private:
35 friend class TestMediaGalleriesAddScanResultsFunction;
37 virtual void AcceptDialogForTesting() = 0;
40 // Multiple dialog controllers are based on this interface.
41 // Implementations of this controller interface are responsible for handling
42 // the logic of the dialog and interfacing with the model (i.e.,
43 // MediaGalleriesPreferences). It shows the dialog and owns itself.
44 class MediaGalleriesDialogController {
45 public:
46 struct Entry {
47 Entry(const MediaGalleryPrefInfo& pref_info, bool selected)
48 : pref_info(pref_info),
49 selected(selected) {
51 Entry() {}
53 MediaGalleryPrefInfo pref_info;
54 bool selected;
57 typedef std::vector<Entry> Entries;
59 // The title of the dialog view.
60 virtual base::string16 GetHeader() const = 0;
62 // Explanatory text directly below the title.
63 virtual base::string16 GetSubtext() const = 0;
65 // Initial state of whether the dialog's confirmation button will be enabled.
66 virtual bool IsAcceptAllowed() const = 0;
68 // Should the dialog present UI for the user to view the entry contents.
69 virtual bool ShouldShowFolderViewer(const Entry& entry) const = 0;
71 // The titles for different sections of entries. Empty hides the header.
72 virtual std::vector<base::string16> GetSectionHeaders() const = 0;
74 // Get the set of permissions for the |index|th section. The size of the
75 // vector returned from GetSectionHeaders() defines the number of sections.
76 virtual Entries GetSectionEntries(size_t index) const = 0;
78 // The text for an auxiliary button. Empty hides the button.
79 virtual base::string16 GetAuxiliaryButtonText() const = 0;
81 // Called when an auxiliary button is clicked.
82 virtual void DidClickAuxiliaryButton() = 0;
84 // An entry checkbox was toggled.
85 virtual void DidToggleEntry(MediaGalleryPrefId id, bool selected) = 0;
87 // A folder viewer button was clicked for one of the entries.
88 virtual void DidClickOpenFolderViewer(MediaGalleryPrefId id) = 0;
90 // The forget command in the context menu was selected.
91 virtual void DidForgetEntry(MediaGalleryPrefId id) = 0;
93 // The text for the accept button.
94 virtual base::string16 GetAcceptButtonText() const = 0;
96 // The dialog is being deleted.
97 virtual void DialogFinished(bool accepted) = 0;
99 virtual ui::MenuModel* GetContextMenu(MediaGalleryPrefId id) = 0;
101 virtual content::WebContents* WebContents() = 0;
103 protected:
104 MediaGalleriesDialogController();
105 virtual ~MediaGalleriesDialogController();
107 DISALLOW_COPY_AND_ASSIGN(MediaGalleriesDialogController);
110 #endif // CHROME_BROWSER_MEDIA_GALLERIES_MEDIA_GALLERIES_DIALOG_CONTROLLER_H_