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

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

Issue 10909220: Removes caching of whether the launcher should be visible from (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: auto-hide Created 8 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « ash/system/status_area_widget.cc ('k') | ash/system/tray/system_tray_bubble.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 (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.h" 5 #include "ash/system/tray/system_tray.h"
6 6
7 #include "ash/shell.h" 7 #include "ash/shell.h"
8 #include "ash/shell/panel_window.h" 8 #include "ash/shell/panel_window.h"
9 #include "ash/shell_window_ids.h" 9 #include "ash/shell_window_ids.h"
10 #include "ash/system/audio/tray_volume.h" 10 #include "ash/system/audio/tray_volume.h"
(...skipping 13 matching lines...) Expand all
24 #include "ash/system/tray/system_tray_bubble.h" 24 #include "ash/system/tray/system_tray_bubble.h"
25 #include "ash/system/tray/system_tray_delegate.h" 25 #include "ash/system/tray/system_tray_delegate.h"
26 #include "ash/system/tray/system_tray_item.h" 26 #include "ash/system/tray/system_tray_item.h"
27 #include "ash/system/tray/tray_constants.h" 27 #include "ash/system/tray/tray_constants.h"
28 #include "ash/system/tray_accessibility.h" 28 #include "ash/system/tray_accessibility.h"
29 #include "ash/system/tray_caps_lock.h" 29 #include "ash/system/tray_caps_lock.h"
30 #include "ash/system/tray_display.h" 30 #include "ash/system/tray_display.h"
31 #include "ash/system/tray_update.h" 31 #include "ash/system/tray_update.h"
32 #include "ash/system/user/login_status.h" 32 #include "ash/system/user/login_status.h"
33 #include "ash/system/user/tray_user.h" 33 #include "ash/system/user/tray_user.h"
34 #include "ash/wm/shelf_layout_manager.h"
34 #include "base/logging.h" 35 #include "base/logging.h"
35 #include "base/timer.h" 36 #include "base/timer.h"
36 #include "base/utf_string_conversions.h" 37 #include "base/utf_string_conversions.h"
37 #include "grit/ash_strings.h" 38 #include "grit/ash_strings.h"
38 #include "ui/aura/root_window.h" 39 #include "ui/aura/root_window.h"
39 #include "ui/base/events/event_constants.h" 40 #include "ui/base/events/event_constants.h"
40 #include "ui/base/l10n/l10n_util.h" 41 #include "ui/base/l10n/l10n_util.h"
41 #include "ui/compositor/layer.h" 42 #include "ui/compositor/layer.h"
42 #include "ui/gfx/canvas.h" 43 #include "ui/gfx/canvas.h"
43 #include "ui/gfx/screen.h" 44 #include "ui/gfx/screen.h"
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 262
262 void SystemTray::DestroyBubble() { 263 void SystemTray::DestroyBubble() {
263 bubble_.reset(); 264 bubble_.reset();
264 detailed_item_ = NULL; 265 detailed_item_ = NULL;
265 } 266 }
266 267
267 void SystemTray::RemoveBubble(SystemTrayBubble* bubble) { 268 void SystemTray::RemoveBubble(SystemTrayBubble* bubble) {
268 if (bubble == bubble_.get()) { 269 if (bubble == bubble_.get()) {
269 DestroyBubble(); 270 DestroyBubble();
270 UpdateNotificationBubble(); // State changed, re-create notifications. 271 UpdateNotificationBubble(); // State changed, re-create notifications.
271 UpdateShouldShowLauncher(); 272 Shell::GetInstance()->shelf()->UpdateAutoHideState();
272 } else if (bubble == notification_bubble_) { 273 } else if (bubble == notification_bubble_) {
273 notification_bubble_.reset(); 274 notification_bubble_.reset();
274 status_area_widget()->SetHideWebNotifications(false); 275 status_area_widget()->SetHideWebNotifications(false);
275 } else { 276 } else {
276 NOTREACHED(); 277 NOTREACHED();
277 } 278 }
278 } 279 }
279 280
280 int SystemTray::GetTrayXOffset(SystemTrayItem* item) const { 281 int SystemTray::GetTrayXOffset(SystemTrayItem* item) const {
281 // Don't attempt to align the arrow if the shelf is on the left or right. 282 // Don't attempt to align the arrow if the shelf is on the left or right.
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 TrayBubbleView::InitParams init_params(TrayBubbleView::ANCHOR_TYPE_TRAY, 329 TrayBubbleView::InitParams init_params(TrayBubbleView::ANCHOR_TYPE_TRAY,
329 shelf_alignment()); 330 shelf_alignment());
330 init_params.can_activate = can_activate; 331 init_params.can_activate = can_activate;
331 if (detailed) { 332 if (detailed) {
332 // This is the case where a volume control or brightness control bubble 333 // This is the case where a volume control or brightness control bubble
333 // is created. 334 // is created.
334 init_params.max_height = default_bubble_height_; 335 init_params.max_height = default_bubble_height_;
335 init_params.arrow_color = kBackgroundColor; 336 init_params.arrow_color = kBackgroundColor;
336 } 337 }
337 init_params.arrow_offset = arrow_offset; 338 init_params.arrow_offset = arrow_offset;
338 // |bubble_->InitView()| shows and activates the status tray popup, which
339 // can trigger the shelf to hide (if auto-hide is turned on). So it is
340 // necessary to update the desired launcher visibility before showing the
341 // status bubble.
342 UpdateShouldShowLauncher();
343 bubble_->InitView(anchor, init_params, delegate->GetUserLoginStatus()); 339 bubble_->InitView(anchor, init_params, delegate->GetUserLoginStatus());
344 } 340 }
345 // Save height of default view for creating detailed views directly. 341 // Save height of default view for creating detailed views directly.
346 if (!detailed) 342 if (!detailed)
347 default_bubble_height_ = bubble_->bubble_view()->height(); 343 default_bubble_height_ = bubble_->bubble_view()->height();
348 344
349 if (detailed && items.size() > 0) 345 if (detailed && items.size() > 0)
350 detailed_item_ = items[0]; 346 detailed_item_ = items[0];
351 else 347 else
352 detailed_item_ = NULL; 348 detailed_item_ = NULL;
353 349
354 UpdateNotificationBubble(); // State changed, re-create notifications. 350 UpdateNotificationBubble(); // State changed, re-create notifications.
355 status_area_widget()->SetHideWebNotifications(true); 351 status_area_widget()->SetHideWebNotifications(true);
356 UpdateShouldShowLauncher(); 352 Shell::GetInstance()->shelf()->UpdateAutoHideState();
357 } 353 }
358 354
359 void SystemTray::UpdateNotificationBubble() { 355 void SystemTray::UpdateNotificationBubble() {
360 // Only show the notification buble if we have notifications and we are not 356 // Only show the notification buble if we have notifications and we are not
361 // showing the default bubble. 357 // showing the default bubble.
362 if (notification_items_.empty() || 358 if (notification_items_.empty() ||
363 (bubble_.get() && 359 (bubble_.get() &&
364 bubble_->bubble_type() == SystemTrayBubble::BUBBLE_TYPE_DEFAULT)) { 360 bubble_->bubble_type() == SystemTrayBubble::BUBBLE_TYPE_DEFAULT)) {
365 notification_bubble_.reset(); 361 notification_bubble_.reset();
366 status_area_widget()->SetHideWebNotifications(false); 362 status_area_widget()->SetHideWebNotifications(false);
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
453 ConvertPointToWidget(this, &point); 449 ConvertPointToWidget(this, &point);
454 arrow_offset = point.x(); 450 arrow_offset = point.x();
455 } 451 }
456 } 452 }
457 ShowDefaultViewWithOffset(BUBBLE_CREATE_NEW, arrow_offset); 453 ShowDefaultViewWithOffset(BUBBLE_CREATE_NEW, arrow_offset);
458 } 454 }
459 return true; 455 return true;
460 } 456 }
461 457
462 } // namespace ash 458 } // namespace ash
OLDNEW
« no previous file with comments | « ash/system/status_area_widget.cc ('k') | ash/system/tray/system_tray_bubble.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698