1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18
   19
   20
   21
   22
   23
   24
   25
   26
   27
   28
   29
   30
   31
   32
   33
   34
   35
   36
   37
   38
   39
   40
   41
   42
   43
   44
   45
   46
   47
   48
   49
   50
   51
   52
   53
   54

ash / webui / help_app_ui / help_app_manager.h [blame]

// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef ASH_WEBUI_HELP_APP_UI_HELP_APP_MANAGER_H_
#define ASH_WEBUI_HELP_APP_UI_HELP_APP_MANAGER_H_

#include "components/keyed_service/core/keyed_service.h"

#include <memory>

namespace ash {

namespace local_search_service {
class LocalSearchServiceProxy;
}

namespace help_app {

class SearchHandler;
class SearchTagRegistry;

// Manager for the Chrome OS help app. This class is implemented as a
// KeyedService, so one instance of the class is intended to be active for the
// lifetime of a logged-in user, even if the help app is not opened.
//
// Main responsibilities:
//
// (1) Support search queries for help content. HelpAppManager is
//     responsible for updating the kHelpAppLauncher index of the
//     LocalSearchService with search tags corresponding to the top help
//     articles.
class HelpAppManager : public KeyedService {
 public:
  HelpAppManager(local_search_service::LocalSearchServiceProxy*
                     local_search_service_proxy);
  HelpAppManager(const HelpAppManager& other) = delete;
  HelpAppManager& operator=(const HelpAppManager& other) = delete;
  ~HelpAppManager() override;

  SearchHandler* search_handler() { return search_handler_.get(); }

 private:
  // KeyedService:
  void Shutdown() override;

  std::unique_ptr<SearchTagRegistry> search_tag_registry_;
  std::unique_ptr<SearchHandler> search_handler_;
};

}  // namespace help_app
}  // namespace ash

#endif  // ASH_WEBUI_HELP_APP_UI_HELP_APP_MANAGER_H_