Chromium Code Reviews| Index: chrome/browser/ui/toolbar/media_router_action_controller.cc |
| diff --git a/chrome/browser/ui/toolbar/media_router_action_controller.cc b/chrome/browser/ui/toolbar/media_router_action_controller.cc |
| index feaca76ae1ce1f77153f754afa67e993c18cd72e..bf243390afe57c42ff870fe48963cd2d7dac25bc 100644 |
| --- a/chrome/browser/ui/toolbar/media_router_action_controller.cc |
| +++ b/chrome/browser/ui/toolbar/media_router_action_controller.cc |
| @@ -14,10 +14,8 @@ MediaRouterActionController::MediaRouterActionController(Profile* profile) |
| : MediaRouterActionController( |
| profile, |
| media_router::MediaRouterFactory::GetApiForBrowserContext(profile), |
| - ToolbarActionsModel::Get(profile), |
| - ToolbarActionsModel::Get(profile)->component_migration_helper()) { |
| + ToolbarActionsModel::Get(profile)) { |
| DCHECK(component_action_delegate_); |
| - DCHECK(component_migration_helper_); |
| } |
| MediaRouterActionController::~MediaRouterActionController() { |
| @@ -35,6 +33,19 @@ bool MediaRouterActionController::IsActionShownByPolicy(Profile* profile) { |
| return show; |
| } |
| +// static |
| +bool MediaRouterActionController::GetAlwaysShowActionPref(Profile* profile) { |
| + CHECK(profile); |
| + return profile->GetPrefs()->GetBoolean(prefs::kShowCastIconInToolbar); |
| +} |
| + |
| +// static |
| +void MediaRouterActionController::SetAlwaysShowActionPref(Profile* profile, |
| + bool always_show) { |
| + CHECK(profile); |
| + profile->GetPrefs()->SetBoolean(prefs::kShowCastIconInToolbar, always_show); |
| +} |
| + |
| void MediaRouterActionController::OnIssue(const media_router::Issue& issue) { |
| has_issue_ = true; |
| MaybeAddOrRemoveAction(); |
| @@ -72,21 +83,18 @@ void MediaRouterActionController::OnDialogHidden() { |
| MediaRouterActionController::MediaRouterActionController( |
| Profile* profile, |
| media_router::MediaRouter* router, |
| - extensions::ComponentMigrationHelper::ComponentActionDelegate* |
| - component_action_delegate, |
| - extensions::ComponentMigrationHelper* component_migration_helper) |
| + ComponentActionDelegate* component_action_delegate) |
| : media_router::IssuesObserver(router), |
| media_router::MediaRoutesObserver(router), |
| profile_(profile), |
| component_action_delegate_(component_action_delegate), |
| - component_migration_helper_(component_migration_helper), |
| shown_by_policy_( |
| MediaRouterActionController::IsActionShownByPolicy(profile)) { |
| CHECK(profile_); |
| media_router::IssuesObserver::Init(); |
| pref_change_registrar_.Init(profile->GetPrefs()); |
| pref_change_registrar_.Add( |
| - prefs::kToolbarMigratedComponentActionStatus, |
| + prefs::kShowCastIconInToolbar, |
| base::Bind(&MediaRouterActionController::MaybeAddOrRemoveAction, |
| base::Unretained(this))); |
| } |
| @@ -108,6 +116,5 @@ void MediaRouterActionController::MaybeAddOrRemoveAction() { |
| bool MediaRouterActionController::ShouldEnableAction() const { |
| return shown_by_policy_ || has_local_display_route_ || has_issue_ || |
| dialog_count_ || |
| - component_migration_helper_->GetComponentActionPref( |
| - ComponentToolbarActionsFactory::kMediaRouterActionId); |
| + MediaRouterActionController::GetAlwaysShowActionPref(profile_); |
|
Devlin
2017/02/08 15:20:01
nit: no need to prefix this, just GetAlwaysShowAct
takumif
2017/02/08 17:38:15
Done.
|
| } |