app_info_permissions_panel.h revision f8ee788a64d60abd8f2d742a5fdedde054ecd910
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. 4 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_ 7 8#include <vector> 9 10#include "chrome/browser/ui/views/apps/app_info_dialog/app_info_panel.h" 11#include "ui/views/controls/button/button.h" 12 13class Profile; 14 15namespace extensions { 16class Extension; 17} 18 19namespace ui { 20class Event; 21} 22 23namespace views { 24class Label; 25class LabelButton; 26class View; 27} 28 29// The summary panel of the app info dialog, which provides basic information 30// and controls related to the app. 31class AppInfoPermissionsPanel : public AppInfoPanel, 32 public views::ButtonListener { 33 public: 34 AppInfoPermissionsPanel(Profile* profile, const extensions::Extension* app); 35 36 virtual ~AppInfoPermissionsPanel(); 37 38 private: 39 FRIEND_TEST_ALL_PREFIXES(AppInfoPermissionsPanelTest, 40 NoPermissionsObtainedCorrectly); 41 FRIEND_TEST_ALL_PREFIXES(AppInfoPermissionsPanelTest, 42 RequiredPermissionsObtainedCorrectly); 43 FRIEND_TEST_ALL_PREFIXES(AppInfoPermissionsPanelTest, 44 OptionalPermissionsObtainedCorrectly); 45 FRIEND_TEST_ALL_PREFIXES(AppInfoPermissionsPanelTest, 46 RetainedFilePermissionsObtainedCorrectly); 47 48 // Given a list of strings, returns a view containing a list of these strings 49 // as bulleted items. 50 views::View* CreateBulletedListView( 51 const std::vector<base::string16>& messages); 52 53 // Internal initialisation methods. 54 void CreateActivePermissionsControl(); 55 void CreateRetainedFilesControl(); 56 57 void LayoutActivePermissionsControl(); 58 void LayoutRetainedFilesControl(); 59 60 // Overridden from views::ButtonListener. 61 virtual void ButtonPressed(views::Button* sender, 62 const ui::Event& event) OVERRIDE; 63 64 const std::vector<base::string16> GetActivePermissionMessages() const; 65 const std::vector<base::string16> GetRetainedFilePaths() const; 66 void RevokeFilePermissions(); 67 68 // UI elements on the dialog. 69 views::Label* active_permissions_heading_; 70 views::View* active_permissions_list_; 71 72 views::Label* retained_files_heading_; 73 views::View* retained_files_list_; 74 views::LabelButton* revoke_file_permissions_button_; 75 76 DISALLOW_COPY_AND_ASSIGN(AppInfoPermissionsPanel); 77}; 78 79#endif // CHROME_BROWSER_UI_VIEWS_APPS_APP_INFO_DIALOG_APP_INFO_PERMISSIONS_PANEL_H_ 80