summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-02 17:22:30 +0000
committerjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-02 17:22:30 +0000
commitb80f6843f26b8b48672b104a5cac38be0b1f5bc1 (patch)
tree98a4248a1a217d209858ba2357c6e9607248e954 /chrome
parent2ec3d508d2fd7b33763b2ae22afd2804e6b881a0 (diff)
downloadchromium_src-b80f6843f26b8b48672b104a5cac38be0b1f5bc1.zip
chromium_src-b80f6843f26b8b48672b104a5cac38be0b1f5bc1.tar.gz
chromium_src-b80f6843f26b8b48672b104a5cac38be0b1f5bc1.tar.bz2
Remove safe_browsing code from BrowserRenderProcessHost. Also remove crash reporting glue in content.
BUG=77089,77093 Review URL: http://codereview.chromium.org/6901137 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@83734 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/chrome_content_browser_client.cc80
-rw-r--r--chrome/browser/chrome_content_browser_client.h7
-rw-r--r--chrome/browser/importer/profile_import_process_host.cc2
-rw-r--r--chrome/browser/nacl_host/nacl_process_host.cc2
-rw-r--r--chrome/browser/safe_browsing/client_side_detection_host_unittest.cc10
-rw-r--r--chrome/browser/safe_browsing/client_side_detection_service.cc72
-rw-r--r--chrome/browser/safe_browsing/client_side_detection_service.h38
-rw-r--r--chrome/browser/safe_browsing/client_side_detection_service_unittest.cc47
-rw-r--r--chrome/browser/ui/tab_contents/tab_contents_wrapper.cc3
-rw-r--r--chrome/browser/ui/tab_contents/tab_contents_wrapper.h12
-rw-r--r--chrome/browser/utility_process_host.cc2
11 files changed, 167 insertions, 108 deletions
diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc
index f2328d2..e0a0899 100644
--- a/chrome/browser/chrome_content_browser_client.cc
+++ b/chrome/browser/chrome_content_browser_client.cc
@@ -4,6 +4,9 @@
#include "chrome/browser/chrome_content_browser_client.h"
+#include "base/command_line.h"
+#include "chrome/app/breakpad_mac.h"
+#include "chrome/browser/browser_process.h"
#include "chrome/browser/character_encoding.h"
#include "chrome/browser/debugger/devtools_handler.h"
#include "chrome/browser/desktop_notification_handler.h"
@@ -19,11 +22,18 @@
#include "chrome/browser/search_engines/search_provider_install_state_message_filter.h"
#include "chrome/browser/spellcheck_message_filter.h"
#include "chrome/browser/ui/webui/chrome_web_ui_factory.h"
+#include "chrome/common/child_process_logging.h"
+#include "chrome/common/chrome_switches.h"
#include "chrome/common/pref_names.h"
#include "content/browser/renderer_host/browser_render_process_host.h"
#include "content/browser/renderer_host/render_view_host.h"
#include "content/browser/tab_contents/tab_contents.h"
+#if defined(OS_LINUX)
+#include "base/linux_util.h"
+#include "chrome/browser/crash_handler_host_linux.h"
+#endif // OS_LINUX
+
namespace chrome {
void ChromeContentBrowserClient::RenderViewHostCreated(
@@ -112,4 +122,74 @@ std::string ChromeContentBrowserClient::GetCanonicalEncodingNameByAliasName(
return CharacterEncoding::GetCanonicalEncodingNameByAliasName(alias_name);
}
+void ChromeContentBrowserClient::AppendExtraCommandLineSwitches(
+ CommandLine* command_line, int child_process_id) {
+#if defined(USE_LINUX_BREAKPAD)
+ if (IsCrashReporterEnabled()) {
+ command_line->AppendSwitchASCII(switches::kEnableCrashReporter,
+ child_process_logging::GetClientId() + "," + base::GetLinuxDistro());
+ }
+#elif defined(OS_MACOSX)
+ if (IsCrashReporterEnabled()) {
+ command_line->AppendSwitchASCII(switches::kEnableCrashReporter,
+ child_process_logging::GetClientId());
+ }
+#endif // OS_MACOSX
+
+ std::string process_type =
+ command_line->GetSwitchValueASCII(switches::kProcessType);
+ if (process_type == switches::kExtensionProcess ||
+ process_type == switches::kRendererProcess) {
+ const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess();
+ FilePath user_data_dir =
+ browser_command_line.GetSwitchValuePath(switches::kUserDataDir);
+ if (!user_data_dir.empty())
+ command_line->AppendSwitchPath(switches::kUserDataDir, user_data_dir);
+#if defined(OS_CHROMEOS)
+ const std::string& login_profile =
+ browser_command_line.GetSwitchValueASCII(switches::kLoginProfile);
+ if (!login_profile.empty())
+ command_line->AppendSwitchASCII(switches::kLoginProfile, login_profile);
+#endif
+
+ RenderProcessHost* process = RenderProcessHost::FromID(child_process_id);
+
+ PrefService* prefs = process->profile()->GetPrefs();
+ // Currently this pref is only registered if applied via a policy.
+ if (prefs->HasPrefPath(prefs::kDisable3DAPIs) &&
+ prefs->GetBoolean(prefs::kDisable3DAPIs)) {
+ // Turn this policy into a command line switch.
+ command_line->AppendSwitch(switches::kDisable3DAPIs);
+ }
+
+ // Disable client-side phishing detection in the renderer if it is disabled
+ // in the browser process.
+ if (!g_browser_process->safe_browsing_detection_service())
+ command_line->AppendSwitch(switches::kDisableClientSidePhishingDetection);
+ }
+}
+
+std::string ChromeContentBrowserClient::GetApplicationLocale() {
+ return g_browser_process->GetApplicationLocale();
+}
+
+#if defined(OS_LINUX)
+int ChromeContentBrowserClient::GetCrashSignalFD(
+ const std::string& process_type) {
+ if (process_type == switches::kRendererProcess)
+ return RendererCrashHandlerHostLinux::GetInstance()->GetDeathSignalSocket();
+
+ if (process_type == switches::kPluginProcess)
+ return PluginCrashHandlerHostLinux::GetInstance()->GetDeathSignalSocket();
+
+ if (process_type == switches::kPpapiPluginProcess)
+ return PpapiCrashHandlerHostLinux::GetInstance()->GetDeathSignalSocket();
+
+ if (process_type == switches::kGpuProcess)
+ return GpuCrashHandlerHostLinux::GetInstance()->GetDeathSignalSocket();
+
+ return -1;
+}
+#endif
+
} // namespace chrome
diff --git a/chrome/browser/chrome_content_browser_client.h b/chrome/browser/chrome_content_browser_client.h
index 8b96a44..faac34e 100644
--- a/chrome/browser/chrome_content_browser_client.h
+++ b/chrome/browser/chrome_content_browser_client.h
@@ -22,6 +22,13 @@ class ChromeContentBrowserClient : public content::ContentBrowserClient {
virtual GURL GetAlternateErrorPageURL(const TabContents* tab);
virtual std::string GetCanonicalEncodingNameByAliasName(
const std::string& alias_name);
+ virtual void AppendExtraCommandLineSwitches(CommandLine* command_line,
+ int child_process_id);
+ virtual std::string GetApplicationLocale();
+#if defined(OS_LINUX)
+ // Can return an optional fd for crash handling, otherwise returns -1.
+ virtual int GetCrashSignalFD(const std::string& process_type);
+#endif
};
} // namespace chrome
diff --git a/chrome/browser/importer/profile_import_process_host.cc b/chrome/browser/importer/profile_import_process_host.cc
index 453a343..8df0a2f 100644
--- a/chrome/browser/importer/profile_import_process_host.cc
+++ b/chrome/browser/importer/profile_import_process_host.cc
@@ -93,8 +93,6 @@ bool ProfileImportProcessHost::StartProcess() {
switches::kProfileImportProcess);
cmd_line->AppendSwitchASCII(switches::kProcessChannelID, channel_id());
- SetCrashReporterCommandLine(cmd_line);
-
const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess();
if (browser_command_line.HasSwitch(switches::kChromeFrame))
cmd_line->AppendSwitch(switches::kChromeFrame);
diff --git a/chrome/browser/nacl_host/nacl_process_host.cc b/chrome/browser/nacl_host/nacl_process_host.cc
index 38dfcad..2b9409d 100644
--- a/chrome/browser/nacl_host/nacl_process_host.cc
+++ b/chrome/browser/nacl_host/nacl_process_host.cc
@@ -147,8 +147,6 @@ bool NaClProcessHost::LaunchSelLdr() {
cmd_line->AppendSwitchASCII(switches::kProcessChannelID, channel_id());
- SetCrashReporterCommandLine(cmd_line);
-
// On Windows we might need to start the broker process to launch a new loader
#if defined(OS_WIN)
if (running_on_wow64_) {
diff --git a/chrome/browser/safe_browsing/client_side_detection_host_unittest.cc b/chrome/browser/safe_browsing/client_side_detection_host_unittest.cc
index 7a76bbd..9637580 100644
--- a/chrome/browser/safe_browsing/client_side_detection_host_unittest.cc
+++ b/chrome/browser/safe_browsing/client_side_detection_host_unittest.cc
@@ -18,6 +18,8 @@
#include "chrome/test/ui_test_utils.h"
#include "content/browser/browser_thread.h"
#include "content/browser/renderer_host/test_render_view_host.h"
+#include "chrome/browser/ui/tab_contents/test_tab_contents_wrapper.h"
+#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
#include "content/browser/tab_contents/test_tab_contents.h"
#include "googleurl/src/gurl.h"
#include "ipc/ipc_test_sink.h"
@@ -106,7 +108,7 @@ void QuitUIMessageLoop() {
new MessageLoop::QuitTask());
}
-class ClientSideDetectionHostTest : public RenderViewHostTestHarness {
+class ClientSideDetectionHostTest : public TabContentsWrapperTestHarness {
public:
virtual void SetUp() {
// Set custom profile object so that we can mock calls to IsOffTheRecord.
@@ -115,7 +117,7 @@ class ClientSideDetectionHostTest : public RenderViewHostTestHarness {
mock_profile_ = new NiceMock<MockTestingProfile>();
profile_.reset(mock_profile_);
- RenderViewHostTestHarness::SetUp();
+ TabContentsWrapperTestHarness::SetUp();
ui_thread_.reset(new BrowserThread(BrowserThread::UI, &message_loop_));
// Note: we're starting a real IO thread to make sure our DCHECKs that
// verify which thread is running are actually tested.
@@ -130,7 +132,7 @@ class ClientSideDetectionHostTest : public RenderViewHostTestHarness {
csd_service_.reset(new StrictMock<MockClientSideDetectionService>(
model_path));
sb_service_ = new StrictMock<MockSafeBrowsingService>();
- csd_host_ = contents()->safebrowsing_detection_host();
+ csd_host_ = contents_wrapper()->safebrowsing_detection_host();
csd_host_->set_client_side_detection_service(csd_service_.get());
csd_host_->set_safe_browsing_service(sb_service_.get());
@@ -142,7 +144,7 @@ class ClientSideDetectionHostTest : public RenderViewHostTestHarness {
virtual void TearDown() {
io_thread_.reset();
ui_thread_.reset();
- RenderViewHostTestHarness::TearDown();
+ TabContentsWrapperTestHarness::TearDown();
// Restore the command-line like it was before we ran the test.
*CommandLine::ForCurrentProcess() = *original_cmd_line_;
}
diff --git a/chrome/browser/safe_browsing/client_side_detection_service.cc b/chrome/browser/safe_browsing/client_side_detection_service.cc
index 0be6287..8bcf7df 100644
--- a/chrome/browser/safe_browsing/client_side_detection_service.cc
+++ b/chrome/browser/safe_browsing/client_side_detection_service.cc
@@ -18,8 +18,12 @@
#include "chrome/common/net/http_return.h"
#include "chrome/common/net/url_fetcher.h"
#include "chrome/common/safe_browsing/csd.pb.h"
+#include "chrome/common/safe_browsing/safebrowsing_messages.h"
#include "content/browser/browser_thread.h"
+#include "content/browser/renderer_host/render_process_host.h"
+#include "content/common/notification_service.h"
#include "googleurl/src/gurl.h"
+#include "ipc/ipc_platform_file.h"
#include "net/base/load_flags.h"
#include "net/url_request/url_request_context_getter.h"
#include "net/url_request/url_request_status.h"
@@ -57,14 +61,16 @@ ClientSideDetectionService::ClientSideDetectionService(
model_file_(base::kInvalidPlatformFileValue),
ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)),
ALLOW_THIS_IN_INITIALIZER_LIST(callback_factory_(this)),
- request_context_getter_(request_context_getter) {}
+ request_context_getter_(request_context_getter) {
+ registrar_.Add(this, NotificationType::RENDERER_PROCESS_CREATED,
+ NotificationService::AllSources());
+}
ClientSideDetectionService::~ClientSideDetectionService() {
method_factory_.RevokeAll();
STLDeleteContainerPairPointers(client_phishing_reports_.begin(),
client_phishing_reports_.end());
client_phishing_reports_.clear();
- STLDeleteElements(&open_callbacks_);
CloseModelFile();
}
@@ -96,14 +102,6 @@ ClientSideDetectionService* ClientSideDetectionService::Create(
return service.release();
}
-void ClientSideDetectionService::GetModelFile(OpenModelDoneCallback* callback) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- MessageLoop::current()->PostTask(
- FROM_HERE,
- method_factory_.NewRunnableMethod(
- &ClientSideDetectionService::StartGetModelFile, callback));
-}
-
void ClientSideDetectionService::SendClientReportPhishingRequest(
ClientPhishingRequest* verdict,
ClientReportPhishingRequestCallback* callback) {
@@ -151,16 +149,41 @@ void ClientSideDetectionService::OnURLFetchComplete(
}
}
+void ClientSideDetectionService::Observe(NotificationType type,
+ const NotificationSource& source,
+ const NotificationDetails& details) {
+ DCHECK(type == NotificationType::RENDERER_PROCESS_CREATED);
+ if (model_status_ == UNKNOWN_STATUS) {
+ // The model isn't ready. When it's known, we'll call all renderers.
+ return;
+ }
+
+ RenderProcessHost* process = Source<RenderProcessHost>(source).ptr();
+ SendModelToProcess(process);
+}
+
+void ClientSideDetectionService::SendModelToProcess(
+ RenderProcessHost* process) {
+ if (model_file_ == base::kInvalidPlatformFileValue)
+ return;
+
+ IPC::PlatformFileForTransit file;
+#if defined(OS_POSIX)
+ file = base::FileDescriptor(model_file_, false);
+#elif defined(OS_WIN)
+ ::DuplicateHandle(::GetCurrentProcess(), model_file_, process->GetHandle(),
+ &file, 0, false, DUPLICATE_SAME_ACCESS);
+#endif
+ process->Send(new SafeBrowsingMsg_SetPhishingModel(file));
+}
+
void ClientSideDetectionService::SetModelStatus(ModelStatus status) {
DCHECK_NE(READY_STATUS, model_status_);
model_status_ = status;
- if (READY_STATUS == status || ERROR_STATUS == status) {
- for (size_t i = 0; i < open_callbacks_.size(); ++i) {
- open_callbacks_[i]->Run(model_file_);
- }
- STLDeleteElements(&open_callbacks_);
- } else {
- NOTREACHED();
+
+ for (RenderProcessHost::iterator i(RenderProcessHost::AllHostsIterator());
+ !i.IsAtEnd(); i.Advance()) {
+ SendModelToProcess(i.GetCurrentValue());
}
}
@@ -237,21 +260,6 @@ void ClientSideDetectionService::CloseModelFile() {
model_file_ = base::kInvalidPlatformFileValue;
}
-void ClientSideDetectionService::StartGetModelFile(
- OpenModelDoneCallback* callback) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- if (UNKNOWN_STATUS == model_status_) {
- // Store the callback which will be called once we know the status of the
- // model file.
- open_callbacks_.push_back(callback);
- } else {
- // The model is either in READY or ERROR state which means we can
- // call the callback right away.
- callback->Run(model_file_);
- delete callback;
- }
-}
-
void ClientSideDetectionService::StartClientReportPhishingRequest(
ClientPhishingRequest* verdict,
ClientReportPhishingRequestCallback* callback) {
diff --git a/chrome/browser/safe_browsing/client_side_detection_service.h b/chrome/browser/safe_browsing/client_side_detection_service.h
index ce8dfab..29321e0 100644
--- a/chrome/browser/safe_browsing/client_side_detection_service.h
+++ b/chrome/browser/safe_browsing/client_side_detection_service.h
@@ -7,10 +7,9 @@
// descriptor to the client-side phishing model and also to send a ping back to
// Google to verify if a particular site is really phishing or not.
//
-// This class is not thread-safe and expects all calls to GetModelFile() and
-// SendClientReportPhishingRequest() to be made on the UI thread. We also
-// expect that the calling thread runs a message loop and that there is a FILE
-// thread running to execute asynchronous file operations.
+// This class is not thread-safe and expects all calls to be made on the UI
+// thread. We also expect that the calling thread runs a message loop and that
+// there is a FILE thread running to execute asynchronous file operations.
#ifndef CHROME_BROWSER_SAFE_BROWSING_CLIENT_SIDE_DETECTION_SERVICE_H_
#define CHROME_BROWSER_SAFE_BROWSING_CLIENT_SIDE_DETECTION_SERVICE_H_
@@ -34,9 +33,13 @@
#include "base/task.h"
#include "base/time.h"
#include "chrome/common/net/url_fetcher.h"
+#include "content/common/notification_observer.h"
+#include "content/common/notification_registrar.h"
#include "googleurl/src/gurl.h"
#include "net/base/net_util.h"
+class RenderProcessHost;
+
namespace net {
class URLRequestContextGetter;
class URLRequestStatus;
@@ -45,10 +48,9 @@ class URLRequestStatus;
namespace safe_browsing {
class ClientPhishingRequest;
-class ClientSideDetectionService : public URLFetcher::Delegate {
+class ClientSideDetectionService : public URLFetcher::Delegate,
+ public NotificationObserver {
public:
- typedef Callback1<base::PlatformFile>::Type OpenModelDoneCallback;
-
typedef Callback2<GURL /* phishing URL */, bool /* is phishing */>::Type
ClientReportPhishingRequestCallback;
@@ -69,13 +71,10 @@ class ClientSideDetectionService : public URLFetcher::Delegate {
const ResponseCookies& cookies,
const std::string& data);
- // Gets the model file descriptor once the model is ready and stored
- // on disk. If there was an error the callback is called and the
- // platform file is set to kInvalidPlatformFileValue. The
- // ClientSideDetectionService takes ownership of the |callback|.
- // The callback is always called after GetModelFile() returns and on the
- // same thread as GetModelFile() was called.
- void GetModelFile(OpenModelDoneCallback* callback);
+ // NotificationObserver overrides:
+ virtual void Observe(NotificationType type,
+ const NotificationSource& source,
+ const NotificationDetails& details);
// Sends a request to the SafeBrowsing servers with the ClientPhishingRequest.
// The URL scheme of the |url()| in the request should be HTTP. This method
@@ -184,9 +183,6 @@ class ClientSideDetectionService : public URLFetcher::Delegate {
ClientPhishingRequest* verdict,
ClientReportPhishingRequestCallback* callback);
- // Starts getting the model file.
- void StartGetModelFile(OpenModelDoneCallback* callback);
-
// Called by OnURLFetchComplete to handle the response from fetching the
// model.
void HandleModelResponse(const URLFetcher* source,
@@ -215,12 +211,14 @@ class ClientSideDetectionService : public URLFetcher::Delegate {
// that we consider non-public IP addresses. Returns true on success.
bool InitializePrivateNetworks();
+ // Send the model to the given renderer.
+ void SendModelToProcess(RenderProcessHost* process);
+
FilePath model_path_;
ModelStatus model_status_;
base::PlatformFile model_file_;
scoped_ptr<URLFetcher> model_fetcher_;
scoped_ptr<std::string> tmp_model_string_;
- std::vector<OpenModelDoneCallback*> open_callbacks_;
// Map of client report phishing request to the corresponding callback that
// has to be invoked when the request is done.
@@ -240,7 +238,7 @@ class ClientSideDetectionService : public URLFetcher::Delegate {
// TODO(gcasto): Serialize this so that it doesn't reset on browser restart.
std::queue<base::Time> phishing_report_times_;
- // Used to asynchronously call the callbacks for GetModelFile and
+ // Used to asynchronously call the callbacks for
// SendClientReportPhishingRequest.
ScopedRunnableMethodFactory<ClientSideDetectionService> method_factory_;
@@ -256,6 +254,8 @@ class ClientSideDetectionService : public URLFetcher::Delegate {
// The network blocks that we consider private IP address ranges.
std::vector<AddressRange> private_networks_;
+ NotificationRegistrar registrar_;
+
DISALLOW_COPY_AND_ASSIGN(ClientSideDetectionService);
};
diff --git a/chrome/browser/safe_browsing/client_side_detection_service_unittest.cc b/chrome/browser/safe_browsing/client_side_detection_service_unittest.cc
index 203dd93..63a6dc0 100644
--- a/chrome/browser/safe_browsing/client_side_detection_service_unittest.cc
+++ b/chrome/browser/safe_browsing/client_side_detection_service_unittest.cc
@@ -47,15 +47,6 @@ class ClientSideDetectionServiceTest : public testing::Test {
browser_thread_.reset();
}
- base::PlatformFile GetModelFile() {
- model_file_ = base::kInvalidPlatformFileValue;
- csd_service_->GetModelFile(NewCallback(
- this, &ClientSideDetectionServiceTest::GetModelFileDone));
- // This method will block this thread until GetModelFileDone is called.
- msg_loop_.Run();
- return model_file_;
- }
-
std::string ReadModelFile(base::PlatformFile model_file) {
char buf[1024];
int n = base::ReadPlatformFile(model_file, 0, buf, 1024);
@@ -155,11 +146,6 @@ class ClientSideDetectionServiceTest : public testing::Test {
MessageLoop msg_loop_;
private:
- void GetModelFileDone(base::PlatformFile model_file) {
- model_file_ = model_file;
- msg_loop_.Quit();
- }
-
void SendRequestDone(GURL phishing_url, bool is_phishing) {
ASSERT_EQ(phishing_url, phishing_url_);
is_phishing_ = is_phishing;
@@ -167,45 +153,12 @@ class ClientSideDetectionServiceTest : public testing::Test {
}
scoped_ptr<BrowserThread> browser_thread_;
- base::PlatformFile model_file_;
scoped_ptr<BrowserThread> file_thread_;
GURL phishing_url_;
bool is_phishing_;
};
-TEST_F(ClientSideDetectionServiceTest, TestFetchingModel) {
- ScopedTempDir tmp_dir;
- ASSERT_TRUE(tmp_dir.CreateUniqueTempDir());
- FilePath model_path = tmp_dir.path().AppendASCII("model");
-
- // The first time we create the csd service the model file does not exist so
- // we expect there to be a fetch.
- SetModelFetchResponse("BOGUS MODEL", true);
- csd_service_.reset(ClientSideDetectionService::Create(model_path, NULL));
- base::PlatformFile model_file = GetModelFile();
- EXPECT_NE(model_file, base::kInvalidPlatformFileValue);
- EXPECT_EQ(ReadModelFile(model_file), "BOGUS MODEL");
-
- // If you call GetModelFile() multiple times you always get the same platform
- // file back. We don't re-open the file.
- EXPECT_EQ(GetModelFile(), model_file);
-
- // The second time the model already exists on disk. In this case there
- // should not be any fetch. To ensure that we clear the factory.
- factory_->ClearFakeReponses();
- csd_service_.reset(ClientSideDetectionService::Create(model_path, NULL));
- model_file = GetModelFile();
- EXPECT_NE(model_file, base::kInvalidPlatformFileValue);
- EXPECT_EQ(ReadModelFile(model_file), "BOGUS MODEL");
-
- // If the model does not exist and the fetch fails we should get an error.
- model_path = tmp_dir.path().AppendASCII("another_model");
- SetModelFetchResponse("", false /* success */);
- csd_service_.reset(ClientSideDetectionService::Create(model_path, NULL));
- EXPECT_EQ(GetModelFile(), base::kInvalidPlatformFileValue);
-}
-
TEST_F(ClientSideDetectionServiceTest, ServiceObjectDeletedBeforeCallbackDone) {
SetModelFetchResponse("bogus model", true /* success */);
ScopedTempDir tmp_dir;
diff --git a/chrome/browser/ui/tab_contents/tab_contents_wrapper.cc b/chrome/browser/ui/tab_contents/tab_contents_wrapper.cc
index ca17ac0..e723645 100644
--- a/chrome/browser/ui/tab_contents/tab_contents_wrapper.cc
+++ b/chrome/browser/ui/tab_contents/tab_contents_wrapper.cc
@@ -25,6 +25,7 @@
#include "chrome/browser/prerender/prerender_observer.h"
#include "chrome/browser/printing/print_preview_message_handler.h"
#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/safe_browsing/client_side_detection_host.h"
#include "chrome/browser/tab_contents/simple_alert_infobar_delegate.h"
#include "chrome/browser/tab_contents/thumbnail_generator.h"
#include "chrome/browser/translate/translate_tab_helper.h"
@@ -73,6 +74,8 @@ TabContentsWrapper::TabContentsWrapper(TabContents* contents)
password_manager_delegate_.reset(new PasswordManagerDelegateImpl(contents));
password_manager_.reset(
new PasswordManager(contents, password_manager_delegate_.get()));
+ safebrowsing_detection_host_.reset(new safe_browsing::ClientSideDetectionHost(
+ contents));
search_engine_tab_helper_.reset(new SearchEngineTabHelper(contents));
translate_tab_helper_.reset(new TranslateTabHelper(contents));
print_view_manager_.reset(new printing::PrintViewManager(contents));
diff --git a/chrome/browser/ui/tab_contents/tab_contents_wrapper.h b/chrome/browser/ui/tab_contents/tab_contents_wrapper.h
index a90366c..46ae069 100644
--- a/chrome/browser/ui/tab_contents/tab_contents_wrapper.h
+++ b/chrome/browser/ui/tab_contents/tab_contents_wrapper.h
@@ -43,6 +43,10 @@ class TabContentsWrapperDelegate;
class ThumbnailGenerator;
class TranslateTabHelper;
+namespace safe_browsing {
+class ClientSideDetectionHost;
+}
+
// Wraps TabContents and all of its supporting objects in order to control
// their ownership and lifetime, while allowing TabContents to remain generic
// and re-usable in other projects.
@@ -132,6 +136,10 @@ class TabContentsWrapper : public NotificationObserver,
return print_view_manager_.get();
}
+ safe_browsing::ClientSideDetectionHost* safebrowsing_detection_host() {
+ return safebrowsing_detection_host_.get();
+ }
+
SearchEngineTabHelper* search_engine_tab_helper() {
return search_engine_tab_helper_.get();
}
@@ -211,6 +219,10 @@ class TabContentsWrapper : public NotificationObserver,
// Handles print job for this contents.
scoped_ptr<printing::PrintViewManager> print_view_manager_;
+ // Handles IPCs related to SafeBrowsing client-side phishing detection.
+ scoped_ptr<safe_browsing::ClientSideDetectionHost>
+ safebrowsing_detection_host_;
+
scoped_ptr<SearchEngineTabHelper> search_engine_tab_helper_;
scoped_ptr<TranslateTabHelper> translate_tab_helper_;
diff --git a/chrome/browser/utility_process_host.cc b/chrome/browser/utility_process_host.cc
index a663462..c9200b8 100644
--- a/chrome/browser/utility_process_host.cc
+++ b/chrome/browser/utility_process_host.cc
@@ -141,8 +141,6 @@ bool UtilityProcessHost::StartProcess(const FilePath& exposed_dir) {
std::string locale = g_browser_process->GetApplicationLocale();
cmd_line->AppendSwitchASCII(switches::kLang, locale);
- SetCrashReporterCommandLine(cmd_line);
-
const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess();
if (browser_command_line.HasSwitch(switches::kChromeFrame))
cmd_line->AppendSwitch(switches::kChromeFrame);