| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 CHROME_BROWSER_PREVIEWS_PREVIEWS_INFOBAR_DELEGATE_H_ | 5 #ifndef CHROME_BROWSER_PREVIEWS_PREVIEWS_INFOBAR_DELEGATE_H_ |
| 6 #define CHROME_BROWSER_PREVIEWS_PREVIEWS_INFOBAR_DELEGATE_H_ | 6 #define CHROME_BROWSER_PREVIEWS_PREVIEWS_INFOBAR_DELEGATE_H_ |
| 7 | 7 |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/strings/string16.h" | 9 #include "base/strings/string16.h" |
| 10 #include "components/infobars/core/confirm_infobar_delegate.h" | 10 #include "components/infobars/core/confirm_infobar_delegate.h" |
| 11 | 11 |
| 12 namespace content { | 12 namespace content { |
| 13 class WebContents; | 13 class WebContents; |
| 14 } | 14 } |
| 15 | 15 |
| 16 // Shows an infobar that lets the user know that a preview page has been loaded, | 16 // Shows an infobar that lets the user know that a preview page has been loaded, |
| 17 // and gives the user a link to reload the original page. This infobar will only | 17 // and gives the user a link to reload the original page. This infobar will only |
| 18 // be shown once per page load. Records UMA data for user interactions with the | 18 // be shown once per page load. Records UMA data for user interactions with the |
| 19 // infobar. | 19 // infobar. |
| 20 class PreviewsInfoBarDelegate : public ConfirmInfoBarDelegate { | 20 class PreviewsInfoBarDelegate : public ConfirmInfoBarDelegate { |
| 21 public: | 21 public: |
| 22 // The type of the infobar. It controls the strings and what UMA data is | 22 // The type of the infobar. It controls the strings and what UMA data is |
| 23 // recorded for the infobar. | 23 // recorded for the infobar. |
| 24 // TODO(ryansturm): Combine PreviewsInfoBarType with previews::PreviewsType. |
| 25 // crbug.com/704335 |
| 24 enum PreviewsInfoBarType { | 26 enum PreviewsInfoBarType { |
| 25 LOFI, // Server-side image replacement. | 27 LOFI, // Image placeholders (both server and client implementations). |
| 26 LITE_PAGE, // Server-side page rewrite. | 28 LITE_PAGE, // Server-side page rewrite. |
| 27 OFFLINE, // Offline copy of the page. | 29 OFFLINE, // Offline copy of the page. |
| 28 }; | 30 }; |
| 29 | 31 |
| 30 typedef base::Callback<void(bool opt_out)> OnDismissPreviewsInfobarCallback; | 32 typedef base::Callback<void(bool opt_out)> OnDismissPreviewsInfobarCallback; |
| 31 | 33 |
| 32 // Actions on the previews infobar. This enum must remain synchronized with | 34 // Actions on the previews infobar. This enum must remain synchronized with |
| 33 // the enum of the same name in metrics/histograms/histograms.xml. | 35 // the enum of the same name in metrics/histograms/histograms.xml. |
| 34 enum PreviewsInfoBarAction { | 36 enum PreviewsInfoBarAction { |
| 35 INFOBAR_SHOWN = 0, | 37 INFOBAR_SHOWN = 0, |
| 36 INFOBAR_LOAD_ORIGINAL_CLICKED = 1, | 38 INFOBAR_LOAD_ORIGINAL_CLICKED = 1, |
| 37 INFOBAR_DISMISSED_BY_USER = 2, | 39 INFOBAR_DISMISSED_BY_USER = 2, |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 mutable PreviewsInfoBarAction infobar_dismissed_action_; | 74 mutable PreviewsInfoBarAction infobar_dismissed_action_; |
| 73 | 75 |
| 74 const base::string16 message_text_; | 76 const base::string16 message_text_; |
| 75 | 77 |
| 76 OnDismissPreviewsInfobarCallback on_dismiss_callback_; | 78 OnDismissPreviewsInfobarCallback on_dismiss_callback_; |
| 77 | 79 |
| 78 DISALLOW_COPY_AND_ASSIGN(PreviewsInfoBarDelegate); | 80 DISALLOW_COPY_AND_ASSIGN(PreviewsInfoBarDelegate); |
| 79 }; | 81 }; |
| 80 | 82 |
| 81 #endif // CHROME_BROWSER_PREVIEWS_PREVIEWS_INFOBAR_DELEGATE_H_ | 83 #endif // CHROME_BROWSER_PREVIEWS_PREVIEWS_INFOBAR_DELEGATE_H_ |
| OLD | NEW |