blob: e46c4cd2aacb42adda794c983572461affdf679c [file] [log] [blame]
xiaolingbao4366f65e2014-12-02 02:25:211// Copyright (c) 2014 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
5#ifndef CHROME_BROWSER_RECOVERY_RECOVERY_INSTALL_GLOBAL_ERROR_H_
6#define CHROME_BROWSER_RECOVERY_RECOVERY_INSTALL_GLOBAL_ERROR_H_
7
xiaolingbaoc2a67e962015-02-10 01:53:218#include <vector>
9
avib896c712015-12-26 02:10:4310#include "base/macros.h"
xiaolingbao4366f65e2014-12-02 02:25:2111#include "chrome/browser/ui/global_error/global_error.h"
12#include "components/keyed_service/core/keyed_service.h"
brettwb1fc1b82016-02-02 00:19:0813#include "components/prefs/pref_change_registrar.h"
xiaolingbao4366f65e2014-12-02 02:25:2114
15class Profile;
16
17// Shows elevation needed for recovery component install on the wrench menu
18// using a bubble view and a menu item.
19class RecoveryInstallGlobalError : public GlobalErrorWithStandardBubble,
20 public KeyedService {
21 public:
22 explicit RecoveryInstallGlobalError(Profile* profile);
dcheng3538e8b2015-01-09 02:56:1723 ~RecoveryInstallGlobalError() override;
xiaolingbao4366f65e2014-12-02 02:25:2124
25 private:
26 // KeyedService:
dcheng3538e8b2015-01-09 02:56:1727 void Shutdown() override;
xiaolingbao4366f65e2014-12-02 02:25:2128
29 // GlobalErrorWithStandardBubble:
dcheng3538e8b2015-01-09 02:56:1730 Severity GetSeverity() override;
31 bool HasMenuItem() override;
32 int MenuItemCommandID() override;
Jan Wilken Dörriedec99122021-03-11 18:02:3033 std::u16string MenuItemLabel() override;
Allen Bauerb25251f12020-04-09 17:01:4434 ui::ImageModel MenuItemIcon() override;
dcheng3538e8b2015-01-09 02:56:1735 void ExecuteMenuItem(Browser* browser) override;
36 bool HasBubbleView() override;
37 bool HasShownBubbleView() override;
38 void ShowBubbleView(Browser* browser) override;
xiaolingbaoc2a67e962015-02-10 01:53:2139 bool ShouldCloseOnDeactivate() const override;
Jan Wilken Dörriedec99122021-03-11 18:02:3040 std::u16string GetBubbleViewTitle() override;
41 std::vector<std::u16string> GetBubbleViewMessages() override;
42 std::u16string GetBubbleViewAcceptButtonLabel() override;
xiaolingbaoc2a67e962015-02-10 01:53:2143 bool ShouldShowCloseButton() const override;
dcheng3538e8b2015-01-09 02:56:1744 bool ShouldAddElevationIconToAcceptButton() override;
Jan Wilken Dörriedec99122021-03-11 18:02:3045 std::u16string GetBubbleViewCancelButtonLabel() override;
dcheng3538e8b2015-01-09 02:56:1746 void OnBubbleViewDidClose(Browser* browser) override;
47 void BubbleViewAcceptButtonPressed(Browser* browser) override;
48 void BubbleViewCancelButtonPressed(Browser* browser) override;
xiaolingbao4366f65e2014-12-02 02:25:2149
50 bool HasElevationNotification() const;
51 void OnElevationRequirementChanged();
52
53 bool elevation_needed_;
54
55 // The Profile this service belongs to.
56 Profile* profile_;
57
58 // Monitors registry change for recovery component install.
59 PrefChangeRegistrar pref_registrar_;
60