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

Unified Diff: chrome/renderer/render_view.cc

Issue 6250176: Make RenderView not have to know about how PhishingClassifierDelegate. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 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/renderer/render_view.h ('k') | chrome/renderer/render_view_observer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/render_view.cc
===================================================================
--- chrome/renderer/render_view.cc (revision 73993)
+++ chrome/renderer/render_view.cc (working copy)
@@ -587,15 +587,6 @@
#endif
ClearBlockedContentSettings();
- if (CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kEnableClientSidePhishingDetection)) {
- phishing_delegate_.reset(
- new safe_browsing::PhishingClassifierDelegate(this, NULL));
- RenderThread* thread = RenderThread::current();
- if (thread && thread->phishing_scorer()) {
- phishing_delegate_->SetPhishingScorer(thread->phishing_scorer());
- }
- }
routing_id_ = routing_id;
if (opener_id != MSG_ROUTING_NONE)
@@ -657,6 +648,11 @@
page_click_tracker->AddListener(password_autofill_manager);
page_click_tracker->AddListener(autofill_agent);
new TranslateHelper(this);
+
+ if (CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kEnableClientSidePhishingDetection)) {
+ new safe_browsing::PhishingClassifierDelegate(this, NULL);
+ }
}
RenderView::~RenderView() {
@@ -688,10 +684,6 @@
render_thread_->RemoveFilter(audio_message_filter_);
- // Tell the PhishingClassifierDelegate that the view is going away.
- if (phishing_delegate_.get())
- phishing_delegate_->CancelPendingClassification();
-
#ifndef NDEBUG
// Make sure we are no longer referenced by the ViewMap.
ViewMap* views = g_view_map.Pointer();
@@ -1249,8 +1241,7 @@
OnCaptureThumbnail();
}
- if (phishing_delegate_.get())
- phishing_delegate_->FinishedLoad(&contents);
+ FOR_EACH_OBSERVER(RenderViewObserver, observers_, PageCaptured(contents));
}
void RenderView::CaptureText(WebFrame* frame, string16* contents) {
@@ -2683,15 +2674,6 @@
SetPendingWindowRect(initial_pos_);
}
-void RenderView::closeWidgetSoon() {
- // Same for the phishing classifier.
- if (phishing_delegate_.get())
- phishing_delegate_->CancelPendingClassification();
-
- if (script_can_close_)
- RenderWidget::closeWidgetSoon();
-}
-
void RenderView::runModal() {
DCHECK(did_show_) << "should already have shown the view";
@@ -3292,6 +3274,9 @@
navigation_state->set_transition_type(PageTransition::AUTO_SUBFRAME);
}
+ FOR_EACH_OBSERVER(
+ RenderViewObserver, observers_, DidStartProvisionalLoad(frame));
+
Send(new ViewHostMsg_DidStartProvisionalLoadForFrame(
routing_id_, frame->identifier(), is_top_most, ds->request().url()));
}
@@ -3327,6 +3312,9 @@
const WebURLRequest& failed_request = ds->request();
+ FOR_EACH_OBSERVER(
+ RenderViewObserver, observers_, DidFailProvisionalLoad(frame, error));
+
bool show_repost_interstitial =
(error.reason == net::ERR_CACHE_MISS &&
EqualsASCII(failed_request.httpMethod(), "POST"));
@@ -3412,10 +3400,6 @@
// We bump our Page ID to correspond with the new session history entry.
page_id_ = next_page_id_++;
- // Let the phishing classifier decide whether to cancel classification.
- if (phishing_delegate_.get())
- phishing_delegate_->CommittedLoadInFrame(frame);
-
// Advance our offset in session history, applying the length limit. There
// is now no forward history.
history_list_offset_++;
@@ -3450,6 +3434,9 @@
}
}
+ FOR_EACH_OBSERVER(RenderViewObserver, observers_,
+ DidCommitProvisionalLoad(frame, is_new_navigation));
+
// Remember that we've already processed this request, so we don't update
// the session history again. We do this regardless of whether this is
// a session history navigation, because if we attempted a session history
@@ -3524,8 +3511,8 @@
Send(new ViewHostMsg_DocumentLoadedInFrame(routing_id_, frame->identifier()));
- FOR_EACH_OBSERVER(
- RenderViewObserver, observers_, DidFinishDocumentLoad(frame));
+ FOR_EACH_OBSERVER(RenderViewObserver, observers_,
+ DidFinishDocumentLoad(frame));
// Check whether we have new encoding name.
UpdateEncoding(frame, frame->view()->pageEncoding().utf8());
@@ -3566,7 +3553,7 @@
}
void RenderView::didFailLoad(WebFrame* frame, const WebURLError& error) {
- // Ignore
+ FOR_EACH_OBSERVER(RenderViewObserver, observers_, DidFailLoad(frame, error));
}
void RenderView::didFinishLoad(WebFrame* frame) {
« no previous file with comments | « chrome/renderer/render_view.h ('k') | chrome/renderer/render_view_observer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698