Refactor WebsiteSettings to operate on a SecurityInfo
[chromium-blink-merge.git] / chrome / browser / safe_browsing / srt_global_error_win.h
blobd8423a7cfe67e94c55ca21fcb570ffd8f86dac13
1 // Copyright 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.
5 #ifndef CHROME_BROWSER_SAFE_BROWSING_SRT_GLOBAL_ERROR_WIN_H_
6 #define CHROME_BROWSER_SAFE_BROWSING_SRT_GLOBAL_ERROR_WIN_H_
8 #include <vector>
10 #include "base/basictypes.h"
11 #include "base/files/file_path.h"
12 #include "chrome/browser/ui/global_error/global_error.h"
14 class GlobalErrorService;
16 // Encapsulates UI-related functionality for the software removal tool (SRT)
17 // prompt. The UI consists of two parts: (1.) the profile reset (pop-up) bubble,
18 // and (2.) a menu item in the wrench menu (provided by being a GlobalError).
19 class SRTGlobalError : public GlobalErrorWithStandardBubble {
20 public:
21 // Creates the new SRTGlobalError to be associated to the given
22 // |global_error_service|. |download_path| specifies the path the SRT has
23 // already been downloaded to. If for some reason the SRT cannot be found at
24 // this path, if the path is empty or if the SRT cannot be launched, the
25 // bubble will fall back to opening the SRT download page if the user requests
26 // cleanup.
27 SRTGlobalError(GlobalErrorService* global_error_service,
28 const base::FilePath& downloaded_path);
29 ~SRTGlobalError() override;
31 // GlobalError:
32 bool HasMenuItem() override;
33 int MenuItemCommandID() override;
34 base::string16 MenuItemLabel() override;
35 void ExecuteMenuItem(Browser* browser) override;
36 void ShowBubbleView(Browser* browser) override;
38 // WidgetDelegateView overrides:
39 bool ShouldShowCloseButton() const override;
41 // GlobalErrorWithStandardBubble:
42 base::string16 GetBubbleViewTitle() override;
43 std::vector<base::string16> GetBubbleViewMessages() override;
44 base::string16 GetBubbleViewAcceptButtonLabel() override;
45 base::string16 GetBubbleViewCancelButtonLabel() override;
46 void OnBubbleViewDidClose(Browser* browser) override;
47 void BubbleViewAcceptButtonPressed(Browser* browser) override;
48 bool ShouldAddElevationIconToAcceptButton() override;
49 void BubbleViewCancelButtonPressed(Browser* browser) override;
50 bool ShouldCloseOnDeactivate() const override;
52 private:
53 // Executes the SRT if the executable is present.
54 void MaybeExecuteSRT();
56 // Falls back to a navigation to the download page when we failed to
57 // download and execute the SRT.
58 void FallbackToDownloadPage();
60 // Destroys this instance.
61 void DestroySelf();
63 // Used to dismiss the GlobalError, then set to NULL.
64 GlobalErrorService* global_error_service_;
66 // The path to the downloaded executable.
67 base::FilePath downloaded_path_;
69 // Identifies whether the Dismiss button should be shown or not.
70 bool show_dismiss_button_ = false;
72 // Identifies whether the user interacted with the bubble buttons or not.
73 bool interacted_ = false;
75 DISALLOW_COPY_AND_ASSIGN(SRTGlobalError);
78 #endif // CHROME_BROWSER_SAFE_BROWSING_SRT_GLOBAL_ERROR_WIN_H_