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

Side by Side Diff: chrome/browser/ui/website_settings/website_settings.cc

Issue 351363002: Revert of Port HistoryService::GetVisibleVisitCountToHost to CancelableTaskTracker (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/website_settings/website_settings.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/ui/website_settings/website_settings.h" 5 #include "chrome/browser/ui/website_settings/website_settings.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 site_connection_status_(SITE_CONNECTION_STATUS_UNKNOWN), 143 site_connection_status_(SITE_CONNECTION_STATUS_UNKNOWN),
144 cert_store_(cert_store), 144 cert_store_(cert_store),
145 content_settings_(profile->GetHostContentSettingsMap()) { 145 content_settings_(profile->GetHostContentSettingsMap()) {
146 Init(profile, url, ssl); 146 Init(profile, url, ssl);
147 147
148 HistoryService* history_service = HistoryServiceFactory::GetForProfile( 148 HistoryService* history_service = HistoryServiceFactory::GetForProfile(
149 profile, Profile::EXPLICIT_ACCESS); 149 profile, Profile::EXPLICIT_ACCESS);
150 if (history_service) { 150 if (history_service) {
151 history_service->GetVisibleVisitCountToHost( 151 history_service->GetVisibleVisitCountToHost(
152 site_url_, 152 site_url_,
153 &visit_count_request_consumer_,
153 base::Bind(&WebsiteSettings::OnGotVisitCountToHost, 154 base::Bind(&WebsiteSettings::OnGotVisitCountToHost,
154 base::Unretained(this)), 155 base::Unretained(this)));
155 &visit_count_task_tracker_);
156 } 156 }
157 157
158 PresentSitePermissions(); 158 PresentSitePermissions();
159 PresentSiteData(); 159 PresentSiteData();
160 PresentSiteIdentity(); 160 PresentSiteIdentity();
161 PresentHistoryInfo(base::Time()); 161 PresentHistoryInfo(base::Time());
162 162
163 // Every time the Website Settings UI is opened a |WebsiteSettings| object is 163 // Every time the Website Settings UI is opened a |WebsiteSettings| object is
164 // created. So this counts how ofter the Website Settings UI is opened. 164 // created. So this counts how ofter the Website Settings UI is opened.
165 content::RecordAction(base::UserMetricsAction("WebsiteSettings_Opened")); 165 content::RecordAction(base::UserMetricsAction("WebsiteSettings_Opened"));
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 show_info_bar_ = true; 262 show_info_bar_ = true;
263 263
264 // TODO(markusheintz): This is a temporary hack to fix issue: 264 // TODO(markusheintz): This is a temporary hack to fix issue:
265 // http://crbug.com/144203. 265 // http://crbug.com/144203.
266 #if defined(OS_MACOSX) 266 #if defined(OS_MACOSX)
267 // Refresh the UI to reflect the new setting. 267 // Refresh the UI to reflect the new setting.
268 PresentSitePermissions(); 268 PresentSitePermissions();
269 #endif 269 #endif
270 } 270 }
271 271
272 void WebsiteSettings::OnGotVisitCountToHost(bool found_visits, 272 void WebsiteSettings::OnGotVisitCountToHost(HistoryService::Handle handle,
273 bool found_visits,
273 int visit_count, 274 int visit_count,
274 base::Time first_visit) { 275 base::Time first_visit) {
275 if (!found_visits) { 276 if (!found_visits) {
276 // This indicates an error, such as the page's URL scheme wasn't 277 // This indicates an error, such as the page's URL scheme wasn't
277 // http/https. 278 // http/https.
278 first_visit = base::Time(); 279 first_visit = base::Time();
279 } else if (visit_count == 0) { 280 } else if (visit_count == 0) {
280 first_visit = base::Time::Now(); 281 first_visit = base::Time::Now();
281 } 282 }
282 PresentHistoryInfo(first_visit); 283 PresentHistoryInfo(first_visit);
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after
684 if (visited_before_today) { 685 if (visited_before_today) {
685 first_visit_text = l10n_util::GetStringFUTF16( 686 first_visit_text = l10n_util::GetStringFUTF16(
686 IDS_PAGE_INFO_SECURITY_TAB_VISITED_BEFORE_TODAY, 687 IDS_PAGE_INFO_SECURITY_TAB_VISITED_BEFORE_TODAY,
687 base::TimeFormatShortDate(first_visit)); 688 base::TimeFormatShortDate(first_visit));
688 } else { 689 } else {
689 first_visit_text = l10n_util::GetStringUTF16( 690 first_visit_text = l10n_util::GetStringUTF16(
690 IDS_PAGE_INFO_SECURITY_TAB_FIRST_VISITED_TODAY); 691 IDS_PAGE_INFO_SECURITY_TAB_FIRST_VISITED_TODAY);
691 } 692 }
692 ui_->SetFirstVisit(first_visit_text); 693 ui_->SetFirstVisit(first_visit_text);
693 } 694 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/website_settings/website_settings.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698