| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "athena/home/public/home_card.h" | 5 #include "athena/home/public/home_card.h" |
| 6 | 6 |
| 7 #include <cmath> | 7 #include <cmath> |
| 8 #include <limits> | 8 #include <limits> |
| 9 | 9 |
| 10 #include "athena/common/container_priorities.h" | 10 #include "athena/common/container_priorities.h" |
| (...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 479 instance = this; | 479 instance = this; |
| 480 WindowManager::GetInstance()->AddObserver(this); | 480 WindowManager::GetInstance()->AddObserver(this); |
| 481 } | 481 } |
| 482 | 482 |
| 483 HomeCardImpl::~HomeCardImpl() { | 483 HomeCardImpl::~HomeCardImpl() { |
| 484 DCHECK(instance); | 484 DCHECK(instance); |
| 485 WindowManager::GetInstance()->RemoveObserver(this); | 485 WindowManager::GetInstance()->RemoveObserver(this); |
| 486 if (activation_client_) | 486 if (activation_client_) |
| 487 activation_client_->RemoveObserver(this); | 487 activation_client_->RemoveObserver(this); |
| 488 home_card_widget_->CloseNow(); | 488 home_card_widget_->CloseNow(); |
| 489 |
| 490 // Reset the view delegate first as it access search provider during |
| 491 // shutdown. |
| 492 view_delegate_.reset(); |
| 493 search_provider_.reset(); |
| 489 instance = NULL; | 494 instance = NULL; |
| 490 } | 495 } |
| 491 | 496 |
| 492 void HomeCardImpl::Init() { | 497 void HomeCardImpl::Init() { |
| 493 InstallAccelerators(); | 498 InstallAccelerators(); |
| 494 ScreenManager::ContainerParams params("HomeCardContainer", CP_HOME_CARD); | 499 ScreenManager::ContainerParams params("HomeCardContainer", CP_HOME_CARD); |
| 495 params.can_activate_children = true; | 500 params.can_activate_children = true; |
| 496 aura::Window* container = ScreenManager::Get()->CreateContainer(params); | 501 aura::Window* container = ScreenManager::Get()->CreateContainer(params); |
| 497 layout_manager_ = new HomeCardLayoutManager(this); | 502 layout_manager_ = new HomeCardLayoutManager(this); |
| 498 | 503 |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 653 instance = NULL; | 658 instance = NULL; |
| 654 } | 659 } |
| 655 | 660 |
| 656 // static | 661 // static |
| 657 HomeCard* HomeCard::Get() { | 662 HomeCard* HomeCard::Get() { |
| 658 DCHECK(instance); | 663 DCHECK(instance); |
| 659 return instance; | 664 return instance; |
| 660 } | 665 } |
| 661 | 666 |
| 662 } // namespace athena | 667 } // namespace athena |
| OLD | NEW |