| OLD | NEW |
| (Empty) |
| 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. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_SAFE_BROWSING_SRT_GLOBAL_ERROR_WIN_H_ | |
| 6 #define CHROME_BROWSER_SAFE_BROWSING_SRT_GLOBAL_ERROR_WIN_H_ | |
| 7 | |
| 8 #include <vector> | |
| 9 | |
| 10 #include "base/files/file_path.h" | |
| 11 #include "base/macros.h" | |
| 12 #include "chrome/browser/safe_browsing/srt_field_trial_win.h" | |
| 13 #include "chrome/browser/ui/global_error/global_error.h" | |
| 14 | |
| 15 class GlobalErrorService; | |
| 16 | |
| 17 namespace safe_browsing { | |
| 18 | |
| 19 // Encapsulates UI-related functionality for the software removal tool (SRT) | |
| 20 // prompt. The UI consists of two parts: (1.) the profile reset (pop-up) bubble, | |
| 21 // and (2.) a menu item in the wrench menu (provided by being a GlobalError). | |
| 22 class SRTGlobalError : public GlobalErrorWithStandardBubble { | |
| 23 public: | |
| 24 // Creates the new SRTGlobalError to be associated to the given | |
| 25 // |global_error_service|. |download_path| specifies the path the SRT has | |
| 26 // already been downloaded to. If for some reason the SRT cannot be found at | |
| 27 // this path, if the path is empty or if the SRT cannot be launched, the | |
| 28 // bubble will fall back to opening the SRT download page if the user requests | |
| 29 // cleanup. | |
| 30 SRTGlobalError(GlobalErrorService* global_error_service, | |
| 31 const base::FilePath& downloaded_path); | |
| 32 ~SRTGlobalError() override; | |
| 33 | |
| 34 // GlobalError: | |
| 35 bool HasMenuItem() override; | |
| 36 int MenuItemCommandID() override; | |
| 37 base::string16 MenuItemLabel() override; | |
| 38 void ExecuteMenuItem(Browser* browser) override; | |
| 39 void ShowBubbleView(Browser* browser) override; | |
| 40 | |
| 41 // WidgetDelegateView overrides: | |
| 42 bool ShouldShowCloseButton() const override; | |
| 43 | |
| 44 // GlobalErrorWithStandardBubble: | |
| 45 base::string16 GetBubbleViewTitle() override; | |
| 46 std::vector<base::string16> GetBubbleViewMessages() override; | |
| 47 base::string16 GetBubbleViewAcceptButtonLabel() override; | |
| 48 base::string16 GetBubbleViewCancelButtonLabel() override; | |
| 49 void OnBubbleViewDidClose(Browser* browser) override; | |
| 50 void BubbleViewAcceptButtonPressed(Browser* browser) override; | |
| 51 bool ShouldAddElevationIconToAcceptButton() override; | |
| 52 void BubbleViewCancelButtonPressed(Browser* browser) override; | |
| 53 bool ShouldCloseOnDeactivate() const override; | |
| 54 | |
| 55 private: | |
| 56 // Executes the SRT if the executable is present. | |
| 57 void MaybeExecuteSRT(); | |
| 58 | |
| 59 // Falls back to a navigation to the download page when we failed to | |
| 60 // download and execute the SRT. | |
| 61 void FallbackToDownloadPage(); | |
| 62 | |
| 63 // Called when user interaction has started. | |
| 64 void OnUserinteractionStarted(SRTPromptHistogramValue histogram_value); | |
| 65 | |
| 66 // Called when user interaction is done. | |
| 67 void OnUserinteractionDone(); | |
| 68 | |
| 69 // Used to dismiss the GlobalError, then set to NULL. | |
| 70 GlobalErrorService* global_error_service_; | |
| 71 | |
| 72 // The path to the downloaded executable. | |
| 73 base::FilePath downloaded_path_; | |
| 74 | |
| 75 // Identifies whether the bubble was shown from the menu. | |
| 76 bool bubble_shown_from_menu_ = false; | |
| 77 | |
| 78 // Identifies whether the user interacted with the bubble buttons or not. | |
| 79 bool interacted_ = false; | |
| 80 | |
| 81 DISALLOW_COPY_AND_ASSIGN(SRTGlobalError); | |
| 82 }; | |
| 83 | |
| 84 } // namespace safe_browsing | |
| 85 | |
| 86 #endif // CHROME_BROWSER_SAFE_BROWSING_SRT_GLOBAL_ERROR_WIN_H_ | |
| OLD | NEW |