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

Side by Side Diff: chrome/browser/ui/views/harmony/layout_delegate.cc

Issue 2744463002: Add VectorIconButton functionality to ImageButton. (Closed)
Patch Set: wip: address high-level comments Created 3 years, 9 months 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/views/harmony/layout_delegate.h" 5 #include "chrome/browser/ui/views/harmony/layout_delegate.h"
6 6
7 #include "base/lazy_instance.h" 7 #include "base/lazy_instance.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "chrome/browser/ui/views/chrome_views_delegate.h" 9 #include "chrome/browser/ui/views/chrome_views_delegate.h"
10 #include "chrome/browser/ui/views/harmony/harmony_layout_delegate.h" 10 #include "chrome/browser/ui/views/harmony/harmony_layout_delegate.h"
11 #include "ui/base/material_design/material_design_controller.h" 11 #include "ui/base/material_design/material_design_controller.h"
12 #include "ui/views/layout/layout_constants.h" 12 #include "ui/views/layout/layout_constants.h"
13 13
14 static base::LazyInstance<LayoutDelegate>::DestructorAtExit layout_delegate_ = 14 static base::LazyInstance<LayoutDelegate>::DestructorAtExit layout_delegate_ =
15 LAZY_INSTANCE_INITIALIZER; 15 LAZY_INSTANCE_INITIALIZER;
16 16
17 // static 17 // static
18 LayoutDelegate* LayoutDelegate::Get() { 18 LayoutDelegate* LayoutDelegate::Get() {
19 return ui::MaterialDesignController::IsSecondaryUiMaterial() 19 return ui::MaterialDesignController::IsSecondaryUiMaterial()
20 ? HarmonyLayoutDelegate::Get() 20 ? HarmonyLayoutDelegate::Get()
21 : layout_delegate_.Pointer(); 21 : layout_delegate_.Pointer();
22 } 22 }
23 23
24 int LayoutDelegate::GetMetric(Metric metric) const { 24 int LayoutDelegate::GetMetric(Metric metric) const {
25 switch (metric) { 25 switch (metric) {
26 case Metric::BUTTON_HORIZONTAL_PADDING: 26 case Metric::BUTTON_HORIZONTAL_PADDING:
27 return ChromeViewsDelegate::GetInstance()->GetDefaultDistanceMetric( 27 return ChromeViewsDelegate::GetInstance()->GetDefaultDistanceMetric(
28 views::DistanceMetric::BUTTON_HORIZONTAL_PADDING); 28 views::DistanceMetric::BUTTON_HORIZONTAL_PADDING);
29 case Metric::BUTTON_MARGIN:
30 return views::kButtonExtraTouchSize;
29 case Metric::BUTTON_MAX_LINKABLE_WIDTH: 31 case Metric::BUTTON_MAX_LINKABLE_WIDTH:
30 return 0; // Buttons never expand during layout (add padding instead). 32 return 0; // Buttons never expand during layout (add padding instead).
31 case Metric::BUTTON_MINIMUM_WIDTH: 33 case Metric::BUTTON_MINIMUM_WIDTH:
32 return views::kMinimumButtonWidth; 34 return views::kMinimumButtonWidth;
33 case Metric::DIALOG_BUTTON_MARGIN: 35 case Metric::DIALOG_BUTTON_MARGIN:
34 return views::kButtonHEdgeMarginNew; 36 return views::kButtonHEdgeMarginNew;
35 case Metric::DIALOG_BUTTON_MINIMUM_WIDTH: 37 case Metric::DIALOG_BUTTON_MINIMUM_WIDTH:
36 return ChromeViewsDelegate::GetInstance()->GetDefaultDistanceMetric( 38 return ChromeViewsDelegate::GetInstance()->GetDefaultDistanceMetric(
37 views::DistanceMetric::DIALOG_BUTTON_MINIMUM_WIDTH); 39 views::DistanceMetric::DIALOG_BUTTON_MINIMUM_WIDTH);
38 case Metric::DIALOG_BUTTON_TOP_SPACING: 40 case Metric::DIALOG_BUTTON_TOP_SPACING:
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 return true; 79 return true;
78 } 80 }
79 81
80 bool LayoutDelegate::IsHarmonyMode() const { 82 bool LayoutDelegate::IsHarmonyMode() const {
81 return false; 83 return false;
82 } 84 }
83 85
84 int LayoutDelegate::GetDialogPreferredWidth(DialogWidth width) const { 86 int LayoutDelegate::GetDialogPreferredWidth(DialogWidth width) const {
85 return 0; 87 return 0;
86 } 88 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698