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

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

Issue 2901273003: chromeos: Remove TrayBubbleView::Delegate::OnBeforeBubbleWidgetInit (Closed)
Patch Set: cleanup Created 3 years, 7 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 "ash/system/palette/palette_tray.h" 5 #include "ash/system/palette/palette_tray.h"
6 6
7 #include "ash/public/cpp/shell_window_ids.h"
8 #include "ash/resources/grit/ash_resources.h" 7 #include "ash/resources/grit/ash_resources.h"
9 #include "ash/resources/vector_icons/vector_icons.h" 8 #include "ash/resources/vector_icons/vector_icons.h"
10 #include "ash/root_window_controller.h" 9 #include "ash/root_window_controller.h"
11 #include "ash/session/session_controller.h" 10 #include "ash/session/session_controller.h"
12 #include "ash/shelf/shelf_constants.h" 11 #include "ash/shelf/shelf_constants.h"
13 #include "ash/shelf/wm_shelf.h" 12 #include "ash/shelf/wm_shelf.h"
14 #include "ash/shell.h" 13 #include "ash/shell.h"
15 #include "ash/strings/grit/ash_strings.h" 14 #include "ash/strings/grit/ash_strings.h"
16 #include "ash/system/palette/palette_tool_manager.h" 15 #include "ash/system/palette/palette_tool_manager.h"
17 #include "ash/system/palette/palette_utils.h" 16 #include "ash/system/palette/palette_utils.h"
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 if (bubble_) 178 if (bubble_)
180 return false; 179 return false;
181 180
182 DCHECK(tray_container()); 181 DCHECK(tray_container());
183 182
184 views::TrayBubbleView::InitParams init_params(GetAnchorAlignment(), 183 views::TrayBubbleView::InitParams init_params(GetAnchorAlignment(),
185 kPaletteWidth, kPaletteWidth); 184 kPaletteWidth, kPaletteWidth);
186 init_params.can_activate = true; 185 init_params.can_activate = true;
187 init_params.close_on_deactivate = true; 186 init_params.close_on_deactivate = true;
188 187
189 DCHECK(tray_container());
190
191 // TODO(tdanderson): Refactor into common row layout code. 188 // TODO(tdanderson): Refactor into common row layout code.
192 // TODO(tdanderson|jdufault): Add material design ripple effects to the menu 189 // TODO(tdanderson|jdufault): Add material design ripple effects to the menu
193 // rows. 190 // rows.
194 191
195 // Create and customize bubble view. 192 // Create and customize bubble view.
196 views::TrayBubbleView* bubble_view = 193 views::TrayBubbleView* bubble_view = new views::TrayBubbleView(
197 views::TrayBubbleView::Create(GetBubbleAnchor(), this, &init_params); 194 GetBubbleWindowContainer(), GetBubbleAnchor(), this, init_params);
198 bubble_view->set_anchor_view_insets(GetBubbleAnchorInsets()); 195 bubble_view->set_anchor_view_insets(GetBubbleAnchorInsets());
199 bubble_view->set_margins( 196 bubble_view->set_margins(
200 gfx::Insets(kPalettePaddingOnTop, 0, kPalettePaddingOnBottom, 0)); 197 gfx::Insets(kPalettePaddingOnTop, 0, kPalettePaddingOnBottom, 0));
201 198
202 // Add title. 199 // Add title.
203 auto* title_view = new TitleView(this); 200 auto* title_view = new TitleView(this);
204 title_view->SetBorder(views::CreateEmptyBorder( 201 title_view->SetBorder(views::CreateEmptyBorder(
205 gfx::Insets(0, kPaddingBetweenTitleAndLeftEdge, 0, 0))); 202 gfx::Insets(0, kPaddingBetweenTitleAndLeftEdge, 0, 0)));
206 bubble_view->AddChildView(title_view); 203 bubble_view->AddChildView(title_view);
207 204
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 } 294 }
298 295
299 void PaletteTray::OnMouseEnteredView() {} 296 void PaletteTray::OnMouseEnteredView() {}
300 297
301 void PaletteTray::OnMouseExitedView() {} 298 void PaletteTray::OnMouseExitedView() {}
302 299
303 base::string16 PaletteTray::GetAccessibleNameForBubble() { 300 base::string16 PaletteTray::GetAccessibleNameForBubble() {
304 return GetAccessibleNameForTray(); 301 return GetAccessibleNameForTray();
305 } 302 }
306 303
307 void PaletteTray::OnBeforeBubbleWidgetInit(
308 views::Widget* anchor_widget,
309 views::Widget* bubble_widget,
310 views::Widget::InitParams* params) const {
311 // Place the bubble in the same root window as |anchor_widget|.
312 RootWindowController::ForWindow(anchor_widget->GetNativeWindow())
313 ->ConfigureWidgetInitParamsForContainer(
314 bubble_widget, kShellWindowId_SettingBubbleContainer, params);
315 }
316
317 void PaletteTray::HideBubble(const views::TrayBubbleView* bubble_view) { 304 void PaletteTray::HideBubble(const views::TrayBubbleView* bubble_view) {
318 HideBubbleWithView(bubble_view); 305 HideBubbleWithView(bubble_view);
319 } 306 }
320 307
321 void PaletteTray::HidePalette() { 308 void PaletteTray::HidePalette() {
322 is_bubble_auto_opened_ = false; 309 is_bubble_auto_opened_ = false;
323 num_actions_in_bubble_ = 0; 310 num_actions_in_bubble_ = 0;
324 bubble_.reset(); 311 bubble_.reset();
325 312
326 shelf()->UpdateAutoHideState(); 313 shelf()->UpdateAutoHideState();
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
396 UpdateIconVisibility(); 383 UpdateIconVisibility();
397 } 384 }
398 } 385 }
399 386
400 void PaletteTray::UpdateIconVisibility() { 387 void PaletteTray::UpdateIconVisibility() {
401 SetVisible(is_palette_enabled_ && palette_utils::HasStylusInput() && 388 SetVisible(is_palette_enabled_ && palette_utils::HasStylusInput() &&
402 ShouldShowOnDisplay(this) && IsInUserSession()); 389 ShouldShowOnDisplay(this) && IsInUserSession());
403 } 390 }
404 391
405 } // namespace ash 392 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698