| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "chrome/browser/ui/toolbar/media_router_action_controller.h" | 5 #include "chrome/browser/ui/toolbar/media_router_action_controller.h" |
| 6 | 6 |
| 7 #include "chrome/browser/media/router/media_router_factory.h" | 7 #include "chrome/browser/media/router/media_router_factory.h" |
| 8 #include "chrome/browser/ui/browser.h" | 8 #include "chrome/browser/ui/browser.h" |
| 9 #include "chrome/browser/ui/toolbar/component_toolbar_actions_factory.h" | 9 #include "chrome/browser/ui/toolbar/component_toolbar_actions_factory.h" |
| 10 #include "chrome/browser/ui/toolbar/toolbar_actions_model.h" | 10 #include "chrome/browser/ui/toolbar/toolbar_actions_model.h" |
| 11 #include "chrome/common/pref_names.h" | 11 #include "chrome/common/pref_names.h" |
| 12 | 12 |
| 13 MediaRouterActionController::MediaRouterActionController(Profile* profile) | 13 MediaRouterActionController::MediaRouterActionController(Profile* profile) |
| 14 : MediaRouterActionController( | 14 : MediaRouterActionController( |
| 15 profile, | 15 profile, |
| 16 media_router::MediaRouterFactory::GetApiForBrowserContext(profile), | 16 media_router::MediaRouterFactory::GetApiForBrowserContext(profile), |
| 17 ToolbarActionsModel::Get(profile), | 17 ToolbarActionsModel::Get(profile), |
| 18 ToolbarActionsModel::Get(profile)->component_migration_helper()) { | 18 ToolbarActionsModel::Get(profile)->GetComponentMigrationHelper()) { |
| 19 DCHECK(component_action_delegate_); | 19 DCHECK(component_action_delegate_); |
| 20 DCHECK(component_migration_helper_); | 20 DCHECK(component_migration_helper_); |
| 21 } | 21 } |
| 22 | 22 |
| 23 MediaRouterActionController::~MediaRouterActionController() { | 23 MediaRouterActionController::~MediaRouterActionController() { |
| 24 DCHECK_EQ(dialog_count_, 0u); | 24 DCHECK_EQ(dialog_count_, 0u); |
| 25 } | 25 } |
| 26 | 26 |
| 27 void MediaRouterActionController::OnIssue(const media_router::Issue& issue) { | 27 void MediaRouterActionController::OnIssue(const media_router::Issue& issue) { |
| 28 has_issue_ = true; | 28 has_issue_ = true; |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 component_action_delegate_->RemoveComponentAction( | 90 component_action_delegate_->RemoveComponentAction( |
| 91 ComponentToolbarActionsFactory::kMediaRouterActionId); | 91 ComponentToolbarActionsFactory::kMediaRouterActionId); |
| 92 } | 92 } |
| 93 } | 93 } |
| 94 | 94 |
| 95 bool MediaRouterActionController::ShouldEnableAction() const { | 95 bool MediaRouterActionController::ShouldEnableAction() const { |
| 96 return has_local_display_route_ || has_issue_ || dialog_count_ || | 96 return has_local_display_route_ || has_issue_ || dialog_count_ || |
| 97 component_migration_helper_->GetComponentActionPref( | 97 component_migration_helper_->GetComponentActionPref( |
| 98 ComponentToolbarActionsFactory::kMediaRouterActionId); | 98 ComponentToolbarActionsFactory::kMediaRouterActionId); |
| 99 } | 99 } |
| OLD | NEW |