OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef COMPONENTS_SECURITY_INTERSTITIALS_CORE_CONTROLLER_CLIENT_H_ | 5 #ifndef COMPONENTS_SECURITY_INTERSTITIALS_CORE_CONTROLLER_CLIENT_H_ |
6 #define COMPONENTS_SECURITY_INTERSTITIALS_CORE_CONTROLLER_CLIENT_H_ | 6 #define COMPONENTS_SECURITY_INTERSTITIALS_CORE_CONTROLLER_CLIENT_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 CMD_OPEN_WHITEPAPER = 11, | 49 CMD_OPEN_WHITEPAPER = 11, |
50 // Report a phishing error | 50 // Report a phishing error |
51 CMD_REPORT_PHISHING_ERROR = 12, | 51 CMD_REPORT_PHISHING_ERROR = 12, |
52 }; | 52 }; |
53 | 53 |
54 // Provides methods for handling commands from the user, which requires some | 54 // Provides methods for handling commands from the user, which requires some |
55 // embedder-specific abstraction. This class should handle all commands sent | 55 // embedder-specific abstraction. This class should handle all commands sent |
56 // by the JavaScript error page. | 56 // by the JavaScript error page. |
57 class ControllerClient { | 57 class ControllerClient { |
58 public: | 58 public: |
59 ControllerClient(); | 59 explicit ControllerClient(std::unique_ptr<MetricsHelper> metrics_helper); |
60 virtual ~ControllerClient(); | 60 virtual ~ControllerClient(); |
61 | 61 |
62 // Handle the user's reporting preferences. | 62 // Handle the user's reporting preferences. |
63 void SetReportingPreference(bool report); | 63 void SetReportingPreference(bool report); |
64 void OpenExtendedReportingPrivacyPolicy(); | 64 void OpenExtendedReportingPrivacyPolicy(); |
65 void OpenExtendedReportingWhitepaper(); | 65 void OpenExtendedReportingWhitepaper(); |
66 | 66 |
67 // If available, open the operating system's date/time settings. | 67 // If available, open the operating system's date/time settings. |
68 virtual bool CanLaunchDateAndTimeSettings() = 0; | 68 virtual bool CanLaunchDateAndTimeSettings() = 0; |
69 virtual void LaunchDateAndTimeSettings() = 0; | 69 virtual void LaunchDateAndTimeSettings() = 0; |
70 | 70 |
71 // Close the error and go back to the previous page. | 71 // Close the error and go back to the previous page. |
72 virtual void GoBack() = 0; | 72 virtual void GoBack() = 0; |
73 | 73 |
74 // Close the error and proceed to the blocked page. | 74 // Close the error and proceed to the blocked page. |
75 virtual void Proceed() = 0; | 75 virtual void Proceed() = 0; |
76 | 76 |
77 // Reload the blocked page to see if it succeeds now. | 77 // Reload the blocked page to see if it succeeds now. |
78 virtual void Reload() = 0; | 78 virtual void Reload() = 0; |
79 | 79 |
80 MetricsHelper* metrics_helper() const; | 80 MetricsHelper* metrics_helper() const; |
81 void set_metrics_helper(std::unique_ptr<MetricsHelper> metrics_helper); | |
82 | 81 |
83 virtual void OpenUrlInCurrentTab(const GURL& url) = 0; | 82 virtual void OpenUrlInCurrentTab(const GURL& url) = 0; |
84 | 83 |
85 protected: | 84 protected: |
86 virtual const std::string& GetApplicationLocale() = 0; | 85 virtual const std::string& GetApplicationLocale() = 0; |
87 virtual PrefService* GetPrefService() = 0; | 86 virtual PrefService* GetPrefService() = 0; |
88 virtual const std::string GetExtendedReportingPrefName() = 0; | 87 virtual const std::string GetExtendedReportingPrefName() = 0; |
89 | 88 |
90 private: | 89 private: |
91 std::unique_ptr<MetricsHelper> metrics_helper_; | 90 std::unique_ptr<MetricsHelper> metrics_helper_; |
92 | 91 |
93 DISALLOW_COPY_AND_ASSIGN(ControllerClient); | 92 DISALLOW_COPY_AND_ASSIGN(ControllerClient); |
94 }; | 93 }; |
95 | 94 |
96 } // namespace security_interstitials | 95 } // namespace security_interstitials |
97 | 96 |
98 #endif // COMPONENTS_SECURITY_INTERSTITIALS_CORE_CONTROLLER_CLIENT_H_ | 97 #endif // COMPONENTS_SECURITY_INTERSTITIALS_CORE_CONTROLLER_CLIENT_H_ |
OLD | NEW |