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 | |
| 8 | #include "base/prefs/pref_change_registrar.h" |
| 9 | #include "chrome/browser/ui/global_error/global_error.h" |
| 10 | #include "components/keyed_service/core/keyed_service.h" |
| 11 | |
| 12 | class Profile; |
| 13 | |
| 14 | // Shows elevation needed for recovery component install on the wrench menu |
| 15 | // using a bubble view and a menu item. |
| 16 | class RecoveryInstallGlobalError : public GlobalErrorWithStandardBubble, |
| 17 | public KeyedService { |
| 18 | public: |
| 19 | explicit RecoveryInstallGlobalError(Profile* profile); |
| 20 | virtual ~RecoveryInstallGlobalError(); |
| 21 | |
| 22 | private: |
| 23 | // KeyedService: |
| 24 | virtual void Shutdown() override; |
| 25 | |
| 26 | // GlobalErrorWithStandardBubble: |
| 27 | virtual Severity GetSeverity() override; |
| 28 | virtual bool HasMenuItem() override; |
| 29 | virtual int MenuItemCommandID() override; |
| 30 | virtual base::string16 MenuItemLabel() override; |
| 31 | virtual int MenuItemIconResourceID() override; |
| 32 | virtual void ExecuteMenuItem(Browser* browser) override; |
| 33 | virtual bool HasBubbleView() override; |
| 34 | virtual bool HasShownBubbleView() override; |
| 35 | virtual void ShowBubbleView(Browser* browser) override; |
| 36 | virtual gfx::Image GetBubbleViewIcon() override; |
| 37 | virtual base::string16 GetBubbleViewTitle() override; |
| 38 | virtual std::vector<base::string16> GetBubbleViewMessages() override; |
| 39 | virtual base::string16 GetBubbleViewAcceptButtonLabel() override; |
| 40 | virtual bool ShouldAddElevationIconToAcceptButton() override; |
| 41 | virtual base::string16 GetBubbleViewCancelButtonLabel() override; |
| 42 | virtual void OnBubbleViewDidClose(Browser* browser) override; |
| 43 | virtual void BubbleViewAcceptButtonPressed(Browser* browser) override; |
| 44 | virtual void BubbleViewCancelButtonPressed(Browser* browser) override; |
| 45 | |
| 46 | bool HasElevationNotification() const; |
| 47 | void OnElevationRequirementChanged(); |
| 48 | |
| 49 | bool elevation_needed_; |
| 50 | |
| 51 | // The Profile this service belongs to. |
| 52 | Profile* profile_; |
| 53 | |
| 54 | // Monitors registry change for recovery component install. |
| 55 | PrefChangeRegistrar pref_registrar_; |
| 56 | |
| 57 | bool has_shown_bubble_view_; |
| 58 | |
| 59 | DISALLOW_COPY_AND_ASSIGN(RecoveryInstallGlobalError); |
| 60 | }; |
| 61 | |
| 62 | #endif // CHROME_BROWSER_RECOVERY_RECOVERY_INSTALL_GLOBAL_ERROR_H_ |