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

Side by Side Diff: chrome/browser/ui/webui/history_ui.cc

Issue 14225004: History: Reload page only after web history deletion has completed. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: x Created 7 years, 8 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
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/webui/history_ui.h" 5 #include "chrome/browser/ui/webui/history_ui.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 1041 matching lines...) Expand 10 before | Expand all | Expand 10 after
1052 NOTREACHED() << "Failed to parse JSON response."; 1052 NOTREACHED() << "Failed to parse JSON response.";
1053 } 1053 }
1054 results_info_value_.SetBoolean("hasSyncedResults", results_value != NULL); 1054 results_info_value_.SetBoolean("hasSyncedResults", results_value != NULL);
1055 if (!history_request_consumer_.HasPendingRequests()) 1055 if (!history_request_consumer_.HasPendingRequests())
1056 ReturnResultsToFrontEnd(); 1056 ReturnResultsToFrontEnd();
1057 } 1057 }
1058 1058
1059 void BrowsingHistoryHandler::RemoveComplete() { 1059 void BrowsingHistoryHandler::RemoveComplete() {
1060 urls_to_be_deleted_.clear(); 1060 urls_to_be_deleted_.clear();
1061 1061
1062 // Notify the page that the deletion request succeeded. 1062 // Notify the page that the deletion request is complete, but only if a web
1063 web_ui()->CallJavascriptFunction("deleteComplete"); 1063 // history delete request is not still pending.
1064 if (!(web_history_request_.get() && web_history_request_->is_pending()))
1065 web_ui()->CallJavascriptFunction("deleteComplete");
1064 } 1066 }
1065 1067
1066 void BrowsingHistoryHandler::RemoveWebHistoryComplete( 1068 void BrowsingHistoryHandler::RemoveWebHistoryComplete(
1067 history::WebHistoryService::Request* request, bool success) { 1069 history::WebHistoryService::Request* request, bool success) {
1068 // Notify the page that the deletion request is complete. 1070 // TODO(dubroy): Should we handle failure somehow? Delete directives will
1069 base::FundamentalValue success_value(success); 1071 // ensure that the visits are eventually deleted, so maybe it's not necessary.
1070 web_ui()->CallJavascriptFunction("webHistoryDeleteComplete", success_value); 1072 if (!delete_task_tracker_.HasTrackedTasks())
1073 RemoveComplete();
1071 } 1074 }
1072 1075
1073 void BrowsingHistoryHandler::SetQueryTimeInWeeks( 1076 void BrowsingHistoryHandler::SetQueryTimeInWeeks(
1074 int offset, history::QueryOptions* options) { 1077 int offset, history::QueryOptions* options) {
1075 // LocalMidnight returns the beginning of the current day so get the 1078 // LocalMidnight returns the beginning of the current day so get the
1076 // beginning of the next one. 1079 // beginning of the next one.
1077 base::Time midnight = base::Time::Now().LocalMidnight() + 1080 base::Time midnight = base::Time::Now().LocalMidnight() +
1078 base::TimeDelta::FromDays(1); 1081 base::TimeDelta::FromDays(1);
1079 options->end_time = midnight - 1082 options->end_time = midnight -
1080 base::TimeDelta::FromDays(7 * offset); 1083 base::TimeDelta::FromDays(7 * offset);
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
1170 return GURL(std::string(chrome::kChromeUIHistoryURL) + "#q=" + 1173 return GURL(std::string(chrome::kChromeUIHistoryURL) + "#q=" +
1171 net::EscapeQueryParamValue(UTF16ToUTF8(text), true)); 1174 net::EscapeQueryParamValue(UTF16ToUTF8(text), true));
1172 } 1175 }
1173 1176
1174 // static 1177 // static
1175 base::RefCountedMemory* HistoryUI::GetFaviconResourceBytes( 1178 base::RefCountedMemory* HistoryUI::GetFaviconResourceBytes(
1176 ui::ScaleFactor scale_factor) { 1179 ui::ScaleFactor scale_factor) {
1177 return ResourceBundle::GetSharedInstance(). 1180 return ResourceBundle::GetSharedInstance().
1178 LoadDataResourceBytesForScale(IDR_HISTORY_FAVICON, scale_factor); 1181 LoadDataResourceBytesForScale(IDR_HISTORY_FAVICON, scale_factor);
1179 } 1182 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698