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

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: Some polish after self review. 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
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 82da40f2907632acae01825a17e8bb93f672f05c..d8b6720e7dac303c69e52d06ddf88c28eb3a6c98 100644
--- a/ash/common/system/tray/tray_popup_utils.h
+++ b/ash/common/system/tray/tray_popup_utils.h
@@ -9,6 +9,7 @@
#include "base/strings/string16.h"
namespace views {
+class Border;
class ButtonListener;
class ImageView;
class Label;
@@ -23,24 +24,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
@@ -49,28 +65,48 @@ 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 on the returned TriView for the given |container|. To be used
tdanderson 2016/11/09 01:38:33 wording: "... just like CreateDefaultRowView() wou
bruthig 2016/11/10 02:54:54 Done.
+ // when mutliple targetable areas are required within a single row.
+ static void ConfigureContainer(TriView::Container container,
+ views::View* container_view);
+
private:
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

Powered by Google App Engine
This is Rietveld 408576698