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

Unified Diff: chrome/browser/dom_ui/history_ui.cc

Issue 28308: Make history title inclusion safer (createTextNode changes).... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/dom_ui/history_ui.h ('k') | chrome/browser/resources/history.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/dom_ui/history_ui.cc
===================================================================
--- chrome/browser/dom_ui/history_ui.cc (revision 10688)
+++ chrome/browser/dom_ui/history_ui.cc (working copy)
@@ -10,6 +10,7 @@
#include "base/thread.h"
#include "base/time.h"
#include "base/time_format.h"
+#include "chrome/browser/bookmarks/bookmark_model.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/metrics/user_metrics.h"
#include "chrome/browser/history/history_types.h"
@@ -117,11 +118,13 @@
}
BrowsingHistoryHandler::~BrowsingHistoryHandler() {
+ cancelable_consumer_.CancelAllRequests();
+
NotificationService* service = NotificationService::current();
service->RemoveObserver(this, NotificationType::HISTORY_URLS_DELETED,
Source<Profile>(dom_ui_->get_profile()));
- if (remover_)
+ if (remover_.get())
remover_->RemoveObserver(this);
}
@@ -179,6 +182,11 @@
}
void BrowsingHistoryHandler::HandleDeleteDay(const Value* value) {
+ if (BrowsingDataRemover::is_removing()) {
+ dom_ui_->CallJavascriptFunction(L"deleteFailed");
+ return;
+ }
+
// Anything in-flight is invalid.
cancelable_consumer_.CancelAllRequests();
@@ -190,13 +198,10 @@
Time begin_time = time.LocalMidnight();
Time end_time = begin_time + TimeDelta::FromDays(1);
- if (!remover_) {
- remover_ = new BrowsingDataRemover(dom_ui_->get_profile(),
- begin_time,
- end_time);
- remover_->AddObserver(this);
- }
-
+ remover_.reset(new BrowsingDataRemover(dom_ui_->get_profile(),
+ begin_time,
+ end_time));
+ remover_->AddObserver(this);
remover_->Remove(BrowsingDataRemover::REMOVE_HISTORY |
BrowsingDataRemover::REMOVE_COOKIES |
BrowsingDataRemover::REMOVE_CACHE);
@@ -204,6 +209,8 @@
void BrowsingHistoryHandler::OnBrowsingDataRemoverDone() {
dom_ui_->CallJavascriptFunction(L"deleteComplete");
+ remover_->RemoveObserver(this);
+ remover_.release();
}
void BrowsingHistoryHandler::QueryComplete(
@@ -247,7 +254,8 @@
base::TimeFormatShortDate(page.visit_time()));
page_value->SetString(L"snippet", page.snippet().text());
}
-
+ page_value->SetBoolean(L"starred",
+ dom_ui_->get_profile()->GetBookmarkModel()->IsBookmarked(page.url()));
results_value.Append(page_value);
}
@@ -370,6 +378,6 @@
// static
const GURL HistoryUI::GetHistoryURLWithSearchText(
const std::wstring& text) {
- return GURL(GetBaseURL().spec() + "/?q=" +
+ return GURL(GetBaseURL().spec() + "#q=" +
EscapeQueryParamValue(WideToUTF8(text)));
}
« no previous file with comments | « chrome/browser/dom_ui/history_ui.h ('k') | chrome/browser/resources/history.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698