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

Side by Side Diff: ash/system/palette/palette_tray.cc

Issue 2826593002: Remove ash's MaterialDesignController. (Closed)
Patch Set: one more dead include Created 3 years, 8 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
« no previous file with comments | « ash/material_design/material_design_controller.cc ('k') | ash/system/status_area_widget.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "ash/system/palette/palette_tray.h" 5 #include "ash/system/palette/palette_tray.h"
6 6
7 #include "ash/material_design/material_design_controller.h"
8 #include "ash/public/cpp/shell_window_ids.h" 7 #include "ash/public/cpp/shell_window_ids.h"
9 #include "ash/resources/grit/ash_resources.h" 8 #include "ash/resources/grit/ash_resources.h"
10 #include "ash/resources/vector_icons/vector_icons.h" 9 #include "ash/resources/vector_icons/vector_icons.h"
11 #include "ash/root_window_controller.h" 10 #include "ash/root_window_controller.h"
12 #include "ash/session/session_controller.h" 11 #include "ash/session/session_controller.h"
13 #include "ash/shelf/shelf_constants.h" 12 #include "ash/shelf/shelf_constants.h"
14 #include "ash/shelf/wm_shelf.h" 13 #include "ash/shelf/wm_shelf.h"
15 #include "ash/shelf/wm_shelf_util.h" 14 #include "ash/shelf/wm_shelf_util.h"
16 #include "ash/shell.h" 15 #include "ash/shell.h"
17 #include "ash/strings/grit/ash_strings.h" 16 #include "ash/strings/grit/ash_strings.h"
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 new views::BoxLayout(views::BoxLayout::kHorizontal, 0, 0, 0); 78 new views::BoxLayout(views::BoxLayout::kHorizontal, 0, 0, 0);
80 SetLayoutManager(box_layout); 79 SetLayoutManager(box_layout);
81 80
82 auto* title_label = 81 auto* title_label =
83 new views::Label(l10n_util::GetStringUTF16(IDS_ASH_STYLUS_TOOLS_TITLE)); 82 new views::Label(l10n_util::GetStringUTF16(IDS_ASH_STYLUS_TOOLS_TITLE));
84 title_label->SetHorizontalAlignment(gfx::ALIGN_LEFT); 83 title_label->SetHorizontalAlignment(gfx::ALIGN_LEFT);
85 AddChildView(title_label); 84 AddChildView(title_label);
86 TrayPopupItemStyle style(TrayPopupItemStyle::FontStyle::TITLE); 85 TrayPopupItemStyle style(TrayPopupItemStyle::FontStyle::TITLE);
87 style.SetupLabel(title_label); 86 style.SetupLabel(title_label);
88 box_layout->SetFlexForView(title_label, 1); 87 box_layout->SetFlexForView(title_label, 1);
89 if (MaterialDesignController::IsSystemTrayMenuMaterial()) { 88 help_button_ =
90 help_button_ = 89 new SystemMenuButton(this, TrayPopupInkDropStyle::HOST_CENTERED,
91 new SystemMenuButton(this, TrayPopupInkDropStyle::HOST_CENTERED, 90 kSystemMenuHelpIcon, IDS_ASH_STATUS_TRAY_HELP);
92 kSystemMenuHelpIcon, IDS_ASH_STATUS_TRAY_HELP); 91 settings_button_ =
93 settings_button_ = new SystemMenuButton( 92 new SystemMenuButton(this, TrayPopupInkDropStyle::HOST_CENTERED,
94 this, TrayPopupInkDropStyle::HOST_CENTERED, kSystemMenuSettingsIcon, 93 kSystemMenuSettingsIcon, IDS_ASH_PALETTE_SETTINGS);
95 IDS_ASH_PALETTE_SETTINGS);
96 } else {
97 gfx::ImageSkia help_icon =
98 gfx::CreateVectorIcon(kSystemMenuHelpIcon, kMenuIconColor);
99 gfx::ImageSkia settings_icon =
100 gfx::CreateVectorIcon(kSystemMenuSettingsIcon, kMenuIconColor);
101
102 auto* help_button = new ash::TrayPopupHeaderButton(
103 this, help_icon, IDS_ASH_STATUS_TRAY_HELP);
104 help_button->SetTooltipText(
105 l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_HELP));
106 help_button_ = help_button;
107
108 auto* settings_button = new ash::TrayPopupHeaderButton(
109 this, settings_icon, IDS_ASH_STATUS_TRAY_SETTINGS);
110 settings_button->SetTooltipText(
111 l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_SETTINGS));
112 settings_button_ = settings_button;
113 }
114 94
115 AddChildView(help_button_); 95 AddChildView(help_button_);
116 AddChildView(settings_button_); 96 AddChildView(settings_button_);
117 } 97 }
118 98
119 ~TitleView() override {} 99 ~TitleView() override {}
120 100
121 private: 101 private:
122 // views::ButtonListener: 102 // views::ButtonListener:
123 void ButtonPressed(views::Button* sender, const ui::Event& event) override { 103 void ButtonPressed(views::Button* sender, const ui::Event& event) override {
(...skipping 22 matching lines...) Expand all
146 }; 126 };
147 127
148 } // namespace 128 } // namespace
149 129
150 PaletteTray::PaletteTray(WmShelf* wm_shelf) 130 PaletteTray::PaletteTray(WmShelf* wm_shelf)
151 : TrayBackgroundView(wm_shelf, true), 131 : TrayBackgroundView(wm_shelf, true),
152 palette_tool_manager_(new PaletteToolManager(this)), 132 palette_tool_manager_(new PaletteToolManager(this)),
153 weak_factory_(this) { 133 weak_factory_(this) {
154 PaletteTool::RegisterToolInstances(palette_tool_manager_.get()); 134 PaletteTool::RegisterToolInstances(palette_tool_manager_.get());
155 135
156 if (MaterialDesignController::IsShelfMaterial()) 136 SetInkDropMode(InkDropMode::ON);
157 SetInkDropMode(InkDropMode::ON);
158
159 SetLayoutManager(new views::FillLayout()); 137 SetLayoutManager(new views::FillLayout());
160 icon_ = new views::ImageView(); 138 icon_ = new views::ImageView();
161 UpdateTrayIcon(); 139 UpdateTrayIcon();
162 140
163 tray_container()->SetMargin(kTrayIconMainAxisInset, kTrayIconCrossAxisInset); 141 tray_container()->SetMargin(kTrayIconMainAxisInset, kTrayIconCrossAxisInset);
164 tray_container()->AddChildView(icon_); 142 tray_container()->AddChildView(icon_);
165 143
166 Shell::Get()->AddShellObserver(this); 144 Shell::Get()->AddShellObserver(this);
167 Shell::Get()->session_controller()->AddSessionStateObserver(this); 145 Shell::Get()->session_controller()->AddSessionStateObserver(this);
168 ui::InputDeviceManager::GetInstance()->AddObserver(this); 146 ui::InputDeviceManager::GetInstance()->AddObserver(this);
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 UpdateIconVisibility(); 404 UpdateIconVisibility();
427 } 405 }
428 } 406 }
429 407
430 void PaletteTray::UpdateIconVisibility() { 408 void PaletteTray::UpdateIconVisibility() {
431 SetVisible(is_palette_enabled_ && palette_utils::HasStylusInput() && 409 SetVisible(is_palette_enabled_ && palette_utils::HasStylusInput() &&
432 IsInUserSession()); 410 IsInUserSession());
433 } 411 }
434 412
435 } // namespace ash 413 } // namespace ash
OLDNEW
« no previous file with comments | « ash/material_design/material_design_controller.cc ('k') | ash/system/status_area_widget.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698