Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / chrome / browser / safe_browsing / srt_global_error_win.h
blobb2bc5bd72e98a7e3d7087a2f30bbe89ff5609dd0
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 // GlobalErrorWithStandardBubble:
39 base::string16 GetBubbleViewTitle() override;
40 std::vector<base::string16> GetBubbleViewMessages() override;
41 base::string16 GetBubbleViewAcceptButtonLabel() override;
42 base::string16 GetBubbleViewCancelButtonLabel() override;
43 void OnBubbleViewDidClose(Browser* browser) override;
44 void BubbleViewAcceptButtonPressed(Browser* browser) override;
45 bool ShouldAddElevationIconToAcceptButton() override;
46 void BubbleViewCancelButtonPressed(Browser* browser) override;
47 bool ShouldCloseOnDeactivate() const override;
49 private:
50 // Executes the SRT if the executable is present.
51 void MaybeExecuteSRT();
53 // Falls back to a navigation to the download page when we failed to
54 // download and execute the SRT.
55 void FallbackToDownloadPage();
57 // Destroys this instance.
58 void DestroySelf();
60 // Used to dismiss the GlobalError, then set to NULL.
61 GlobalErrorService* global_error_service_;
63 // The path to the downloaded executable.
64 base::FilePath downloaded_path_;
66 DISALLOW_COPY_AND_ASSIGN(SRTGlobalError);
69 #endif // CHROME_BROWSER_SAFE_BROWSING_SRT_GLOBAL_ERROR_WIN_H_