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_PANEL_H_ 6 #define CHROME_BROWSER_UI_VIEWS_APPS_APP_INFO_DIALOG_APP_INFO_PANEL_H_ 7 8 #include <memory> 9 10 #include "base/macros.h" 11 #include "ui/views/view.h" 12 13 class Profile; 14 15 namespace extensions { 16 class Extension; 17 } 18 namespace views { 19 class Label; 20 } 21 22 // A piece of the App Info dialog that displays information for a particular 23 // profile and app. Panels in the App Info dialog extend this class. 24 class AppInfoPanel : public views::View { 25 public: 26 AppInfoPanel(Profile* profile, const extensions::Extension* app); 27 28 ~AppInfoPanel() override; 29 30 protected: 31 // Closes the dialog. 32 void Close(); 33 34 // Opens the given URL in a new browser tab. 35 void OpenLink(const GURL& url); 36 37 // Create a heading label with the given text. 38 std::unique_ptr<views::Label> CreateHeading(const base::string16& text) const; 39 40 // Create a view with a vertically-stacked box layout, which can have child 41 // views appended to it. |child_spacing| defaults to 42 // |views::kRelatedControlVerticalSpacing|. 43 std::unique_ptr<views::View> CreateVerticalStack(int child_spacing) const; 44 std::unique_ptr<views::View> CreateVerticalStack() const; 45 46 // Create a view with a horizontally-stacked box layout, which can have child 47 // views appended to it. 48 std::unique_ptr<views::View> CreateHorizontalStack(int child_spacing) const; 49 50 // Given a key and a value, displays them side-by-side as a field and its 51 // value. 52 // TODO(dfried): for ease of navigation, use GetStringFUTF16() and format the 53 // key and value together, eliminating this method. 54 std::unique_ptr<views::View> CreateKeyValueField( 55 std::unique_ptr<views::View> key, 56 std::unique_ptr<views::View> value) const; 57 58 Profile* profile_; 59 const extensions::Extension* app_; 60 61 private: 62 DISALLOW_COPY_AND_ASSIGN(AppInfoPanel); 63 }; 64 65 #endif // CHROME_BROWSER_UI_VIEWS_APPS_APP_INFO_DIALOG_APP_INFO_PANEL_H_ 66