Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1147)

Unified Diff: chrome/browser/extensions/component_migration_helper.cc

Issue 2294973002: Create MediaRouterActionController and MediaRouterUIService (Closed)
Patch Set: Address Derek and Mark's comments Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/component_migration_helper.cc
diff --git a/chrome/browser/extensions/component_migration_helper.cc b/chrome/browser/extensions/component_migration_helper.cc
index 7de2caa9773e3e49033483107317284b888d23b4..ecfc443f785b8a879ef2add1602485db06b3e1a1 100644
--- a/chrome/browser/extensions/component_migration_helper.cc
+++ b/chrome/browser/extensions/component_migration_helper.cc
@@ -9,6 +9,7 @@
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/extensions/extension_system_impl.h"
#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/ui/toolbar/component_toolbar_actions_factory.h"
#include "chrome/common/pref_names.h"
#include "components/prefs/pref_registry_simple.h"
#include "components/prefs/pref_service.h"
@@ -92,9 +93,14 @@ void ComponentMigrationHelper::OnFeatureEnabled(
component_action_pref = true;
}
- if (component_action_pref &&
- !delegate_->HasComponentAction(component_action_id)) {
- delegate_->AddComponentAction(component_action_id);
+ if (component_action_pref) {
mark a. foltz 2016/09/09 17:48:28 Just so I understand - this code is here to ensure
+ if (component_action_id ==
+ ComponentToolbarActionsFactory::kMediaRouterActionId) {
+ pref_service_->SetBoolean(prefs::kMediaRouterAlwaysShowActionIcon,
mark a. foltz 2016/09/09 17:48:28 Can this only be set if the current value is not a
+ true);
+ }
+ if (!delegate_->HasComponentAction(component_action_id))
+ delegate_->AddComponentAction(component_action_id);
}
}
@@ -107,6 +113,12 @@ void ComponentMigrationHelper::OnFeatureDisabled(
enabled_actions_.erase(component_action_id);
RemoveComponentActionPref(component_action_id);
+ if (component_action_id ==
mark a. foltz 2016/09/09 17:48:28 If the feature is disabled, we should not be creat
+ ComponentToolbarActionsFactory::kMediaRouterActionId) {
+ pref_service_->SetBoolean(prefs::kMediaRouterAlwaysShowActionIcon,
+ false);
+ }
+
if (FeatureSwitch::extension_action_redesign()->IsEnabled() &&
delegate_->HasComponentAction(component_action_id))
delegate_->RemoveComponentAction(component_action_id);
@@ -134,6 +146,14 @@ void ComponentMigrationHelper::OnExtensionReady(
UnloadExtension(extension_id);
SetComponentActionPref(component_action_id, true);
+ // We treat installation of the cast extension as a signal to permanently
+ // show the icon in the toolbar.
+ if (component_action_id ==
mark a. foltz 2016/09/09 17:48:28 Please check-and-set the pref.
+ ComponentToolbarActionsFactory::kMediaRouterActionId) {
+ pref_service_->SetBoolean(prefs::kMediaRouterAlwaysShowActionIcon,
+ true);
+ }
+
if (!delegate_->HasComponentAction(component_action_id))
delegate_->AddComponentAction(component_action_id);
}
« no previous file with comments | « no previous file | chrome/browser/media/router/media_router.h » ('j') | chrome/browser/ui/toolbar/media_router_action_controller.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698