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_UI_VIEWS_APPS_APP_INFO_DIALOG_APP_INFO_PERMISSIONS_PANEL_H_
6 #define CHROME_BROWSER_UI_VIEWS_APPS_APP_INFO_DIALOG_APP_INFO_PERMISSIONS_PANEL_H_
10 #include "chrome/browser/ui/views/apps/app_info_dialog/app_info_panel.h"
11 #include "ui/gfx/text_constants.h"
12 #include "ui/views/controls/button/button.h"
16 namespace extensions {
30 // The summary panel of the app info dialog, which provides basic information
31 // and controls related to the app.
32 class AppInfoPermissionsPanel : public AppInfoPanel,
33 public views::ButtonListener {
35 AppInfoPermissionsPanel(Profile* profile, const extensions::Extension* app);
37 virtual ~AppInfoPermissionsPanel();
40 FRIEND_TEST_ALL_PREFIXES(AppInfoPermissionsPanelTest,
41 NoPermissionsObtainedCorrectly);
42 FRIEND_TEST_ALL_PREFIXES(AppInfoPermissionsPanelTest,
43 RequiredPermissionsObtainedCorrectly);
44 FRIEND_TEST_ALL_PREFIXES(AppInfoPermissionsPanelTest,
45 OptionalPermissionsObtainedCorrectly);
46 FRIEND_TEST_ALL_PREFIXES(AppInfoPermissionsPanelTest,
47 RetainedFilePermissionsObtainedCorrectly);
49 // Given a list of strings, returns a view containing a list of these strings
50 // as bulleted items with the given |elide_behavior|. If |allow_multiline| is
51 // true, allow multi-lined bulleted items and ignore the |elide_behavior|.
52 views::View* CreateBulletedListView(
53 const std::vector<base::string16>& messages,
55 gfx::ElideBehavior elide_behavior);
57 // Internal initialisation methods.
58 void CreateActivePermissionsControl();
59 void CreateRetainedFilesControl();
61 void LayoutActivePermissionsControl();
62 void LayoutRetainedFilesControl();
64 // Overridden from views::ButtonListener.
65 virtual void ButtonPressed(views::Button* sender,
66 const ui::Event& event) OVERRIDE;
68 const std::vector<base::string16> GetActivePermissionMessages() const;
69 const std::vector<base::string16> GetRetainedFilePaths() const;
70 void RevokeFilePermissions();
72 // UI elements on the dialog.
73 views::Label* active_permissions_heading_;
74 views::View* active_permissions_list_;
76 views::Label* retained_files_heading_;
77 views::View* retained_files_list_;
78 views::LabelButton* revoke_file_permissions_button_;
80 DISALLOW_COPY_AND_ASSIGN(AppInfoPermissionsPanel);
83 #endif // CHROME_BROWSER_UI_VIEWS_APPS_APP_INFO_DIALOG_APP_INFO_PERMISSIONS_PANEL_H_