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 18:40:17
why can't this be forward-declared?
felt
2015/12/01 19:13:45
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 | |
| 20 // Constants used to communicate with the JavaScript. | 19 // Constants used to communicate with the JavaScript. |
| 21 extern const char kBoxChecked[]; | 20 extern const char kBoxChecked[]; |
| 22 extern const char kDisplayCheckBox[]; | 21 extern const char kDisplayCheckBox[]; |
| 23 extern const char kOptInLink[]; | 22 extern const char kOptInLink[]; |
| 24 extern const char kPrivacyLinkHtml[]; | 23 extern const char kPrivacyLinkHtml[]; |
| 25 | 24 |
| 26 // These represent the commands sent from the interstitial JavaScript. | 25 // These represent the commands sent from the interstitial JavaScript. |
| 27 // DO NOT reorder or change these without also changing the JavaScript! | 26 // DO NOT reorder or change these without also changing the JavaScript! |
| 28 // See components/security_interstitials/core/browser/resources/ | 27 // See components/security_interstitials/core/browser/resources/ |
| 29 enum SecurityInterstitialCommands { | 28 enum SecurityInterstitialCommands { |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 44 CMD_OPEN_LOGIN = 7, | 43 CMD_OPEN_LOGIN = 7, |
| 45 // Safe Browsing Extended Reporting | 44 // Safe Browsing Extended Reporting |
| 46 CMD_DO_REPORT = 8, | 45 CMD_DO_REPORT = 8, |
| 47 CMD_DONT_REPORT = 9, | 46 CMD_DONT_REPORT = 9, |
| 48 CMD_OPEN_REPORTING_PRIVACY = 10, | 47 CMD_OPEN_REPORTING_PRIVACY = 10, |
| 49 // Report a phishing error | 48 // Report a phishing error |
| 50 CMD_REPORT_PHISHING_ERROR = 11, | 49 CMD_REPORT_PHISHING_ERROR = 11, |
| 51 }; | 50 }; |
| 52 | 51 |
| 53 // Provides methods for handling commands from the user, which requires some | 52 // Provides methods for handling commands from the user, which requires some |
| 54 // embedder-specific abstraction. | 53 // embedder-specific abstraction. This class should handle all commands sent |
| 54 // by the JavaScript error page. | |
| 55 class ControllerClient { | 55 class ControllerClient { |
| 56 public: | 56 public: |
| 57 ControllerClient(); | 57 ControllerClient(); |
| 58 virtual ~ControllerClient(); | 58 virtual ~ControllerClient(); |
| 59 | 59 |
| 60 // Handle the user's reporting preferences. | 60 // Handle the user's reporting preferences. |
| 61 void SetReportingPreference(bool report); | 61 void SetReportingPreference(bool report); |
| 62 void OpenExtendedReportingPrivacyPolicy(); | 62 void OpenExtendedReportingPrivacyPolicy(); |
| 63 | 63 |
| 64 // If available, open the operating system's date/time settings. | |
| 65 virtual bool CanLaunchDateAndTimeSettings() = 0; | |
| 66 virtual void LaunchDateAndTimeSettings() = 0; | |
| 67 | |
| 68 // Close the error and go back to the previous page. | |
| 69 virtual void GoBack() = 0; | |
| 70 | |
| 64 MetricsHelper* metrics_helper() const; | 71 MetricsHelper* metrics_helper() const; |
| 65 void set_metrics_helper(scoped_ptr<MetricsHelper> metrics_helper); | 72 void set_metrics_helper(scoped_ptr<MetricsHelper> metrics_helper); |
| 66 | 73 |
| 67 protected: | 74 protected: |
| 68 virtual void OpenUrlInCurrentTab(const GURL& url) = 0; | 75 virtual void OpenUrlInCurrentTab(const GURL& url) = 0; |
| 69 | 76 |
| 70 virtual const std::string& GetApplicationLocale() = 0; | 77 virtual const std::string& GetApplicationLocale() = 0; |
| 71 virtual PrefService* GetPrefService() = 0; | 78 virtual PrefService* GetPrefService() = 0; |
| 72 virtual const std::string GetExtendedReportingPrefName() = 0; | 79 virtual const std::string GetExtendedReportingPrefName() = 0; |
| 73 | 80 |
| 74 private: | 81 private: |
| 75 scoped_ptr<MetricsHelper> metrics_helper_; | 82 scoped_ptr<MetricsHelper> metrics_helper_; |
| 76 | 83 |
| 77 DISALLOW_COPY_AND_ASSIGN(ControllerClient); | 84 DISALLOW_COPY_AND_ASSIGN(ControllerClient); |
| 78 }; | 85 }; |
| 79 | 86 |
| 80 } // namespace security_interstitials | 87 } // namespace security_interstitials |
| 81 | 88 |
| 82 #endif // COMPONENTS_SECURITY_INTERSTITIALS_CORE_CONTROLLER_CLIENT_H_ | 89 #endif // COMPONENTS_SECURITY_INTERSTITIALS_CORE_CONTROLLER_CLIENT_H_ |
| OLD | NEW |