Chromium Code Reviews| 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 <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "components/security_interstitials/core/metrics_helper.h" | |
|
estark
2015/12/01 21:41:51
unnecessary, forward-declared below
felt
2015/12/01 22:59:23
Done.
| |
| 12 | 13 |
| 13 class GURL; | 14 class GURL; |
| 14 class PrefService; | 15 class PrefService; |
| 15 | 16 |
| 16 namespace security_interstitials { | 17 namespace security_interstitials { |
| 17 | 18 |
| 18 class MetricsHelper; | 19 class MetricsHelper; |
| 19 | 20 |
| 20 // Constants used to communicate with the JavaScript. | 21 // Constants used to communicate with the JavaScript. |
| 21 extern const char kBoxChecked[]; | 22 extern const char kBoxChecked[]; |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 44 CMD_OPEN_LOGIN = 7, | 45 CMD_OPEN_LOGIN = 7, |
| 45 // Safe Browsing Extended Reporting | 46 // Safe Browsing Extended Reporting |
| 46 CMD_DO_REPORT = 8, | 47 CMD_DO_REPORT = 8, |
| 47 CMD_DONT_REPORT = 9, | 48 CMD_DONT_REPORT = 9, |
| 48 CMD_OPEN_REPORTING_PRIVACY = 10, | 49 CMD_OPEN_REPORTING_PRIVACY = 10, |
| 49 // Report a phishing error | 50 // Report a phishing error |
| 50 CMD_REPORT_PHISHING_ERROR = 11, | 51 CMD_REPORT_PHISHING_ERROR = 11, |
| 51 }; | 52 }; |
| 52 | 53 |
| 53 // Provides methods for handling commands from the user, which requires some | 54 // Provides methods for handling commands from the user, which requires some |
| 54 // embedder-specific abstraction. | 55 // embedder-specific abstraction. This class should handle all commands sent |
| 56 // by the JavaScript error page. | |
| 55 class ControllerClient { | 57 class ControllerClient { |
| 56 public: | 58 public: |
| 57 ControllerClient(); | 59 ControllerClient(); |
| 58 virtual ~ControllerClient(); | 60 virtual ~ControllerClient(); |
| 59 | 61 |
| 60 // Handle the user's reporting preferences. | 62 // Handle the user's reporting preferences. |
| 61 void SetReportingPreference(bool report); | 63 void SetReportingPreference(bool report); |
| 62 void OpenExtendedReportingPrivacyPolicy(); | 64 void OpenExtendedReportingPrivacyPolicy(); |
| 63 | 65 |
| 66 // If available, open the operating system's date/time settings. | |
| 67 virtual bool CanLaunchDateAndTimeSettings() = 0; | |
| 68 virtual void LaunchDateAndTimeSettings() = 0; | |
| 69 | |
| 70 // Close the error and go back to the previous page. | |
| 71 virtual void GoBack() = 0; | |
| 72 | |
| 64 MetricsHelper* metrics_helper() const; | 73 MetricsHelper* metrics_helper() const; |
| 65 void set_metrics_helper(scoped_ptr<MetricsHelper> metrics_helper); | 74 void set_metrics_helper(scoped_ptr<MetricsHelper> metrics_helper); |
| 66 | 75 |
| 67 protected: | 76 protected: |
| 68 virtual void OpenUrlInCurrentTab(const GURL& url) = 0; | 77 virtual void OpenUrlInCurrentTab(const GURL& url) = 0; |
| 69 | 78 |
| 70 virtual const std::string& GetApplicationLocale() = 0; | 79 virtual const std::string& GetApplicationLocale() = 0; |
| 71 virtual PrefService* GetPrefService() = 0; | 80 virtual PrefService* GetPrefService() = 0; |
| 72 virtual const std::string GetExtendedReportingPrefName() = 0; | 81 virtual const std::string GetExtendedReportingPrefName() = 0; |
| 73 | 82 |
| 74 private: | 83 private: |
| 75 scoped_ptr<MetricsHelper> metrics_helper_; | 84 scoped_ptr<MetricsHelper> metrics_helper_; |
| 76 | 85 |
| 77 DISALLOW_COPY_AND_ASSIGN(ControllerClient); | 86 DISALLOW_COPY_AND_ASSIGN(ControllerClient); |
| 78 }; | 87 }; |
| 79 | 88 |
| 80 } // namespace security_interstitials | 89 } // namespace security_interstitials |
| 81 | 90 |
| 82 #endif // COMPONENTS_SECURITY_INTERSTITIALS_CORE_CONTROLLER_CLIENT_H_ | 91 #endif // COMPONENTS_SECURITY_INTERSTITIALS_CORE_CONTROLLER_CLIENT_H_ |
| OLD | NEW |