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

Side by Side Diff: ash/common/system/web_notification/web_notification_tray.cc

Issue 2147143002: [Chrome OS MD] Draw a 1px separator between 2 tray items (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address comments Created 4 years, 4 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 (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/common/system/web_notification/web_notification_tray.h" 5 #include "ash/common/system/web_notification/web_notification_tray.h"
6 6
7 #include "ash/common/ash_switches.h" 7 #include "ash/common/ash_switches.h"
8 #include "ash/common/material_design/material_design_controller.h" 8 #include "ash/common/material_design/material_design_controller.h"
9 #include "ash/common/session/session_state_delegate.h" 9 #include "ash/common/session/session_state_delegate.h"
10 #include "ash/common/shelf/shelf_constants.h" 10 #include "ash/common/shelf/shelf_constants.h"
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 icon_(new WebNotificationIcon), 208 icon_(new WebNotificationIcon),
209 show_message_center_on_unlock_(false), 209 show_message_center_on_unlock_(false),
210 should_update_tray_content_(false), 210 should_update_tray_content_(false),
211 should_block_shelf_auto_hide_(false) { 211 should_block_shelf_auto_hide_(false) {
212 DCHECK(shelf); 212 DCHECK(shelf);
213 DCHECK(status_area_window_); 213 DCHECK(status_area_window_);
214 DCHECK(system_tray_); 214 DCHECK(system_tray_);
215 215
216 tray_container()->AddChildView(icon_); 216 tray_container()->AddChildView(icon_);
217 SetContentsBackground(); 217 SetContentsBackground();
218 tray_container()->SetBorder(views::Border::NullBorder());
219 message_center_tray_.reset(new message_center::MessageCenterTray( 218 message_center_tray_.reset(new message_center::MessageCenterTray(
220 this, message_center::MessageCenter::Get())); 219 this, message_center::MessageCenter::Get()));
221 popup_alignment_delegate_.reset(new AshPopupAlignmentDelegate(shelf)); 220 popup_alignment_delegate_.reset(new AshPopupAlignmentDelegate(shelf));
222 popup_collection_.reset(new message_center::MessagePopupCollection( 221 popup_collection_.reset(new message_center::MessagePopupCollection(
223 message_center(), message_center_tray_.get(), 222 message_center(), message_center_tray_.get(),
224 popup_alignment_delegate_.get())); 223 popup_alignment_delegate_.get()));
225 const display::Display& display = 224 const display::Display& display =
226 status_area_window_->GetDisplayNearestWindow(); 225 status_area_window_->GetDisplayNearestWindow();
227 popup_alignment_delegate_->StartObserving(display::Screen::GetScreen(), 226 popup_alignment_delegate_->StartObserving(display::Screen::GetScreen(),
228 display); 227 display);
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 void WebNotificationTray::UpdateAfterLoginStatusChange( 334 void WebNotificationTray::UpdateAfterLoginStatusChange(
336 LoginStatus login_status) { 335 LoginStatus login_status) {
337 message_center()->SetLockedState(login_status == LoginStatus::LOCKED); 336 message_center()->SetLockedState(login_status == LoginStatus::LOCKED);
338 OnMessageCenterTrayChanged(); 337 OnMessageCenterTrayChanged();
339 } 338 }
340 339
341 void WebNotificationTray::SetShelfAlignment(ShelfAlignment alignment) { 340 void WebNotificationTray::SetShelfAlignment(ShelfAlignment alignment) {
342 if (alignment == shelf_alignment()) 341 if (alignment == shelf_alignment())
343 return; 342 return;
344 TrayBackgroundView::SetShelfAlignment(alignment); 343 TrayBackgroundView::SetShelfAlignment(alignment);
345 // Every time shelf alignment is updated, StatusAreaWidgetDelegate resets the
346 // border to a non-null border. So, we need to remove it.
347 tray_container()->SetBorder(views::Border::NullBorder());
348 // Destroy any existing bubble so that it will be rebuilt correctly. 344 // Destroy any existing bubble so that it will be rebuilt correctly.
349 message_center_tray_->HideMessageCenterBubble(); 345 message_center_tray_->HideMessageCenterBubble();
350 message_center_tray_->HidePopupBubble(); 346 message_center_tray_->HidePopupBubble();
351 } 347 }
352 348
353 void WebNotificationTray::AnchorUpdated() { 349 void WebNotificationTray::AnchorUpdated() {
354 if (message_center_bubble()) { 350 if (message_center_bubble()) {
355 message_center_bubble()->bubble_view()->UpdateBubble(); 351 message_center_bubble()->bubble_view()->UpdateBubble();
356 UpdateBubbleViewArrow(message_center_bubble()->bubble_view()); 352 UpdateBubbleViewArrow(message_center_bubble()->bubble_view());
357 } 353 }
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
508 504
509 message_center::MessageCenterBubble* 505 message_center::MessageCenterBubble*
510 WebNotificationTray::GetMessageCenterBubbleForTest() { 506 WebNotificationTray::GetMessageCenterBubbleForTest() {
511 if (!message_center_bubble()) 507 if (!message_center_bubble())
512 return NULL; 508 return NULL;
513 return static_cast<message_center::MessageCenterBubble*>( 509 return static_cast<message_center::MessageCenterBubble*>(
514 message_center_bubble()->bubble()); 510 message_center_bubble()->bubble());
515 } 511 }
516 512
517 } // namespace ash 513 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698