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

Unified Diff: chrome/renderer/render_thread.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_thread.h ('k') | chrome/renderer/render_view.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/render_thread.cc
===================================================================
--- chrome/renderer/render_thread.cc (revision 73993)
+++ chrome/renderer/render_thread.cc (working copy)
@@ -16,7 +16,6 @@
#include "base/metrics/field_trial.h"
#include "base/metrics/stats_table.h"
#include "base/process_util.h"
-#include "base/scoped_callback_factory.h"
#include "base/shared_memory.h"
#include "base/string_util.h"
#include "base/task.h"
@@ -69,7 +68,6 @@
#include "chrome/renderer/renderer_webidbfactory_impl.h"
#include "chrome/renderer/renderer_webkitclient_impl.h"
#include "chrome/renderer/safe_browsing/phishing_classifier_delegate.h"
-#include "chrome/renderer/safe_browsing/scorer.h"
#include "chrome/renderer/search_extension.h"
#include "chrome/renderer/searchbox_extension.h"
#include "chrome/renderer/spellchecker/spellcheck.h"
@@ -217,26 +215,6 @@
DISALLOW_COPY_AND_ASSIGN(RenderViewZoomer);
};
-class RenderViewPhishingScorerSetter : public RenderViewVisitor {
- public:
- explicit RenderViewPhishingScorerSetter(const safe_browsing::Scorer* scorer)
- : scorer_(scorer) {
- }
-
- virtual bool Visit(RenderView* render_view) {
- safe_browsing::PhishingClassifierDelegate* delegate =
- render_view->phishing_classifier_delegate();
- if (delegate)
- delegate->SetPhishingScorer(scorer_);
- return true;
- }
-
- private:
- const safe_browsing::Scorer* scorer_;
-
- DISALLOW_COPY_AND_ASSIGN(RenderViewPhishingScorerSetter);
-};
-
} // namespace
// When we run plugins in process, we actually run them on the render thread,
@@ -277,7 +255,6 @@
idle_notification_delay_in_s_ = is_extension_process_ ?
kInitialExtensionIdleHandlerDelayS : kInitialIdleHandlerDelayS;
task_factory_.reset(new ScopedRunnableMethodFactory<RenderThread>(this));
- callback_factory_.reset(new base::ScopedCallbackFactory<RenderThread>(this));
visited_link_slave_.reset(new VisitedLinkSlave());
user_script_slave_.reset(new UserScriptSlave(&extensions_));
@@ -1114,22 +1091,9 @@
}
void RenderThread::OnSetPhishingModel(IPC::PlatformFileForTransit model_file) {
- safe_browsing::Scorer::CreateFromFile(
- IPC::PlatformFileForTransitToPlatformFile(model_file),
- GetFileThreadMessageLoopProxy(),
- callback_factory_->NewCallback(&RenderThread::PhishingScorerCreated));
+ safe_browsing::PhishingClassifierDelegate::SetPhishingModel(model_file);
}
-void RenderThread::PhishingScorerCreated(safe_browsing::Scorer* scorer) {
- if (!scorer) {
- DLOG(ERROR) << "Unable to create a PhishingScorer - corrupt model?";
- return;
- }
- phishing_scorer_.reset(scorer);
- RenderViewPhishingScorerSetter setter(phishing_scorer_.get());
- RenderView::ForEach(&setter);
-}
-
scoped_refptr<base::MessageLoopProxy>
RenderThread::GetFileThreadMessageLoopProxy() {
DCHECK(message_loop() == MessageLoop::current());
« no previous file with comments | « chrome/renderer/render_thread.h ('k') | chrome/renderer/render_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698