| OLD | NEW |
| 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 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 max_height = shelf()->GetIdealBounds().y(); | 259 max_height = shelf()->GetIdealBounds().y(); |
| 260 } else { | 260 } else { |
| 261 // Assume the status area and bubble bottoms are aligned when vertical. | 261 // Assume the status area and bubble bottoms are aligned when vertical. |
| 262 gfx::Rect bounds_in_root = | 262 gfx::Rect bounds_in_root = |
| 263 status_area_window_->GetRootWindow()->ConvertRectFromScreen( | 263 status_area_window_->GetRootWindow()->ConvertRectFromScreen( |
| 264 status_area_window_->GetBoundsInScreen()); | 264 status_area_window_->GetBoundsInScreen()); |
| 265 max_height = bounds_in_root.bottom(); | 265 max_height = bounds_in_root.bottom(); |
| 266 } | 266 } |
| 267 message_center_bubble->SetMaxHeight( | 267 message_center_bubble->SetMaxHeight( |
| 268 std::max(0, max_height - GetTrayConstant(TRAY_SPACING))); | 268 std::max(0, max_height - GetTrayConstant(TRAY_SPACING))); |
| 269 LOG(ERROR) << "WEBNOTIFICATION" << show_settings; |
| 269 if (show_settings) | 270 if (show_settings) |
| 270 message_center_bubble->SetSettingsVisible(); | 271 message_center_bubble->SetSettingsVisible(); |
| 271 message_center_bubble_.reset( | 272 message_center_bubble_.reset( |
| 272 new WebNotificationBubbleWrapper(this, message_center_bubble)); | 273 new WebNotificationBubbleWrapper(this, message_center_bubble)); |
| 273 | 274 |
| 274 system_tray_->SetHideNotifications(true); | 275 system_tray_->SetHideNotifications(true); |
| 275 shelf()->UpdateAutoHideState(); | 276 shelf()->UpdateAutoHideState(); |
| 276 button_->SetBubbleVisible(true); | 277 button_->SetBubbleVisible(true); |
| 277 SetDrawBackgroundAsActive(true); | 278 SetDrawBackgroundAsActive(true); |
| 278 return true; | 279 return true; |
| 279 } | 280 } |
| 280 | 281 |
| 281 bool WebNotificationTray::ShowMessageCenter() { | 282 bool WebNotificationTray::ShowMessageCenter() { |
| 283 LOG(ERROR) << "HMMM"; |
| 282 return ShowMessageCenterInternal(false /* show_settings */); | 284 return ShowMessageCenterInternal(false /* show_settings */); |
| 283 } | 285 } |
| 284 | 286 |
| 285 void WebNotificationTray::HideMessageCenter() { | 287 void WebNotificationTray::HideMessageCenter() { |
| 286 if (!message_center_bubble()) | 288 if (!message_center_bubble()) |
| 287 return; | 289 return; |
| 288 SetDrawBackgroundAsActive(false); | 290 SetDrawBackgroundAsActive(false); |
| 289 message_center_bubble_.reset(); | 291 message_center_bubble_.reset(); |
| 290 should_block_shelf_auto_hide_ = false; | 292 should_block_shelf_auto_hide_ = false; |
| 291 show_message_center_on_unlock_ = false; | 293 show_message_center_on_unlock_ = false; |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 414 ->GetRootWindowController() | 416 ->GetRootWindowController() |
| 415 ->ConfigureWidgetInitParamsForContainer( | 417 ->ConfigureWidgetInitParamsForContainer( |
| 416 bubble_widget, kShellWindowId_SettingBubbleContainer, params); | 418 bubble_widget, kShellWindowId_SettingBubbleContainer, params); |
| 417 } | 419 } |
| 418 | 420 |
| 419 void WebNotificationTray::HideBubble(const views::TrayBubbleView* bubble_view) { | 421 void WebNotificationTray::HideBubble(const views::TrayBubbleView* bubble_view) { |
| 420 HideBubbleWithView(bubble_view); | 422 HideBubbleWithView(bubble_view); |
| 421 } | 423 } |
| 422 | 424 |
| 423 bool WebNotificationTray::ShowNotifierSettings() { | 425 bool WebNotificationTray::ShowNotifierSettings() { |
| 426 LOG(ERROR) << "TRAY" << message_center_bubble(); |
| 424 if (message_center_bubble()) { | 427 if (message_center_bubble()) { |
| 425 static_cast<message_center::MessageCenterBubble*>( | 428 static_cast<message_center::MessageCenterBubble*>( |
| 426 message_center_bubble()->bubble()) | 429 message_center_bubble()->bubble()) |
| 427 ->SetSettingsVisible(); | 430 ->SetSettingsVisible(); |
| 428 return true; | 431 return true; |
| 429 } | 432 } |
| 430 return ShowMessageCenterInternal(true /* show_settings */); | 433 return ShowMessageCenterInternal(true /* show_settings */); |
| 431 } | 434 } |
| 432 | 435 |
| 433 bool WebNotificationTray::IsContextMenuEnabled() const { | 436 bool WebNotificationTray::IsContextMenuEnabled() const { |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 529 | 532 |
| 530 message_center::MessageCenterBubble* | 533 message_center::MessageCenterBubble* |
| 531 WebNotificationTray::GetMessageCenterBubbleForTest() { | 534 WebNotificationTray::GetMessageCenterBubbleForTest() { |
| 532 if (!message_center_bubble()) | 535 if (!message_center_bubble()) |
| 533 return NULL; | 536 return NULL; |
| 534 return static_cast<message_center::MessageCenterBubble*>( | 537 return static_cast<message_center::MessageCenterBubble*>( |
| 535 message_center_bubble()->bubble()); | 538 message_center_bubble()->bubble()); |
| 536 } | 539 } |
| 537 | 540 |
| 538 } // namespace ash | 541 } // namespace ash |
| OLD | NEW |