xiaolingbao | 4366f65e | 2014-12-02 02:25:21 | [diff] [blame] | 1 | // 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 | |
xiaolingbao | c2a67e96 | 2015-02-10 01:53:21 | [diff] [blame] | 8 | #include <vector> |
| 9 | |
avi | b896c71 | 2015-12-26 02:10:43 | [diff] [blame] | 10 | #include "base/macros.h" |
xiaolingbao | 4366f65e | 2014-12-02 02:25:21 | [diff] [blame] | 11 | #include "chrome/browser/ui/global_error/global_error.h" |
| 12 | #include "components/keyed_service/core/keyed_service.h" |
brettw | b1fc1b8 | 2016-02-02 00:19:08 | [diff] [blame] | 13 | #include "components/prefs/pref_change_registrar.h" |
xiaolingbao | 4366f65e | 2014-12-02 02:25:21 | [diff] [blame] | 14 | |
| 15 | class Profile; |
| 16 | |
| 17 | // Shows elevation needed for recovery component install on the wrench menu |
| 18 | // using a bubble view and a menu item. |
| 19 | class RecoveryInstallGlobalError : public GlobalErrorWithStandardBubble, |
| 20 | public KeyedService { |
| 21 | public: |
| 22 | explicit RecoveryInstallGlobalError(Profile* profile); |
dcheng | 3538e8b | 2015-01-09 02:56:17 | [diff] [blame] | 23 | ~RecoveryInstallGlobalError() override; |
xiaolingbao | 4366f65e | 2014-12-02 02:25:21 | [diff] [blame] | 24 | |
| 25 | private: |
| 26 | // KeyedService: |
dcheng | 3538e8b | 2015-01-09 02:56:17 | [diff] [blame] | 27 | void Shutdown() override; |
xiaolingbao | 4366f65e | 2014-12-02 02:25:21 | [diff] [blame] | 28 | |
| 29 | // GlobalErrorWithStandardBubble: |
dcheng | 3538e8b | 2015-01-09 02:56:17 | [diff] [blame] | 30 | Severity GetSeverity() override; |
| 31 | bool HasMenuItem() override; |
| 32 | int MenuItemCommandID() override; |
Jan Wilken Dörrie | dec9912 | 2021-03-11 18:02:30 | [diff] [blame^] | 33 | std::u16string MenuItemLabel() override; |
Allen Bauer | b25251f1 | 2020-04-09 17:01:44 | [diff] [blame] | 34 | ui::ImageModel MenuItemIcon() override; |
dcheng | 3538e8b | 2015-01-09 02:56:17 | [diff] [blame] | 35 | void ExecuteMenuItem(Browser* browser) override; |
| 36 | bool HasBubbleView() override; |
| 37 | bool HasShownBubbleView() override; |
| 38 | void ShowBubbleView(Browser* browser) override; |
xiaolingbao | c2a67e96 | 2015-02-10 01:53:21 | [diff] [blame] | 39 | bool ShouldCloseOnDeactivate() const override; |
Jan Wilken Dörrie | dec9912 | 2021-03-11 18:02:30 | [diff] [blame^] | 40 | std::u16string GetBubbleViewTitle() override; |
| 41 | std::vector<std::u16string> GetBubbleViewMessages() override; |
| 42 | std::u16string GetBubbleViewAcceptButtonLabel() override; |
xiaolingbao | c2a67e96 | 2015-02-10 01:53:21 | [diff] [blame] | 43 | bool ShouldShowCloseButton() const override; |
dcheng | 3538e8b | 2015-01-09 02:56:17 | [diff] [blame] | 44 | bool ShouldAddElevationIconToAcceptButton() override; |
Jan Wilken Dörrie | dec9912 | 2021-03-11 18:02:30 | [diff] [blame^] | 45 | std::u16string GetBubbleViewCancelButtonLabel() override; |
dcheng | 3538e8b | 2015-01-09 02:56:17 | [diff] [blame] | 46 | void OnBubbleViewDidClose(Browser* browser) override; |
| 47 | void BubbleViewAcceptButtonPressed(Browser* browser) override; |
| 48 | void BubbleViewCancelButtonPressed(Browser* browser) override; |
xiaolingbao | 4366f65e | 2014-12-02 02:25:21 | [diff] [blame] | 49 | |
| 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 | |
|
|