Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1620)

Unified Diff: ash/common/system/tray/tray_popup_utils.h

Issue 2482043002: [ash-md] Updated layout of Brightness and Audio system menu rows to the material design spec. (Closed)
Patch Set: Fixed the volume slider to transition to the detailed view on <return> keypress. Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/common/system/tray/tray_constants.cc ('k') | ash/common/system/tray/tray_popup_utils.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/common/system/tray/tray_popup_utils.h
diff --git a/ash/common/system/tray/tray_popup_utils.h b/ash/common/system/tray/tray_popup_utils.h
index 0412752cacfeef0acd35c70f56aa129db04ab175..7d0d5720e06643dc312306502837a7ae52739635 100644
--- a/ash/common/system/tray/tray_popup_utils.h
+++ b/ash/common/system/tray/tray_popup_utils.h
@@ -10,6 +10,7 @@
#include "base/strings/string16.h"
namespace views {
+class Border;
class ButtonListener;
class ImageView;
class Label;
@@ -25,24 +26,39 @@ namespace ash {
// Factory/utility functions used by the system menu.
class TrayPopupUtils {
public:
- // Creates a default container view to be used most system menu rows. The
- // caller takes over ownership of the created view.
+ // Creates a default container view to be used by system menu rows that are
+ // either a single targetable area or not targetable at all. The caller takes
+ // over ownership of the created view.
//
// The returned view consists of 3 regions: START, CENTER, and END. Any child
- // Views added to the START and END containers will be added horizonatlly and
+ // Views added to the START and END containers will be added horizontally and
// any Views added to the CENTER container will be added vertically.
//
- // The START and END containers have a fixed width but can grow into the
- // CENTER container if space is required and available.
+ // The START and END containers have a fixed minimum width but can grow into
+ // the CENTER container if space is required and available.
//
// The CENTER container has a flexible width.
static TriView* CreateDefaultRowView();
- // Creates the default layout manager by CreateDefault() row for the given
- // |container|. To be used when mutliple targetable areas are required within
- // a single row.
- static std::unique_ptr<views::LayoutManager> CreateLayoutManager(
- TriView::Container container);
+ // Creates a container view to be used by system menu rows that want to embed
+ // a targetable area within one (or more) of the containers OR by any row
+ // that requires a non-default layout within the container views. The returned
+ // view will have the following configurations:
+ // - default minimum row height
+ // - default minimum width for the START and END containers
+ // - default left and right insets
+ // - default container flex values
+ // - Each container view will have a FillLayout installed on it
+ //
+ // The caller takes over ownership of the created view.
+ //
+ // The START and END containers have a fixed minimum width but can grow into
+ // the CENTER container if space is required and available. The CENTER
+ // container has a flexible width.
+ //
+ // Clients can use ConfigureContainer() to configure their own container views
+ // before adding them to the returned TriView.
+ static TriView* CreateMultiTargetRowView();
// Returns a label that has been configured for system menu layout. This
// should be used by all rows that require a label, i.e. both default and
@@ -51,20 +67,30 @@ class TrayPopupUtils {
// TODO(bruthig): Update all system menu rows to use this.
static views::Label* CreateDefaultLabel();
- // Returns an image view to be used for the main image of a system menu row.
- // This should be used by all rows that have a main image, i.e. both default
- // and detailed rows should use this.
+ // Returns an image view to be used in the main image region of a system menu
+ // row. This should be used by all rows that have a main image, i.e. both
+ // default and detailed rows should use this.
//
// TODO(bruthig): Update all system menu rows to use this.
static views::ImageView* CreateMainImageView();
- // Returns an image view to be used for the 'more' arrow image on rows. In
- // general this applies to all rows in the system menu that have a 'more'
- // image however most, if not all, are default rows.
+ // Returns an image view to be used in the 'more' region of default rows. This
+ // is used for all 'more' images as well as other images that appear in this
+ // region, e.g. audio output icon.
//
// TODO(bruthig): Update all default rows to use this.
static views::ImageView* CreateMoreImageView();
+ // Returns a slider configured for proper layout within a TriView container
+ // with a FillLayout.
+ static views::Slider* CreateSlider(views::SliderListener* listener);
+
+ // Configures |container_view| just like CreateDefaultRowView() would
+ // configure |container| on its returned TriView. To be used when mutliple
+ // targetable areas are required within a single row.
+ static void ConfigureContainer(TriView::Container container,
+ views::View* container_view);
+
// Creates a button for use in the system menu that only has a visible border
// when being hovered/clicked. Caller assumes ownership.
static views::LabelButton* CreateTrayPopupBorderlessButton(
@@ -93,10 +119,20 @@ class TrayPopupUtils {
TrayPopupUtils() = delete;
~TrayPopupUtils() = delete;
- // Configures the specified |container| view with the default layout. Used by
- // CreateDefaultRowView().
- static void ConfigureDefaultLayout(TriView* tri_view,
- TriView::Container container);
+ // Configures the default size and flex value for the specified |container|
+ // of the given |tri_view|. Used by CreateDefaultRowView().
+ static void ConfigureDefaultSizeAndFlex(TriView* tri_view,
+ TriView::Container container);
+
+ // Returns the default layout manager used by CreateDefaultRowView() and
+ // ConfigureContainer() for the given |container|.
+ static std::unique_ptr<views::LayoutManager> CreateDefaultLayoutManager(
+ TriView::Container container);
+
+ // Returns the default border used by CreateDefaultRow() and
+ // ConfigureContainer() for the given |container|.
+ static std::unique_ptr<views::Border> CreateDefaultBorder(
+ TriView::Container container);
};
} // namespace ash
« no previous file with comments | « ash/common/system/tray/tray_constants.cc ('k') | ash/common/system/tray/tray_popup_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698