OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef COMPONENTS_SECURITY_INTERSTITIALS_CORE_CONTROLLER_CLIENT_H_ |
| 6 #define COMPONENTS_SECURITY_INTERSTITIALS_CORE_CONTROLLER_CLIENT_H_ |
| 7 |
| 8 #include <string> |
| 9 |
| 10 #include "base/macros.h" |
| 11 #include "base/memory/scoped_ptr.h" |
| 12 |
| 13 class GURL; |
| 14 class PrefService; |
| 15 |
| 16 namespace security_interstitials { |
| 17 |
| 18 class MetricsHelper; |
| 19 |
| 20 // Provides methods for handling commands from the user, which requires some |
| 21 // embedder-specific abstraction. |
| 22 class ControllerClient { |
| 23 public: |
| 24 // These represent the commands sent from the interstitial JavaScript. |
| 25 // DO NOT reorder or change these without also changing the JavaScript! |
| 26 // See components/security_interstitials/core/browser/resources/ |
| 27 enum SecurityInterstitialCommands { |
| 28 // Used by tests |
| 29 CMD_ERROR = -3, |
| 30 CMD_TEXT_FOUND = -2, |
| 31 CMD_TEXT_NOT_FOUND = -1, |
| 32 // Decisions |
| 33 CMD_DONT_PROCEED = 0, |
| 34 CMD_PROCEED = 1, |
| 35 // Ways for user to get more information |
| 36 CMD_SHOW_MORE_SECTION = 2, |
| 37 CMD_OPEN_HELP_CENTER = 3, |
| 38 CMD_OPEN_DIAGNOSTIC = 4, |
| 39 // Primary button actions |
| 40 CMD_RELOAD = 5, |
| 41 CMD_OPEN_DATE_SETTINGS = 6, |
| 42 CMD_OPEN_LOGIN = 7, |
| 43 // Safe Browsing Extended Reporting |
| 44 CMD_DO_REPORT = 8, |
| 45 CMD_DONT_REPORT = 9, |
| 46 CMD_OPEN_REPORTING_PRIVACY = 10, |
| 47 // Report a phishing error |
| 48 CMD_REPORT_PHISHING_ERROR = 11, |
| 49 }; |
| 50 |
| 51 ControllerClient(); |
| 52 virtual ~ControllerClient(); |
| 53 |
| 54 // Handle the user's reporting preferences. |
| 55 void SetReportingPreference(bool report); |
| 56 void OpenExtendedReportingPrivacyPolicy(); |
| 57 |
| 58 MetricsHelper* metrics_helper() const; |
| 59 void set_metrics_helper(scoped_ptr<MetricsHelper> metrics_helper); |
| 60 |
| 61 protected: |
| 62 virtual void OpenUrlInCurrentTab(const GURL& url) = 0; |
| 63 |
| 64 virtual const std::string& GetApplicationLocale() = 0; |
| 65 virtual PrefService* GetPrefService() = 0; |
| 66 virtual const std::string GetExtendedReportingPrefName() = 0; |
| 67 |
| 68 private: |
| 69 scoped_ptr<MetricsHelper> metrics_helper_; |
| 70 |
| 71 DISALLOW_COPY_AND_ASSIGN(ControllerClient); |
| 72 }; |
| 73 |
| 74 } // namespace security_interstitials |
| 75 |
| 76 #endif // COMPONENTS_SECURITY_INTERSTITIALS_CORE_CONTROLLER_CLIENT_H_ |
OLD | NEW |