Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(303)

Side by Side Diff: chrome/browser/previews/previews_infobar_delegate.cc

Issue 2860083003: Add timestamp support to the Previews infobar (Closed)
Patch Set: fix copyright dates Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #include "chrome/browser/previews/previews_infobar_delegate.h" 5 #include "chrome/browser/previews/previews_infobar_delegate.h"
6 6
7 #include "base/metrics/histogram_macros.h" 7 #include "base/metrics/histogram_macros.h"
8 #include "base/optional.h" 8 #include "base/optional.h"
9 #include "chrome/browser/android/android_theme_resources.h" 9 #include "chrome/browser/android/android_theme_resources.h"
10 #include "chrome/browser/infobars/infobar_service.h" 10 #include "chrome/browser/infobars/infobar_service.h"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 InfoBarService* infobar_service = 67 InfoBarService* infobar_service =
68 InfoBarService::FromWebContents(web_contents); 68 InfoBarService::FromWebContents(web_contents);
69 69
70 // The WebContents may not have TabHelpers set. If TabHelpers are not set, 70 // The WebContents may not have TabHelpers set. If TabHelpers are not set,
71 // don't show Previews infobars. 71 // don't show Previews infobars.
72 if (!infobar_tab_helper || !infobar_service) 72 if (!infobar_tab_helper || !infobar_service)
73 return; 73 return;
74 if (infobar_tab_helper->displayed_preview_infobar()) 74 if (infobar_tab_helper->displayed_preview_infobar())
75 return; 75 return;
76 76
77 #if defined(OS_ANDROID)
78 infobars::InfoBar* infobar =
79 infobar_service->AddInfoBar(PreviewsInfoBarDelegate::CreateInfoBar(
80 infobar_service,
81 std::unique_ptr<PreviewsInfoBarDelegate>(new PreviewsInfoBarDelegate(
82 web_contents, infobar_type, is_data_saver_user,
83 on_dismiss_callback))));
84 #else
77 infobars::InfoBar* infobar = 85 infobars::InfoBar* infobar =
78 infobar_service->AddInfoBar(infobar_service->CreateConfirmInfoBar( 86 infobar_service->AddInfoBar(infobar_service->CreateConfirmInfoBar(
79 std::unique_ptr<ConfirmInfoBarDelegate>(new PreviewsInfoBarDelegate( 87 std::unique_ptr<ConfirmInfoBarDelegate>(new PreviewsInfoBarDelegate(
80 web_contents, infobar_type, is_data_saver_user, 88 web_contents, infobar_type, is_data_saver_user,
81 on_dismiss_callback)))); 89 on_dismiss_callback))));
90 #endif
82 91
83 if (infobar && (infobar_type == LITE_PAGE || infobar_type == LOFI)) { 92 if (infobar && (infobar_type == LITE_PAGE || infobar_type == LOFI)) {
84 auto* data_reduction_proxy_settings = 93 auto* data_reduction_proxy_settings =
85 DataReductionProxyChromeSettingsFactory::GetForBrowserContext( 94 DataReductionProxyChromeSettingsFactory::GetForBrowserContext(
86 web_contents->GetBrowserContext()); 95 web_contents->GetBrowserContext());
87 data_reduction_proxy_settings->IncrementLoFiUIShown(); 96 data_reduction_proxy_settings->IncrementLoFiUIShown();
88 } 97 }
89 98
90 RecordPreviewsInfoBarAction(infobar_type, INFOBAR_SHOWN); 99 RecordPreviewsInfoBarAction(infobar_type, INFOBAR_SHOWN);
91 infobar_tab_helper->set_displayed_preview_infobar(true); 100 infobar_tab_helper->set_displayed_preview_infobar(true);
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 } else if (infobar_type_ == OFFLINE) { 181 } else if (infobar_type_ == OFFLINE) {
173 // Prevent LoFi and lite page modes from showing after reload. 182 // Prevent LoFi and lite page modes from showing after reload.
174 // TODO(ryansturm): rename DISABLE_LOFI_MODE to DISABLE_PREVIEWS. 183 // TODO(ryansturm): rename DISABLE_LOFI_MODE to DISABLE_PREVIEWS.
175 // crbug.com/707272 184 // crbug.com/707272
176 web_contents->GetController().Reload(content::ReloadType::DISABLE_LOFI_MODE, 185 web_contents->GetController().Reload(content::ReloadType::DISABLE_LOFI_MODE,
177 true); 186 true);
178 } 187 }
179 188
180 return true; 189 return true;
181 } 190 }
191
192 base::string16 PreviewsInfoBarDelegate::GetTimestampText() const {
193 return base::string16();
194 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698