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

Side by Side Diff: ash/system/tray/system_tray_bubble.cc

Issue 2092473002: Convert TrayBubbleView to wm common types (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@traybubblewrapper
Patch Set: review feedback Created 4 years, 6 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/system/tray/system_tray.cc ('k') | ash/system/tray/tray_background_view.h » ('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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/tray/system_tray_bubble.h" 5 #include "ash/system/tray/system_tray_bubble.h"
6 6
7 #include "ash/common/system/tray/system_tray_delegate.h" 7 #include "ash/common/system/tray/system_tray_delegate.h"
8 #include "ash/common/system/tray/system_tray_item.h" 8 #include "ash/common/system/tray/system_tray_item.h"
9 #include "ash/common/system/tray/tray_constants.h" 9 #include "ash/common/system/tray/tray_constants.h"
10 #include "ash/common/system/tray/tray_popup_item_container.h" 10 #include "ash/common/system/tray/tray_popup_item_container.h"
11 #include "ash/common/wm_shell.h" 11 #include "ash/common/wm_shell.h"
12 #include "ash/shell.h" 12 #include "ash/shell.h"
13 #include "ash/system/tray/system_tray.h" 13 #include "ash/system/tray/system_tray.h"
14 #include "ash/system/tray/tray_bubble_wrapper.h" 14 #include "ash/system/tray/tray_bubble_wrapper.h"
15 #include "base/threading/thread_task_runner_handle.h" 15 #include "base/threading/thread_task_runner_handle.h"
16 #include "ui/aura/window.h"
17 #include "ui/compositor/layer.h" 16 #include "ui/compositor/layer.h"
18 #include "ui/compositor/layer_animation_observer.h" 17 #include "ui/compositor/layer_animation_observer.h"
19 #include "ui/compositor/scoped_layer_animation_settings.h" 18 #include "ui/compositor/scoped_layer_animation_settings.h"
20 #include "ui/gfx/canvas.h" 19 #include "ui/gfx/canvas.h"
21 #include "ui/views/layout/box_layout.h" 20 #include "ui/views/layout/box_layout.h"
22 #include "ui/views/view.h" 21 #include "ui/views/view.h"
23 #include "ui/views/widget/widget.h" 22 #include "ui/views/widget/widget.h"
24 23
25 using views::TrayBubbleView; 24 using views::TrayBubbleView;
26 25
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 settings.SetTweenType(gfx::Tween::EASE_OUT); 175 settings.SetTweenType(gfx::Tween::EASE_OUT);
177 new_layer->SetTransform(gfx::Transform()); 176 new_layer->SetTransform(gfx::Transform());
178 } 177 }
179 } 178 }
180 } 179 }
181 } 180 }
182 181
183 void SystemTrayBubble::InitView(views::View* anchor, 182 void SystemTrayBubble::InitView(views::View* anchor,
184 LoginStatus login_status, 183 LoginStatus login_status,
185 TrayBubbleView::InitParams* init_params) { 184 TrayBubbleView::InitParams* init_params) {
186 DCHECK(bubble_view_ == NULL); 185 DCHECK(anchor);
186 DCHECK(!bubble_view_);
187 187
188 if (bubble_type_ == BUBBLE_TYPE_DETAILED && 188 if (bubble_type_ == BUBBLE_TYPE_DETAILED &&
189 init_params->max_height < kDetailedBubbleMaxHeight) { 189 init_params->max_height < kDetailedBubbleMaxHeight) {
190 init_params->max_height = kDetailedBubbleMaxHeight; 190 init_params->max_height = kDetailedBubbleMaxHeight;
191 } else if (bubble_type_ == BUBBLE_TYPE_NOTIFICATION) { 191 } else if (bubble_type_ == BUBBLE_TYPE_NOTIFICATION) {
192 init_params->close_on_deactivate = false; 192 init_params->close_on_deactivate = false;
193 } 193 }
194 bubble_view_ = TrayBubbleView::Create( 194 // The TrayBubbleView will use |anchor| and |tray_| to determine the parent
195 tray_->GetBubbleWindowContainer(), anchor, tray_, init_params); 195 // container for the bubble.
196 bubble_view_ = TrayBubbleView::Create(anchor, tray_, init_params);
196 bubble_view_->set_adjust_if_offscreen(false); 197 bubble_view_->set_adjust_if_offscreen(false);
197 CreateItemViews(login_status); 198 CreateItemViews(login_status);
198 199
199 if (bubble_view_->CanActivate()) { 200 if (bubble_view_->CanActivate()) {
200 bubble_view_->NotifyAccessibilityEvent( 201 bubble_view_->NotifyAccessibilityEvent(
201 ui::AX_EVENT_ALERT, true); 202 ui::AX_EVENT_ALERT, true);
202 } 203 }
203 } 204 }
204 205
205 void SystemTrayBubble::FocusDefaultIfNeeded() { 206 void SystemTrayBubble::FocusDefaultIfNeeded() {
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 // 2 items, which are the bottom header row and the one just above it. 317 // 2 items, which are the bottom header row and the one just above it.
317 bubble_view_->AddChildView(new TrayPopupItemContainer( 318 bubble_view_->AddChildView(new TrayPopupItemContainer(
318 item_views[i], is_default_bubble, 319 item_views[i], is_default_bubble,
319 is_default_bubble && (i < item_views.size() - 2))); 320 is_default_bubble && (i < item_views.size() - 2)));
320 } 321 }
321 if (focus_view) 322 if (focus_view)
322 focus_view->RequestFocus(); 323 focus_view->RequestFocus();
323 } 324 }
324 325
325 } // namespace ash 326 } // namespace ash
OLDNEW
« no previous file with comments | « ash/system/tray/system_tray.cc ('k') | ash/system/tray/tray_background_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698