| 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/tray/system_tray_bubble.h" | 5 #include "ash/common/system/tray/system_tray_bubble.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "ash/common/material_design/material_design_controller.h" | 10 #include "ash/common/material_design/material_design_controller.h" |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 } | 206 } |
| 207 } | 207 } |
| 208 | 208 |
| 209 void SystemTrayBubble::FocusDefaultIfNeeded() { | 209 void SystemTrayBubble::FocusDefaultIfNeeded() { |
| 210 views::FocusManager* manager = bubble_view_->GetFocusManager(); | 210 views::FocusManager* manager = bubble_view_->GetFocusManager(); |
| 211 if (!manager || manager->GetFocusedView()) | 211 if (!manager || manager->GetFocusedView()) |
| 212 return; | 212 return; |
| 213 | 213 |
| 214 views::View* view = | 214 views::View* view = |
| 215 manager->GetNextFocusableView(nullptr, nullptr, false, false); | 215 manager->GetNextFocusableView(nullptr, nullptr, false, false); |
| 216 if (view) | 216 // TODO(oshima): RequestFocus calls View::OnFocus even if the widget |
| 217 // is not active (crbug.com/621791). Remove this check once the bug |
| 218 // is fixed. |
| 219 if (bubble_view_->GetWidget()->IsActive()) { |
| 217 view->RequestFocus(); | 220 view->RequestFocus(); |
| 221 } else { |
| 222 manager->SetStoredFocusView(view); |
| 223 } |
| 218 } | 224 } |
| 219 | 225 |
| 220 void SystemTrayBubble::DestroyItemViews() { | 226 void SystemTrayBubble::DestroyItemViews() { |
| 221 for (std::vector<ash::SystemTrayItem*>::iterator it = items_.begin(); | 227 for (std::vector<ash::SystemTrayItem*>::iterator it = items_.begin(); |
| 222 it != items_.end(); ++it) { | 228 it != items_.end(); ++it) { |
| 223 switch (bubble_type_) { | 229 switch (bubble_type_) { |
| 224 case BUBBLE_TYPE_DEFAULT: | 230 case BUBBLE_TYPE_DEFAULT: |
| 225 (*it)->DestroyDefaultView(); | 231 (*it)->DestroyDefaultView(); |
| 226 break; | 232 break; |
| 227 case BUBBLE_TYPE_DETAILED: | 233 case BUBBLE_TYPE_DETAILED: |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 340 if (is_default_bubble) { | 346 if (is_default_bubble) { |
| 341 const int last_item_with_border = | 347 const int last_item_with_border = |
| 342 static_cast<int>(item_containers.size()) - 2; | 348 static_cast<int>(item_containers.size()) - 2; |
| 343 for (int i = 0; i < last_item_with_border; ++i) { | 349 for (int i = 0; i < last_item_with_border; ++i) { |
| 344 item_containers.at(i)->SetBorder(views::Border::CreateSolidSidedBorder( | 350 item_containers.at(i)->SetBorder(views::Border::CreateSolidSidedBorder( |
| 345 0, 0, 1, 0, kBorderLightColor)); | 351 0, 0, 1, 0, kBorderLightColor)); |
| 346 } | 352 } |
| 347 } | 353 } |
| 348 } | 354 } |
| 349 | 355 |
| 350 if (focus_view) | 356 if (focus_view) { |
| 357 tray_->ActivateBubble(); |
| 351 focus_view->RequestFocus(); | 358 focus_view->RequestFocus(); |
| 359 } |
| 352 } | 360 } |
| 353 | 361 |
| 354 } // namespace ash | 362 } // namespace ash |
| OLD | NEW |