feature_pod_controller_base.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. // Copyright 2018 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef ASH_SYSTEM_UNIFIED_FEATURE_POD_CONTROLLER_BASE_H_
  5. #define ASH_SYSTEM_UNIFIED_FEATURE_POD_CONTROLLER_BASE_H_
  6. #include "ash/ash_export.h"
  7. #include "ash/system/tray/system_tray_item_uma_type.h"
  8. namespace ash {
  9. class FeaturePodButton;
  10. // Base class for controllers of feature pod buttons.
  11. // To add a new feature pod button, implement this class, and add to the list in
  12. // UnifiedSystemTrayController::InitFeaturePods().
  13. class ASH_EXPORT FeaturePodControllerBase {
  14. public:
  15. virtual ~FeaturePodControllerBase() {}
  16. // Create the view. Subclasses instantiate FeaturePodButton.
  17. // The view will be owned by views hierarchy. The view will be always deleted
  18. // after the controller is destructed (UnifiedSystemTrayBubble guarantees
  19. // this).
  20. virtual FeaturePodButton* CreateButton() = 0;
  21. // Called when the icon of the feature pod button is clicked.
  22. // If the feature pod is togglable, it is expected to toggle the feature.
  23. virtual void OnIconPressed() = 0;
  24. // Called when the label hover area of the feature pod button is clicked.
  25. // If the feature pod has a detailed view, it is expected to show the detailed
  26. // view. Defaults to OnIconPressed().
  27. virtual void OnLabelPressed();
  28. // Return histogram value for Ash.SystemMenu.DefaultView.VisibleRows. If the
  29. // button is not recorded, UMA_NOT_RECORDED will be used.
  30. virtual SystemTrayItemUmaType GetUmaType() const = 0;
  31. };
  32. } // namespace ash
  33. #endif // ASH_SYSTEM_UNIFIED_FEATURE_POD_CONTROLLER_BASE_H_