summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/chromeos/login/login_utils.cc6
-rw-r--r--chrome/browser/profiles/profile.cc38
-rw-r--r--chrome/browser/profiles/profile.h42
-rw-r--r--chrome/browser/safe_browsing/safe_browsing_test.cc17
4 files changed, 23 insertions, 80 deletions
diff --git a/chrome/browser/chromeos/login/login_utils.cc b/chrome/browser/chromeos/login/login_utils.cc
index db4e3e6..dfbb3969 100644
--- a/chrome/browser/chromeos/login/login_utils.cc
+++ b/chrome/browser/chromeos/login/login_utils.cc
@@ -1200,8 +1200,7 @@ class WarmingObserver : public NetworkLibrary::NetworkManagerObserver {
GURL(GaiaUrls::GetInstance()->client_login_url()),
chrome_browser_net::UrlInfo::EARLY_LOAD_MOTIVATED,
kConnectionsNeeded,
- make_scoped_refptr(
- Profile::Deprecated::GetDefaultRequestContextTemporary()));
+ make_scoped_refptr(Profile::GetDefaultRequestContextDeprecated()));
netlib->RemoveNetworkManagerObserver(this);
delete this;
}
@@ -1216,8 +1215,7 @@ void LoginUtilsImpl::PrewarmAuthentication() {
GURL(GaiaUrls::GetInstance()->client_login_url()),
chrome_browser_net::UrlInfo::EARLY_LOAD_MOTIVATED,
kConnectionsNeeded,
- make_scoped_refptr(
- Profile::Deprecated::GetDefaultRequestContextTemporary()));
+ make_scoped_refptr(Profile::GetDefaultRequestContextDeprecated()));
} else {
new WarmingObserver();
}
diff --git a/chrome/browser/profiles/profile.cc b/chrome/browser/profiles/profile.cc
index da60cab..c8e5433 100644
--- a/chrome/browser/profiles/profile.cc
+++ b/chrome/browser/profiles/profile.cc
@@ -6,48 +6,23 @@
#include <string>
-#include "base/command_line.h"
-#include "base/compiler_specific.h"
-#include "base/file_path.h"
-#include "base/file_util.h"
-#include "base/memory/scoped_ptr.h"
-#include "base/path_service.h"
-#include "base/string_util.h"
#include "build/build_config.h"
-#include "chrome/browser/browser_process.h"
-#include "chrome/browser/content_settings/host_content_settings_map.h"
-#include "chrome/browser/prefs/incognito_mode_prefs.h"
#include "chrome/browser/prefs/pref_service.h"
-#include "chrome/browser/profiles/off_the_record_profile_io_data.h"
-#include "chrome/browser/profiles/profile_dependency_manager.h"
#include "chrome/browser/sync/profile_sync_service.h"
#include "chrome/browser/sync/sync_prefs.h"
-#include "chrome/browser/ui/browser_list.h"
-#include "chrome/browser/ui/webui/chrome_url_data_manager.h"
-#include "chrome/common/chrome_constants.h"
-#include "chrome/common/chrome_notification_types.h"
-#include "chrome/common/chrome_paths.h"
-#include "chrome/common/chrome_switches.h"
-#include "chrome/common/json_pref_store.h"
#include "chrome/common/pref_names.h"
-#include "chrome/common/render_messages.h"
-#include "content/public/browser/browser_thread.h"
-#include "content/public/browser/download_manager.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_ui.h"
-#include "ui/base/resource/resource_bundle.h"
-using base::Time;
-using base::TimeDelta;
+#if defined(OS_CHROMEOS)
+#include "base/command_line.h"
+#include "chrome/common/chrome_switches.h"
+#endif
// A pointer to the request context for the default profile. See comments on
// Profile::GetDefaultRequestContext.
net::URLRequestContextGetter* Profile::default_request_context_;
-namespace {
-
-} // namespace
-
Profile::Profile()
: restored_last_session_(false),
accessibility_pause_level_(0) {
@@ -61,11 +36,6 @@ Profile* Profile::FromBrowserContext(content::BrowserContext* browser_context) {
// static
Profile* Profile::FromWebUI(content::WebUI* web_ui) {
- // TODO(dhollowa): Crash diagnosis http://crbug.com/97802
- CHECK(web_ui);
- CHECK(web_ui->GetWebContents());
- CHECK(web_ui->GetWebContents()->GetBrowserContext());
-
return FromBrowserContext(web_ui->GetWebContents()->GetBrowserContext());
}
diff --git a/chrome/browser/profiles/profile.h b/chrome/browser/profiles/profile.h
index a9b5dee..e20f4f2 100644
--- a/chrome/browser/profiles/profile.h
+++ b/chrome/browser/profiles/profile.h
@@ -13,7 +13,6 @@
#include "base/basictypes.h"
#include "base/hash_tables.h"
#include "base/logging.h"
-#include "chrome/browser/net/preconnect.h" // TODO: remove this.
#include "chrome/browser/net/pref_proxy_config_tracker.h"
#include "chrome/browser/ui/webui/chrome_url_data_manager_factory.h"
#include "content/public/browser/browser_context.h"
@@ -124,32 +123,6 @@ class Profile : public content::BrowserContext {
bool is_new_profile) = 0;
};
- // Whitelist access to deprecated API in order to prevent new regressions.
- class Deprecated {
- private:
- friend bool IsGoogleGAIACookieInstalled();
-
- friend class AutofillDownloadManager;
- friend class BrowserListTabContentsProvider;
- friend class MetricsService;
- friend class SafeBrowsingServiceTestHelper;
- friend class Toolbar5Importer;
- friend class TranslateManager;
- friend class android::TabContentsProvider;
- friend class chromeos::LibCrosServiceLibraryImpl;
- friend class chromeos::ResetDefaultProxyConfigServiceTask;
-
- static net::URLRequestContextGetter* GetDefaultRequestContext() {
- return Profile::GetDefaultRequestContext();
- }
- public:
- // TODO(rlp): Please do not use this function. It is a temporary fix
- // for stable. See crbug.com/125292.
- static net::URLRequestContextGetter* GetDefaultRequestContextTemporary() {
- return Profile::GetDefaultRequestContext();
- }
- };
-
// Key used to bind profile to the widget with which it is associated.
static const char* const kProfileKey;
@@ -172,6 +145,12 @@ class Profile : public content::BrowserContext {
// Returns the profile corresponding to the given WebUI.
static Profile* FromWebUI(content::WebUI* web_ui);
+ // TODO(rlp): Please do not use this function. It is a temporary fix
+ // for M19 stable. See crbug.com/125292.
+ static net::URLRequestContextGetter* GetDefaultRequestContextDeprecated() {
+ return Profile::GetDefaultRequestContext();
+ }
+
// content::BrowserContext implementation ------------------------------------
// Typesafe upcast.
@@ -406,13 +385,6 @@ class Profile : public content::BrowserContext {
// Returns whether it is a guest session.
static bool IsGuestSession();
-#ifdef UNIT_TEST
- // Use with caution. GetDefaultRequestContext may be called on any thread!
- static void set_default_request_context(net::URLRequestContextGetter* c) {
- default_request_context_ = c;
- }
-#endif
-
// Did the user restore the last session? This is set by SessionRestore.
void set_restored_last_session(bool restored_last_session) {
restored_last_session_ = restored_last_session;
@@ -429,7 +401,7 @@ class Profile : public content::BrowserContext {
}
void ResumeAccessibilityEvents() {
- DCHECK(accessibility_pause_level_ > 0);
+ DCHECK_GT(accessibility_pause_level_, 0);
accessibility_pause_level_--;
}
diff --git a/chrome/browser/safe_browsing/safe_browsing_test.cc b/chrome/browser/safe_browsing/safe_browsing_test.cc
index 393a50f..7b2d7c3 100644
--- a/chrome/browser/safe_browsing/safe_browsing_test.cc
+++ b/chrome/browser/safe_browsing/safe_browsing_test.cc
@@ -31,13 +31,13 @@
#include "base/time.h"
#include "base/utf_string_conversions.h"
#include "chrome/browser/browser_process.h"
-#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/safe_browsing/protocol_manager.h"
#include "chrome/browser/safe_browsing/safe_browsing_service.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/url_constants.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "chrome/test/base/ui_test_utils.h"
+#include "content/public/browser/browser_context.h"
#include "content/public/common/url_fetcher.h"
#include "content/public/common/url_fetcher_delegate.h"
#include "content/test/test_browser_thread.h"
@@ -350,10 +350,11 @@ class SafeBrowsingServiceTestHelper
public SafeBrowsingService::Client,
public content::URLFetcherDelegate {
public:
- explicit SafeBrowsingServiceTestHelper(
- SafeBrowsingServiceTest* safe_browsing_test)
+ SafeBrowsingServiceTestHelper(SafeBrowsingServiceTest* safe_browsing_test,
+ net::URLRequestContextGetter* request_context)
: safe_browsing_test_(safe_browsing_test),
- response_status_(net::URLRequestStatus::FAILED) {
+ response_status_(net::URLRequestStatus::FAILED),
+ request_context_(request_context) {
}
// Callbacks for SafeBrowsingService::Client.
@@ -530,8 +531,7 @@ class SafeBrowsingServiceTestHelper
url_fetcher_.reset(content::URLFetcher::Create(
url, content::URLFetcher::GET, this));
url_fetcher_->SetLoadFlags(net::LOAD_DISABLE_CACHE);
- url_fetcher_->SetRequestContext(
- Profile::Deprecated::GetDefaultRequestContext());
+ url_fetcher_->SetRequestContext(request_context_);
url_fetcher_->Start();
ui_test_utils::RunMessageLoop();
return response_status_;
@@ -542,6 +542,7 @@ class SafeBrowsingServiceTestHelper
scoped_ptr<content::URLFetcher> url_fetcher_;
std::string response_data_;
net::URLRequestStatus::Status response_status_;
+ net::URLRequestContextGetter* request_context_;
DISALLOW_COPY_AND_ASSIGN(SafeBrowsingServiceTestHelper);
};
@@ -553,8 +554,10 @@ IN_PROC_BROWSER_TEST_F(SafeBrowsingServiceTest,
int server_port = SafeBrowsingTestServer::Port();
ASSERT_TRUE(InitSafeBrowsingService());
+ net::URLRequestContextGetter* request_context =
+ GetBrowserContext()->GetRequestContext();
scoped_refptr<SafeBrowsingServiceTestHelper> safe_browsing_helper(
- new SafeBrowsingServiceTestHelper(this));
+ new SafeBrowsingServiceTestHelper(this, request_context));
int last_step = 0;
FilePath datafile_path = FilePath(kDataFile);
SafeBrowsingTestServer test_server(datafile_path);