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

Side by Side Diff: chrome/browser/safe_browsing/safe_browsing_service.cc

Issue 360059: Remove build time differences between Chrome Frame and Google Chrome in the... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 11 years, 1 month 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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 5
6 #include "chrome/browser/safe_browsing/safe_browsing_service.h" 6 #include "chrome/browser/safe_browsing/safe_browsing_service.h"
7 7
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/histogram.h" 9 #include "base/histogram.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/message_loop.h" 11 #include "base/message_loop.h"
12 #include "base/path_service.h" 12 #include "base/path_service.h"
13 #include "base/string_util.h" 13 #include "base/string_util.h"
14 #include "chrome/browser/browser_process.h" 14 #include "chrome/browser/browser_process.h"
15 #include "chrome/browser/chrome_thread.h" 15 #include "chrome/browser/chrome_thread.h"
16 #include "chrome/browser/profile_manager.h" 16 #include "chrome/browser/profile_manager.h"
17 #include "chrome/browser/safe_browsing/protocol_manager.h" 17 #include "chrome/browser/safe_browsing/protocol_manager.h"
18 #include "chrome/browser/safe_browsing/safe_browsing_blocking_page.h" 18 #include "chrome/browser/safe_browsing/safe_browsing_blocking_page.h"
19 #include "chrome/browser/safe_browsing/safe_browsing_database.h" 19 #include "chrome/browser/safe_browsing/safe_browsing_database.h"
20 #include "chrome/browser/tab_contents/navigation_entry.h" 20 #include "chrome/browser/tab_contents/navigation_entry.h"
21 #include "chrome/browser/tab_contents/tab_util.h" 21 #include "chrome/browser/tab_contents/tab_util.h"
22 #include "chrome/browser/tab_contents/tab_contents.h" 22 #include "chrome/browser/tab_contents/tab_contents.h"
23 #include "chrome/common/chrome_constants.h" 23 #include "chrome/common/chrome_constants.h"
24 #include "chrome/common/chrome_paths.h" 24 #include "chrome/common/chrome_paths.h"
25 #include "chrome/common/pref_names.h" 25 #include "chrome/common/pref_names.h"
26 #include "chrome/common/pref_service.h" 26 #include "chrome/common/pref_service.h"
27 #include "chrome/common/url_constants.h" 27 #include "chrome/common/url_constants.h"
28 #if defined(OS_WIN)
29 #include "chrome/installer/util/browser_distribution.h"
30 #endif
28 #include "net/base/registry_controlled_domain.h" 31 #include "net/base/registry_controlled_domain.h"
29 32
30 using base::Time; 33 using base::Time;
31 using base::TimeDelta; 34 using base::TimeDelta;
32 35
33 SafeBrowsingService::SafeBrowsingService() 36 SafeBrowsingService::SafeBrowsingService()
34 : database_(NULL), 37 : database_(NULL),
35 protocol_manager_(NULL), 38 protocol_manager_(NULL),
36 enabled_(false), 39 enabled_(false),
37 resetting_(false), 40 resetting_(false),
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 void SafeBrowsingService::ShutDown() { 87 void SafeBrowsingService::ShutDown() {
85 ChromeThread::PostTask( 88 ChromeThread::PostTask(
86 ChromeThread::IO, FROM_HERE, 89 ChromeThread::IO, FROM_HERE,
87 NewRunnableMethod(this, &SafeBrowsingService::OnIOShutdown)); 90 NewRunnableMethod(this, &SafeBrowsingService::OnIOShutdown));
88 } 91 }
89 92
90 void SafeBrowsingService::OnIOInitialize(const std::string& client_key, 93 void SafeBrowsingService::OnIOInitialize(const std::string& client_key,
91 const std::string& wrapped_key) { 94 const std::string& wrapped_key) {
92 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::IO)); 95 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::IO));
93 enabled_ = true; 96 enabled_ = true;
97
98 // On Windows, get the safe browsing client name from the browser
99 // distribution classes in installer util. These classes don't yet have
100 // an analog on non-Windows builds so just keep the name specified here.
101 #if defined(OS_WIN)
102 BrowserDistribution* dist = BrowserDistribution::GetDistribution();
103 std::string client_name(dist->GetSafeBrowsingName());
104 #else
105 #if defined(GOOGLE_CHROME_BUILD)
106 std::string client_name("googlechrome");
107 #else
108 std::string client_name("chromium");
109 #endif
110 #endif
111
94 protocol_manager_ = new SafeBrowsingProtocolManager(this, 112 protocol_manager_ = new SafeBrowsingProtocolManager(this,
113 client_name,
95 client_key, 114 client_key,
96 wrapped_key); 115 wrapped_key);
97 // We want to initialize the protocol manager only after the database has 116 // We want to initialize the protocol manager only after the database has
98 // loaded, which we'll receive asynchronously (DatabaseLoadComplete). If 117 // loaded, which we'll receive asynchronously (DatabaseLoadComplete). If
99 // database_loaded_ isn't true, we'll wait for that notification to do the 118 // database_loaded_ isn't true, we'll wait for that notification to do the
100 // init. 119 // init.
101 if (database_loaded_) 120 if (database_loaded_)
102 protocol_manager_->Initialize(); 121 protocol_manager_->Initialize();
103 } 122 }
104 123
(...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after
673 // report if it's not there. 692 // report if it's not there.
674 std::string list; 693 std::string list;
675 std::vector<SBPrefix> prefix_hits; 694 std::vector<SBPrefix> prefix_hits;
676 std::vector<SBFullHashResult> full_hits; 695 std::vector<SBFullHashResult> full_hits;
677 database_->ContainsUrl(page_url, &list, &prefix_hits, &full_hits, 696 database_->ContainsUrl(page_url, &list, &prefix_hits, &full_hits,
678 protocol_manager_->last_update()); 697 protocol_manager_->last_update());
679 698
680 if (full_hits.empty()) 699 if (full_hits.empty())
681 protocol_manager_->ReportMalware(malware_url, page_url, referrer_url); 700 protocol_manager_->ReportMalware(malware_url, page_url, referrer_url);
682 } 701 }
OLDNEW
« no previous file with comments | « chrome/browser/safe_browsing/protocol_manager_unittest.cc ('k') | chrome/installer/util/browser_distribution.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698