diff options
51 files changed, 203 insertions, 155 deletions
diff --git a/chrome/browser/autofill/autofill_manager_unittest.cc b/chrome/browser/autofill/autofill_manager_unittest.cc index 7f2a834..e10c605 100644 --- a/chrome/browser/autofill/autofill_manager_unittest.cc +++ b/chrome/browser/autofill/autofill_manager_unittest.cc @@ -500,8 +500,6 @@ class AutofillManagerTest : public TabContentsWrapperTestHarness { test_personal_data_.get())); } - Profile* profile() { return contents()->profile(); } - void GetAutofillSuggestions(int query_id, const webkit_glue::FormData& form, const webkit_glue::FormField& field) { diff --git a/chrome/browser/chromeos/login/web_page_view.cc b/chrome/browser/chromeos/login/web_page_view.cc index 07daf5b..7c4826d 100644 --- a/chrome/browser/chromeos/login/web_page_view.cc +++ b/chrome/browser/chromeos/login/web_page_view.cc @@ -11,6 +11,7 @@ #include "base/utf_string_conversions.h" #include "chrome/browser/chromeos/login/helper.h" #include "chrome/browser/chromeos/login/rounded_rect_painter.h" +#include "chrome/browser/profiles/profile.h" #include "content/browser/child_process_security_policy.h" #include "content/browser/tab_contents/tab_contents.h" #include "content/browser/webui/web_ui.h" diff --git a/chrome/browser/chromeos/offline/offline_load_page.cc b/chrome/browser/chromeos/offline/offline_load_page.cc index 389c689..5f3bfe0 100644 --- a/chrome/browser/chromeos/offline/offline_load_page.cc +++ b/chrome/browser/chromeos/offline/offline_load_page.cc @@ -103,7 +103,7 @@ std::string OfflineLoadPage::GetHTMLContents() { strings.SetString("url", failed_url); // The offline page for app has icons and slightly different message. - Profile* profile = tab()->profile(); + Profile* profile = Profile::FromBrowserContext(tab()->browser_context()); DCHECK(profile); const Extension* extension = NULL; ExtensionService* extensions_service = profile->GetExtensionService(); diff --git a/chrome/browser/extensions/extension_webstore_private_browsertest.cc b/chrome/browser/extensions/extension_webstore_private_browsertest.cc index d28e9bd..024c269 100644 --- a/chrome/browser/extensions/extension_webstore_private_browsertest.cc +++ b/chrome/browser/extensions/extension_webstore_private_browsertest.cc @@ -87,7 +87,8 @@ class FakeBrowserSignin : public BrowserSignin { delegate->OnLoginSuccess(); // Fake a token available notification. - Profile* profile = tab_contents->profile()->GetOriginalProfile(); + Profile* profile = Profile::FromBrowserContext( + tab_contents->browser_context())->GetOriginalProfile(); TokenService* token_service = profile->GetTokenService(); token_service->IssueAuthTokenForTest(GaiaConstants::kGaiaService, "new_token"); diff --git a/chrome/browser/extensions/isolated_app_apitest.cc b/chrome/browser/extensions/isolated_app_apitest.cc index eedbbd06..d7bcccf 100644 --- a/chrome/browser/extensions/isolated_app_apitest.cc +++ b/chrome/browser/extensions/isolated_app_apitest.cc @@ -31,7 +31,8 @@ class IsolatedAppApiTest : public ExtensionApiTest { const Extension* GetInstalledApp(TabContents* contents) { const Extension* installed_app = NULL; - ExtensionService* service = contents->profile()->GetExtensionService(); + Profile* profile = Profile::FromBrowserContext(contents->browser_context()); + ExtensionService* service = profile->GetExtensionService(); if (service) { installed_app = service->GetInstalledAppForRenderer( contents->render_view_host()->process()->id()); diff --git a/chrome/browser/external_tab_container_win.cc b/chrome/browser/external_tab_container_win.cc index ebc92ec8..0c9e846 100644 --- a/chrome/browser/external_tab_container_win.cc +++ b/chrome/browser/external_tab_container_win.cc @@ -464,7 +464,7 @@ void ExternalTabContainer::AddNewContents(TabContents* source, // an unwrapped Profile. scoped_ptr<TabContentsWrapper> wrapper(new TabContentsWrapper(new_contents)); bool result = new_container->Init( - new_contents->profile()->GetOriginalProfile(), + wrapper->profile()->GetOriginalProfile(), NULL, initial_pos, WS_CHILD, @@ -477,6 +477,7 @@ void ExternalTabContainer::AddNewContents(TabContents* source, route_all_top_level_navigations_); if (result) { + Profile* profile = wrapper->profile(); wrapper.release(); // Ownership has been transferred. if (route_all_top_level_navigations_) { return; @@ -491,7 +492,7 @@ void ExternalTabContainer::AddNewContents(TabContents* source, attach_params_.user_gesture = user_gesture; attach_params_.disposition = disposition; attach_params_.profile_name = WideToUTF8( - tab_contents()->profile()->GetPath().DirName().BaseName().value()); + profile->GetPath().DirName().BaseName().value()); automation_->Send(new AutomationMsg_AttachExternalTab( tab_handle_, attach_params_)); } else { diff --git a/chrome/browser/favicon/favicon_handler_unittest.cc b/chrome/browser/favicon/favicon_handler_unittest.cc index a76192d..8759a23 100644 --- a/chrome/browser/favicon/favicon_handler_unittest.cc +++ b/chrome/browser/favicon/favicon_handler_unittest.cc @@ -3,6 +3,7 @@ // found in the LICENSE file. #include "chrome/browser/favicon/favicon_handler.h" +#include "chrome/browser/profiles/profile.h" #include "content/browser/renderer_host/test_render_view_host.h" #include "content/browser/tab_contents/navigation_entry.h" #include "content/browser/tab_contents/test_tab_contents.h" @@ -312,7 +313,8 @@ TEST_F(FaviconHandlerTest, GetFaviconFromHistory) { const GURL icon_url("http://www.google.com/favicon"); TestFaviconHandlerDelegate delegate(contents()); - TestFaviconHandler helper(page_url, contents()->profile(), + Profile* profile = Profile::FromBrowserContext(contents()->browser_context()); + TestFaviconHandler helper(page_url, profile, &delegate, FaviconHandler::FAVICON); helper.FetchFavicon(page_url); @@ -359,7 +361,8 @@ TEST_F(FaviconHandlerTest, DownloadFavicon) { const GURL icon_url("http://www.google.com/favicon"); TestFaviconHandlerDelegate delegate(contents()); - TestFaviconHandler helper(page_url, contents()->profile(), + Profile* profile = Profile::FromBrowserContext(contents()->browser_context()); + TestFaviconHandler helper(page_url, profile, &delegate, FaviconHandler::FAVICON); helper.FetchFavicon(page_url); @@ -425,7 +428,8 @@ TEST_F(FaviconHandlerTest, UpdateAndDownloadFavicon) { const GURL new_icon_url("http://www.google.com/new_favicon"); TestFaviconHandlerDelegate delegate(contents()); - TestFaviconHandler helper(page_url, contents()->profile(), + Profile* profile = Profile::FromBrowserContext(contents()->browser_context()); + TestFaviconHandler helper(page_url, profile, &delegate, FaviconHandler::FAVICON); helper.FetchFavicon(page_url); @@ -512,7 +516,8 @@ TEST_F(FaviconHandlerTest, UpdateFavicon) { const GURL new_icon_url("http://www.google.com/new_favicon"); TestFaviconHandlerDelegate delegate(contents()); - TestFaviconHandler helper(page_url, contents()->profile(), + Profile* profile = Profile::FromBrowserContext(contents()->browser_context()); + TestFaviconHandler helper(page_url, profile, &delegate, FaviconHandler::FAVICON); helper.FetchFavicon(page_url); @@ -585,7 +590,8 @@ TEST_F(FaviconHandlerTest, Download2ndFaviconURLCandidate) { const GURL new_icon_url("http://www.google.com/new_favicon"); TestFaviconHandlerDelegate delegate(contents()); - TestFaviconHandler helper(page_url, contents()->profile(), + Profile* profile = Profile::FromBrowserContext(contents()->browser_context()); + TestFaviconHandler helper(page_url, profile, &delegate, FaviconHandler::TOUCH); helper.FetchFavicon(page_url); @@ -701,7 +707,8 @@ TEST_F(FaviconHandlerTest, UpdateDuringDownloading) { const GURL new_icon_url("http://www.google.com/new_favicon"); TestFaviconHandlerDelegate delegate(contents()); - TestFaviconHandler helper(page_url, contents()->profile(), + Profile* profile = Profile::FromBrowserContext(contents()->browser_context()); + TestFaviconHandler helper(page_url, profile, &delegate, FaviconHandler::TOUCH); helper.FetchFavicon(page_url); diff --git a/chrome/browser/prerender/prerender_browsertest.cc b/chrome/browser/prerender/prerender_browsertest.cc index 6732373..2ea4ab0 100644 --- a/chrome/browser/prerender/prerender_browsertest.cc +++ b/chrome/browser/prerender/prerender_browsertest.cc @@ -505,7 +505,7 @@ class PrerenderBrowserTest : public InProcessBrowserTest { } PrerenderManager* prerender_manager() const { - Profile* profile = browser()->GetSelectedTabContents()->profile(); + Profile* profile = browser()->GetSelectedTabContentsWrapper()->profile(); PrerenderManager* prerender_manager = profile->GetPrerenderManager(); return prerender_manager; } diff --git a/chrome/browser/remoting/firewall_traversal_tab_helper.cc b/chrome/browser/remoting/firewall_traversal_tab_helper.cc index 73c044b..b59c8ca33 100644 --- a/chrome/browser/remoting/firewall_traversal_tab_helper.cc +++ b/chrome/browser/remoting/firewall_traversal_tab_helper.cc @@ -20,7 +20,9 @@ FirewallTraversalTabHelper::FirewallTraversalTabHelper( TabContents* tab_contents) : TabContentsObserver(tab_contents) { // Register for notifications about all interested prefs change. - PrefService* prefs = profile()->GetPrefs(); + Profile* profile = + Profile::FromBrowserContext(tab_contents->browser_context()); + PrefService* prefs = profile->GetPrefs(); pref_change_registrar_.Init(prefs); if (prefs) { pref_change_registrar_.Add(prefs::kRemoteAccessClientFirewallTraversal, @@ -51,7 +53,9 @@ void FirewallTraversalTabHelper::Observe(int type, switch (type) { case chrome::NOTIFICATION_PREF_CHANGED: { std::string* pref_name_in = Details<std::string>(details).ptr(); - DCHECK(Source<PrefService>(source).ptr() == profile()->GetPrefs()); + Profile* profile = + Profile::FromBrowserContext(tab_contents()->browser_context()); + DCHECK(Source<PrefService>(source).ptr() == profile->GetPrefs()); if (*pref_name_in == prefs::kRemoteAccessClientFirewallTraversal) { UpdateFirewallTraversalState(); } else { @@ -66,7 +70,9 @@ void FirewallTraversalTabHelper::Observe(int type, void FirewallTraversalTabHelper::UpdateFirewallTraversalState() { const char* pref_name = prefs::kRemoteAccessClientFirewallTraversal; - bool enabled = profile()->GetPrefs()->GetBoolean(pref_name); + Profile* profile = + Profile::FromBrowserContext(tab_contents()->browser_context()); + bool enabled = profile->GetPrefs()->GetBoolean(pref_name); DictionaryValue value; value.SetBoolean(pref_name, enabled); diff --git a/chrome/browser/remoting/firewall_traversal_tab_helper.h b/chrome/browser/remoting/firewall_traversal_tab_helper.h index 7c975cc..ecb2601 100644 --- a/chrome/browser/remoting/firewall_traversal_tab_helper.h +++ b/chrome/browser/remoting/firewall_traversal_tab_helper.h @@ -11,8 +11,6 @@ #include "content/common/notification_observer.h" #include "ipc/ipc_channel.h" -class Profile; - // Per-tab class to manage the firewall traversal policies for // the remoting plugin. // TODO(dmaclach): Replace this with a more generic mechanism for @@ -34,8 +32,6 @@ class FirewallTraversalTabHelper : public NotificationObserver, virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; private: - Profile* profile() const { return tab_contents()->profile(); } - void UpdateFirewallTraversalState(); // Registers and unregisters us for notifications. diff --git a/chrome/browser/safe_browsing/safe_browsing_blocking_page_unittest.cc b/chrome/browser/safe_browsing/safe_browsing_blocking_page_unittest.cc index 87bff79f..002a0f1 100644 --- a/chrome/browser/safe_browsing/safe_browsing_blocking_page_unittest.cc +++ b/chrome/browser/safe_browsing/safe_browsing_blocking_page_unittest.cc @@ -175,8 +175,8 @@ class SafeBrowsingBlockingPageTest : public RenderViewHostTestHarness, // Tests showing a blocking page for a malware page and not proceeding. TEST_F(SafeBrowsingBlockingPageTest, MalwarePageDontProceed) { // Enable malware details. - contents()->profile()->GetPrefs()->SetBoolean( - prefs::kSafeBrowsingReportingEnabled, true); + Profile* profile = Profile::FromBrowserContext(contents()->browser_context()); + profile->GetPrefs()->SetBoolean(prefs::kSafeBrowsingReportingEnabled, true); // Start a load. controller().LoadURL(GURL(kBadURL), GURL(), PageTransition::TYPED); @@ -207,8 +207,8 @@ TEST_F(SafeBrowsingBlockingPageTest, MalwarePageDontProceed) { // Tests showing a blocking page for a malware page and then proceeding. TEST_F(SafeBrowsingBlockingPageTest, MalwarePageProceed) { // Enable malware reports. - contents()->profile()->GetPrefs()->SetBoolean( - prefs::kSafeBrowsingReportingEnabled, true); + Profile* profile = Profile::FromBrowserContext(contents()->browser_context()); + profile->GetPrefs()->SetBoolean(prefs::kSafeBrowsingReportingEnabled, true); // Start a load. controller().LoadURL(GURL(kBadURL), GURL(), PageTransition::TYPED); @@ -237,8 +237,8 @@ TEST_F(SafeBrowsingBlockingPageTest, MalwarePageProceed) { // and not proceeding. TEST_F(SafeBrowsingBlockingPageTest, PageWithMalwareResourceDontProceed) { // Enable malware reports. - contents()->profile()->GetPrefs()->SetBoolean( - prefs::kSafeBrowsingReportingEnabled, true); + Profile* profile = Profile::FromBrowserContext(contents()->browser_context()); + profile->GetPrefs()->SetBoolean(prefs::kSafeBrowsingReportingEnabled, true); // Navigate somewhere. Navigate(kGoogleURL, 1); @@ -271,8 +271,8 @@ TEST_F(SafeBrowsingBlockingPageTest, PageWithMalwareResourceDontProceed) { // and proceeding. TEST_F(SafeBrowsingBlockingPageTest, PageWithMalwareResourceProceed) { // Enable malware reports. - contents()->profile()->GetPrefs()->SetBoolean( - prefs::kSafeBrowsingReportingEnabled, true); + Profile* profile = Profile::FromBrowserContext(contents()->browser_context()); + profile->GetPrefs()->SetBoolean(prefs::kSafeBrowsingReportingEnabled, true); // Navigate somewhere. Navigate(kGoodURL, 1); @@ -303,8 +303,8 @@ TEST_F(SafeBrowsingBlockingPageTest, PageWithMalwareResourceProceed) { TEST_F(SafeBrowsingBlockingPageTest, PageWithMultipleMalwareResourceDontProceed) { // Enable malware reports. - contents()->profile()->GetPrefs()->SetBoolean( - prefs::kSafeBrowsingReportingEnabled, true); + Profile* profile = Profile::FromBrowserContext(contents()->browser_context()); + profile->GetPrefs()->SetBoolean(prefs::kSafeBrowsingReportingEnabled, true); // Navigate somewhere. Navigate(kGoogleURL, 1); @@ -343,8 +343,8 @@ TEST_F(SafeBrowsingBlockingPageTest, TEST_F(SafeBrowsingBlockingPageTest, PageWithMultipleMalwareResourceProceedThenDontProceed) { // Enable malware reports. - contents()->profile()->GetPrefs()->SetBoolean( - prefs::kSafeBrowsingReportingEnabled, true); + Profile* profile = Profile::FromBrowserContext(contents()->browser_context()); + profile->GetPrefs()->SetBoolean(prefs::kSafeBrowsingReportingEnabled, true); // Navigate somewhere. Navigate(kGoogleURL, 1); @@ -398,8 +398,8 @@ TEST_F(SafeBrowsingBlockingPageTest, // subresources and proceeding through the multiple interstitials. TEST_F(SafeBrowsingBlockingPageTest, PageWithMultipleMalwareResourceProceed) { // Enable malware reports. - contents()->profile()->GetPrefs()->SetBoolean( - prefs::kSafeBrowsingReportingEnabled, true); + Profile* profile = Profile::FromBrowserContext(contents()->browser_context()); + profile->GetPrefs()->SetBoolean(prefs::kSafeBrowsingReportingEnabled, true); // Navigate somewhere else. Navigate(kGoodURL, 1); @@ -448,8 +448,8 @@ TEST_F(SafeBrowsingBlockingPageTest, PageWithMultipleMalwareResourceProceed) { // controller entries are OK. http://crbug.com/17627 TEST_F(SafeBrowsingBlockingPageTest, NavigatingBackAndForth) { // Enable malware reports. - contents()->profile()->GetPrefs()->SetBoolean( - prefs::kSafeBrowsingReportingEnabled, true); + Profile* profile = Profile::FromBrowserContext(contents()->browser_context()); + profile->GetPrefs()->SetBoolean(prefs::kSafeBrowsingReportingEnabled, true); // Navigate somewhere. Navigate(kGoodURL, 1); @@ -494,8 +494,8 @@ TEST_F(SafeBrowsingBlockingPageTest, NavigatingBackAndForth) { // cause problems. http://crbug.com/30079 TEST_F(SafeBrowsingBlockingPageTest, ProceedThenDontProceed) { // Enable malware reports. - contents()->profile()->GetPrefs()->SetBoolean( - prefs::kSafeBrowsingReportingEnabled, true); + Profile* profile = Profile::FromBrowserContext(contents()->browser_context()); + profile->GetPrefs()->SetBoolean(prefs::kSafeBrowsingReportingEnabled, true); // Start a load. controller().LoadURL(GURL(kBadURL), GURL(), PageTransition::TYPED); @@ -527,8 +527,8 @@ TEST_F(SafeBrowsingBlockingPageTest, ProceedThenDontProceed) { // Tests showing a blocking page for a malware page with reports disabled. TEST_F(SafeBrowsingBlockingPageTest, MalwareReportsDisabled) { // Disable malware reports. - contents()->profile()->GetPrefs()->SetBoolean( - prefs::kSafeBrowsingReportingEnabled, false); + Profile* profile = Profile::FromBrowserContext(contents()->browser_context()); + profile->GetPrefs()->SetBoolean(prefs::kSafeBrowsingReportingEnabled, false); // Start a load. controller().LoadURL(GURL(kBadURL), GURL(), PageTransition::TYPED); @@ -558,8 +558,8 @@ TEST_F(SafeBrowsingBlockingPageTest, MalwareReportsDisabled) { // Test setting the malware report preferance TEST_F(SafeBrowsingBlockingPageTest, MalwareReports) { // Disable malware reports. - contents()->profile()->GetPrefs()->SetBoolean( - prefs::kSafeBrowsingReportingEnabled, false); + Profile* profile = Profile::FromBrowserContext(contents()->browser_context()); + profile->GetPrefs()->SetBoolean(prefs::kSafeBrowsingReportingEnabled, false); // Start a load. controller().LoadURL(GURL(kBadURL), GURL(), PageTransition::TYPED); @@ -571,18 +571,18 @@ TEST_F(SafeBrowsingBlockingPageTest, MalwareReports) { MessageLoop::current()->RunAllPending(); - EXPECT_FALSE(contents()->profile()->GetPrefs()->GetBoolean( + EXPECT_FALSE(profile->GetPrefs()->GetBoolean( prefs::kSafeBrowsingReportingEnabled)); // Simulate the user check the report agreement checkbox. sb_interstitial->SetReportingPreference(true); - EXPECT_TRUE(contents()->profile()->GetPrefs()->GetBoolean( + EXPECT_TRUE(profile->GetPrefs()->GetBoolean( prefs::kSafeBrowsingReportingEnabled)); // Simulate the user uncheck the report agreement checkbox. sb_interstitial->SetReportingPreference(false); - EXPECT_FALSE(contents()->profile()->GetPrefs()->GetBoolean( + EXPECT_FALSE(profile->GetPrefs()->GetBoolean( prefs::kSafeBrowsingReportingEnabled)); } diff --git a/chrome/browser/speech/speech_input_bubble_gtk.cc b/chrome/browser/speech/speech_input_bubble_gtk.cc index c8c5ab0..6853422d 100644 --- a/chrome/browser/speech/speech_input_bubble_gtk.cc +++ b/chrome/browser/speech/speech_input_bubble_gtk.cc @@ -5,6 +5,7 @@ #include "chrome/browser/speech/speech_input_bubble.h" #include "base/utf_string_conversions.h" +#include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/gtk/browser_toolbar_gtk.h" #include "chrome/browser/ui/gtk/browser_window_gtk.h" @@ -161,8 +162,9 @@ void SpeechInputBubbleGtk::Show() { kBubbleControlHorizontalSpacing, kBubbleControlHorizontalSpacing); gtk_container_add(GTK_CONTAINER(content), vbox); - GtkThemeService* theme_provider = GtkThemeService::GetFrom( - tab_contents()->profile()); + Profile* profile = + Profile::FromBrowserContext(tab_contents()->browser_context()); + GtkThemeService* theme_provider = GtkThemeService::GetFrom(profile); GtkWidget* reference_widget = tab_contents()->GetNativeView(); gfx::Rect container_rect; tab_contents()->GetContainerBounds(&container_rect); @@ -174,7 +176,7 @@ void SpeechInputBubbleGtk::Show() { target_rect.y() > container_rect.height()) { // Target is not in screen view, so point to wrench. Browser* browser = - Browser::GetOrCreateTabbedBrowser(tab_contents()->profile()); + Browser::GetOrCreateTabbedBrowser(profile); BrowserWindowGtk* browser_window = BrowserWindowGtk::GetBrowserWindowForNativeWindow( browser->window()->GetNativeHandle()); diff --git a/chrome/browser/speech/speech_input_bubble_views.cc b/chrome/browser/speech/speech_input_bubble_views.cc index aa1f847..0daa7df 100644 --- a/chrome/browser/speech/speech_input_bubble_views.cc +++ b/chrome/browser/speech/speech_input_bubble_views.cc @@ -347,8 +347,9 @@ void SpeechInputBubbleImpl::Show() { gfx::Rect target_rect = GetInfoBubbleTarget(element_rect_); if (!container_rect.Contains(target_rect.x(), target_rect.y())) { // Target is not in screen view, so point to page icon in omnibox. - Browser* browser = - Browser::GetOrCreateTabbedBrowser(tab_contents()->profile()); + Profile* profile = + Profile::FromBrowserContext(tab_contents()->browser_context()); + Browser* browser = Browser::GetOrCreateTabbedBrowser(profile); BrowserView* browser_view = BrowserView::GetBrowserViewForNativeWindow( browser->window()->GetNativeHandle()); diff --git a/chrome/browser/tab_contents/web_contents_unittest.cc b/chrome/browser/tab_contents/web_contents_unittest.cc index 549ced8..23576ab 100644 --- a/chrome/browser/tab_contents/web_contents_unittest.cc +++ b/chrome/browser/tab_contents/web_contents_unittest.cc @@ -129,7 +129,7 @@ class TestInterstitialPage : public ChromeInterstitialPage { protected: virtual RenderViewHost* CreateRenderViewHost() { return new TestRenderViewHost( - SiteInstance::CreateSiteInstance(tab()->profile()), + SiteInstance::CreateSiteInstance(tab()->browser_context()), this, MSG_ROUTING_NONE); } diff --git a/chrome/browser/tab_contents/web_drag_dest_gtk.cc b/chrome/browser/tab_contents/web_drag_dest_gtk.cc index 9612ac3..b778cc0 100644 --- a/chrome/browser/tab_contents/web_drag_dest_gtk.cc +++ b/chrome/browser/tab_contents/web_drag_dest_gtk.cc @@ -10,6 +10,7 @@ #include "base/message_loop.h" #include "base/utf_string_conversions.h" #include "chrome/browser/bookmarks/bookmark_node_data.h" +#include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/bookmarks/bookmark_tab_helper.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_window.h" @@ -221,12 +222,14 @@ void WebDragDestGtk::OnDragDataReceived( // GTK and Views, hence we can share the same logic here. if (data->target == GetBookmarkTargetAtom()) { if (data->data && data->length > 0) { + Profile* profile = + Profile::FromBrowserContext(tab_contents_->browser_context()); bookmark_drag_data_.ReadFromVector( bookmark_utils::GetNodesFromSelection( NULL, data, ui::CHROME_BOOKMARK_ITEM, - tab_contents_->profile(), NULL, NULL)); - bookmark_drag_data_.SetOriginatingProfile(tab_contents_->profile()); + profile, NULL, NULL)); + bookmark_drag_data_.SetOriginatingProfile(profile); } else { bookmark_drag_data_.ReadFromTuple(drop_data_->url, drop_data_->url_title); diff --git a/chrome/browser/translate/translate_manager_browsertest.cc b/chrome/browser/translate/translate_manager_browsertest.cc index 431f9d4..318e035 100644 --- a/chrome/browser/translate/translate_manager_browsertest.cc +++ b/chrome/browser/translate/translate_manager_browsertest.cc @@ -556,8 +556,9 @@ TEST_F(TranslateManagerTest, FetchLanguagesFromTranslateServer) { // To make sure we got the defaults and don't confuse them with the mocks. ASSERT_NE(default_supported_languages.size(), server_languages.size()); - TranslateManager::GetInstance()->FetchLanguageListFromTranslateServer( - contents()->profile()->GetPrefs()); + Profile* profile = Profile::FromBrowserContext(contents()->browser_context()); + PrefService* prefs = profile->GetPrefs(); + TranslateManager::GetInstance()->FetchLanguageListFromTranslateServer(prefs); // Check that we still get the defaults until the URLFetch has completed. std::vector<std::string> current_supported_languages; @@ -571,8 +572,7 @@ TEST_F(TranslateManagerTest, FetchLanguagesFromTranslateServer) { EXPECT_EQ(default_supported_languages, current_supported_languages); // Now check that we got the appropriate set of languages from the server. - TranslateManager::GetInstance()->FetchLanguageListFromTranslateServer( - contents()->profile()->GetPrefs()); + TranslateManager::GetInstance()->FetchLanguageListFromTranslateServer(prefs); SimulateSupportedLanguagesURLFetch(true, server_languages); current_supported_languages.clear(); TranslateManager::GetSupportedLanguages(¤t_supported_languages); @@ -586,8 +586,7 @@ TEST_F(TranslateManagerTest, FetchLanguagesFromTranslateServer) { } // Reset to original state. - TranslateManager::GetInstance()->FetchLanguageListFromTranslateServer( - contents()->profile()->GetPrefs()); + TranslateManager::GetInstance()->FetchLanguageListFromTranslateServer(prefs); SimulateSupportedLanguagesURLFetch(true, default_supported_languages); } @@ -874,7 +873,8 @@ TEST_F(TranslateManagerTest, UnsupportedUILanguage) { browser_process->SetApplicationLocale("qbz"); // Make sure that the accept language list only contains unsupported languages - PrefService* prefs = contents()->profile()->GetPrefs(); + Profile* profile = Profile::FromBrowserContext(contents()->browser_context()); + PrefService* prefs = profile->GetPrefs(); prefs->SetString(prefs::kAcceptLanguages, "qbz"); // Simulate navigating to a page in a language supported by the translate @@ -895,7 +895,8 @@ TEST_F(TranslateManagerTest, TranslateAcceptLanguage) { browser_process->SetApplicationLocale("qbz"); // Set Qbz and French as the only accepted languages - PrefService* prefs = contents()->profile()->GetPrefs(); + Profile* profile = Profile::FromBrowserContext(contents()->browser_context()); + PrefService* prefs = profile->GetPrefs(); prefs->SetString(prefs::kAcceptLanguages, "qbz,fr"); // Go to a German page @@ -908,7 +909,8 @@ TEST_F(TranslateManagerTest, TranslateAcceptLanguage) { // Tests that the translate enabled preference is honored. TEST_F(TranslateManagerTest, TranslateEnabledPref) { // Make sure the pref allows translate. - PrefService* prefs = contents()->profile()->GetPrefs(); + Profile* profile = Profile::FromBrowserContext(contents()->browser_context()); + PrefService* prefs = profile->GetPrefs(); prefs->SetBoolean(prefs::kEnableTranslate, true); // Simulate navigating to a page and getting its language. @@ -944,7 +946,8 @@ TEST_F(TranslateManagerTest, NeverTranslateLanguagePref) { EXPECT_TRUE(GetTranslateInfoBar() != NULL); // Select never translate this language. - PrefService* prefs = contents()->profile()->GetPrefs(); + Profile* profile = Profile::FromBrowserContext(contents()->browser_context()); + PrefService* prefs = profile->GetPrefs(); PrefChangeRegistrar registrar; registrar.Init(prefs); registrar.Add(TranslatePrefs::kPrefTranslateLanguageBlacklist, @@ -990,7 +993,8 @@ TEST_F(TranslateManagerTest, NeverTranslateSitePref) { EXPECT_TRUE(GetTranslateInfoBar() != NULL); // Select never translate this site. - PrefService* prefs = contents()->profile()->GetPrefs(); + Profile* profile = Profile::FromBrowserContext(contents()->browser_context()); + PrefService* prefs = profile->GetPrefs(); PrefChangeRegistrar registrar; registrar.Init(prefs); registrar.Add(TranslatePrefs::kPrefTranslateSiteBlacklist, @@ -1028,7 +1032,8 @@ TEST_F(TranslateManagerTest, NeverTranslateSitePref) { // Tests the "Always translate this language" pref. TEST_F(TranslateManagerTest, AlwaysTranslateLanguagePref) { // Select always translate French to English. - PrefService* prefs = contents()->profile()->GetPrefs(); + Profile* profile = Profile::FromBrowserContext(contents()->browser_context()); + PrefService* prefs = profile->GetPrefs(); PrefChangeRegistrar registrar; registrar.Init(prefs); registrar.Add(TranslatePrefs::kPrefTranslateWhitelists, @@ -1064,7 +1069,7 @@ TEST_F(TranslateManagerTest, AlwaysTranslateLanguagePref) { // Let's switch to incognito mode, it should not be autotranslated in that // case either. TestingProfile* test_profile = - static_cast<TestingProfile*>(contents()->profile()); + static_cast<TestingProfile*>(contents()->browser_context()); test_profile->set_incognito(true); SimulateNavigation(GURL("http://www.youtube.fr"), "fr", true); EXPECT_FALSE(GetTranslateMessage(&page_id, &original_lang, &target_lang)); @@ -1087,7 +1092,8 @@ TEST_F(TranslateManagerTest, AlwaysTranslateLanguagePref) { TEST_F(TranslateManagerTest, ContextMenu) { // Blacklist www.google.fr and French for translation. GURL url("http://www.google.fr"); - TranslatePrefs translate_prefs(contents()->profile()->GetPrefs()); + Profile* profile = Profile::FromBrowserContext(contents()->browser_context()); + TranslatePrefs translate_prefs(profile->GetPrefs()); translate_prefs.BlacklistLanguage("fr"); translate_prefs.BlacklistSite(url.host()); EXPECT_TRUE(translate_prefs.IsLanguageBlacklisted("fr")); @@ -1194,7 +1200,8 @@ TEST_F(TranslateManagerTest, ContextMenu) { // translate" infobar when the translation is accepted/declined 3 times, // only when not in incognito mode. TEST_F(TranslateManagerTest, BeforeTranslateExtraButtons) { - TranslatePrefs translate_prefs(contents()->profile()->GetPrefs()); + Profile* profile = Profile::FromBrowserContext(contents()->browser_context()); + TranslatePrefs translate_prefs(profile->GetPrefs()); translate_prefs.ResetTranslationAcceptedCount("fr"); translate_prefs.ResetTranslationDeniedCount("fr"); translate_prefs.ResetTranslationAcceptedCount("de"); @@ -1204,7 +1211,7 @@ TEST_F(TranslateManagerTest, BeforeTranslateExtraButtons) { // shown in that case, then 4 times in normal mode. TranslateInfoBarDelegate* infobar; TestingProfile* test_profile = - static_cast<TestingProfile*>(contents()->profile()); + static_cast<TestingProfile*>(contents()->browser_context()); test_profile->set_incognito(true); for (int i = 0; i < 8; ++i) { SCOPED_TRACE(::testing::Message() << "Iteration " << i << diff --git a/chrome/browser/ui/find_bar/find_backend_unittest.cc b/chrome/browser/ui/find_bar/find_backend_unittest.cc index 7b4ae5e..2425021 100644 --- a/chrome/browser/ui/find_bar/find_backend_unittest.cc +++ b/chrome/browser/ui/find_bar/find_backend_unittest.cc @@ -27,7 +27,8 @@ class FindBackendTest : public TabContentsWrapperTestHarness { namespace { string16 FindPrepopulateText(TabContents* contents) { - return FindBarState::GetLastPrepopulateText(contents->profile()); + Profile* profile = Profile::FromBrowserContext(contents->browser_context()); + return FindBarState::GetLastPrepopulateText(profile); } } // end namespace diff --git a/chrome/browser/ui/gtk/collected_cookies_gtk.cc b/chrome/browser/ui/gtk/collected_cookies_gtk.cc index 15a4e86..107d819 100644 --- a/chrome/browser/ui/gtk/collected_cookies_gtk.cc +++ b/chrome/browser/ui/gtk/collected_cookies_gtk.cc @@ -238,8 +238,10 @@ GtkWidget* CollectedCookiesGtk::CreateAllowedPane() { } GtkWidget* CollectedCookiesGtk::CreateBlockedPane() { + TabContentsWrapper* wrapper = + TabContentsWrapper::GetCurrentWrapperForContents(tab_contents_); HostContentSettingsMap* host_content_settings_map = - tab_contents_->profile()->GetHostContentSettingsMap(); + wrapper->profile()->GetHostContentSettingsMap(); GtkWidget* cookie_list_vbox = gtk_vbox_new(FALSE, gtk_util::kControlSpacing); @@ -262,9 +264,7 @@ GtkWidget* CollectedCookiesGtk::CreateBlockedPane() { GTK_SHADOW_ETCHED_IN); gtk_box_pack_start(GTK_BOX(cookie_list_vbox), scroll_window, TRUE, TRUE, 0); - TabSpecificContentSettings* content_settings = - TabContentsWrapper::GetCurrentWrapperForContents(tab_contents_)-> - content_settings(); + TabSpecificContentSettings* content_settings = wrapper->content_settings(); blocked_cookies_tree_model_.reset( content_settings->GetBlockedCookiesTreeModel()); @@ -459,8 +459,10 @@ void CollectedCookiesGtk::AddExceptions(GtkTreeSelection* selection, if (!last_domain_name.empty()) multiple_domains_added = true; last_domain_name = origin_node->GetTitle(); + Profile* profile = + Profile::FromBrowserContext(tab_contents_->browser_context()); origin_node->CreateContentException( - tab_contents_->profile()->GetHostContentSettingsMap(), setting); + profile->GetHostContentSettingsMap(), setting); } } g_list_foreach(paths, reinterpret_cast<GFunc>(gtk_tree_path_free), NULL); diff --git a/chrome/browser/ui/gtk/constrained_html_delegate_gtk.cc b/chrome/browser/ui/gtk/constrained_html_delegate_gtk.cc index 445575d..9230621 100644 --- a/chrome/browser/ui/gtk/constrained_html_delegate_gtk.cc +++ b/chrome/browser/ui/gtk/constrained_html_delegate_gtk.cc @@ -4,6 +4,7 @@ #include "chrome/browser/ui/webui/constrained_html_ui.h" +#include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/gtk/constrained_window_gtk.h" #include "chrome/browser/ui/gtk/gtk_util.h" #include "chrome/browser/ui/gtk/tab_contents_container_gtk.h" diff --git a/chrome/browser/ui/gtk/html_dialog_gtk.cc b/chrome/browser/ui/gtk/html_dialog_gtk.cc index 11d933d..82216b2 100644 --- a/chrome/browser/ui/gtk/html_dialog_gtk.cc +++ b/chrome/browser/ui/gtk/html_dialog_gtk.cc @@ -7,6 +7,7 @@ #include <gtk/gtk.h> #include "base/utf_string_conversions.h" +#include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_dialogs.h" #include "chrome/browser/ui/browser_window.h" diff --git a/chrome/browser/ui/gtk/tabs/dragged_tab_gtk.cc b/chrome/browser/ui/gtk/tabs/dragged_tab_gtk.cc index 7f6294a..73f25e2 100644 --- a/chrome/browser/ui/gtk/tabs/dragged_tab_gtk.cc +++ b/chrome/browser/ui/gtk/tabs/dragged_tab_gtk.cc @@ -52,7 +52,7 @@ DraggedTabGtk::DraggedTabGtk(TabContents* datasource, bool mini) : data_source_(datasource), renderer_(new TabRendererGtk(ThemeServiceFactory::GetForProfile( - datasource->profile()))), + Profile::FromBrowserContext(datasource->browser_context())))), attached_(false), mouse_tab_offset_(mouse_tab_offset), attached_tab_size_(TabRendererGtk::GetMinimumSelectedSize()), diff --git a/chrome/browser/ui/gtk/tabs/tab_renderer_gtk.cc b/chrome/browser/ui/gtk/tabs/tab_renderer_gtk.cc index 4b87470..ad9e9681 100644 --- a/chrome/browser/ui/gtk/tabs/tab_renderer_gtk.cc +++ b/chrome/browser/ui/gtk/tabs/tab_renderer_gtk.cc @@ -295,7 +295,7 @@ void TabRendererGtk::UpdateData(TabContents* contents, if (!loading_only) { data_.title = contents->GetTitle(); - data_.incognito = contents->profile()->IsOffTheRecord(); + data_.incognito = contents->browser_context()->IsOffTheRecord(); data_.crashed = contents->is_crashed(); SkBitmap* app_icon = diff --git a/chrome/browser/ui/login/login_prompt_ui.cc b/chrome/browser/ui/login/login_prompt_ui.cc index 8c8440a..5de7e22 100644 --- a/chrome/browser/ui/login/login_prompt_ui.cc +++ b/chrome/browser/ui/login/login_prompt_ui.cc @@ -239,10 +239,12 @@ void LoginHandlerHtml::BuildViewForPasswordManager( LOG(INFO) << "BuildViewForPasswordManager"; TabContents* tab_contents = GetTabContentsForLogin(); - LoginHandlerSource::RegisterDataSource(tab_contents->profile()); + Profile* profile = + Profile::FromBrowserContext(tab_contents->browser_context()); + LoginHandlerSource::RegisterDataSource(profile); delegate_ = new LoginHandlerHtmlDelegate(this, tab_contents, explanation); ConstrainedWindow* dialog = ConstrainedHtmlUI::CreateConstrainedHtmlDialog( - tab_contents->profile(), delegate_, tab_contents); + profile, delegate_, tab_contents); SetModel(manager); SetDialog(dialog); diff --git a/chrome/browser/ui/views/collected_cookies_win.cc b/chrome/browser/ui/views/collected_cookies_win.cc index 7da33b4..45a89ce 100644 --- a/chrome/browser/ui/views/collected_cookies_win.cc +++ b/chrome/browser/ui/views/collected_cookies_win.cc @@ -286,12 +286,12 @@ views::View* CollectedCookiesWin::CreateAllowedPane() { } views::View* CollectedCookiesWin::CreateBlockedPane() { - TabSpecificContentSettings* content_settings = - TabContentsWrapper::GetCurrentWrapperForContents(tab_contents_)-> - content_settings(); + TabContentsWrapper* wrapper = + TabContentsWrapper::GetCurrentWrapperForContents(tab_contents_); + TabSpecificContentSettings* content_settings = wrapper->content_settings(); HostContentSettingsMap* host_content_settings_map = - tab_contents_->profile()->GetHostContentSettingsMap(); + wrapper->profile()->GetHostContentSettingsMap(); // Create the controls that go into the pane. blocked_label_ = new views::Label( @@ -483,8 +483,10 @@ void CollectedCookiesWin::AddContentException(views::TreeView* tree_view, ContentSetting setting) { CookieTreeOriginNode* origin_node = static_cast<CookieTreeOriginNode*>(tree_view->GetSelectedNode()); - origin_node->CreateContentException( - tab_contents_->profile()->GetHostContentSettingsMap(), setting); + Profile* profile = + Profile::FromBrowserContext(tab_contents_->browser_context()); + origin_node->CreateContentException(profile->GetHostContentSettingsMap(), + setting); infobar_->UpdateVisibility(true, setting, origin_node->GetTitle()); gfx::Rect bounds = GetWidget()->GetClientAreaScreenBounds(); // NativeWidgetWin::GetBounds returns the bounds relative to the parent diff --git a/chrome/browser/ui/views/constrained_window_views.cc b/chrome/browser/ui/views/constrained_window_views.cc index 344fd78..3fb90de 100644 --- a/chrome/browser/ui/views/constrained_window_views.cc +++ b/chrome/browser/ui/views/constrained_window_views.cc @@ -204,7 +204,7 @@ class ConstrainedWindowFrameView gfx::Rect CalculateClientAreaBounds(int width, int height) const; SkColor GetTitleColor() const { - return container_->owner()->profile()->IsOffTheRecord() + return container_->owner()->browser_context()->IsOffTheRecord() #if defined(OS_WIN) || !views::NativeWidgetWin::IsAeroGlassEnabled() #endif diff --git a/chrome/browser/ui/views/default_search_view.cc b/chrome/browser/ui/views/default_search_view.cc index 714edb47..da1a8c5 100644 --- a/chrome/browser/ui/views/default_search_view.cc +++ b/chrome/browser/ui/views/default_search_view.cc @@ -187,7 +187,9 @@ DefaultSearchView::DefaultSearchView(TabContents* tab_contents, proposed_provider_button_(NULL), proposed_turl_(proposed_default_turl), template_url_service_(template_url_service) { - PrefService* prefs = tab_contents->profile()->GetPrefs(); + Profile* profile = + Profile::FromBrowserContext(tab_contents->browser_context()); + PrefService* prefs = profile->GetPrefs(); SetupControls(prefs); // Show the dialog. diff --git a/chrome/browser/ui/views/dom_view.cc b/chrome/browser/ui/views/dom_view.cc index c19912f..7645cd7 100644 --- a/chrome/browser/ui/views/dom_view.cc +++ b/chrome/browser/ui/views/dom_view.cc @@ -4,6 +4,7 @@ #include "chrome/browser/ui/views/dom_view.h" +#include "chrome/browser/profiles/profile.h" #include "chrome/browser/renderer_preferences_util.h" #include "content/browser/tab_contents/tab_contents.h" #include "views/focus/focus_manager.h" diff --git a/chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc b/chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc index 6800ad2..7bca147 100644 --- a/chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc +++ b/chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc @@ -439,7 +439,7 @@ void BrowserTabStripController::SetTabRendererDataFromModel( data->url = contents->GetURL(); data->loading = contents->IsLoading(); data->crashed_status = contents->crashed_status(); - data->incognito = contents->profile()->IsOffTheRecord(); + data->incognito = contents->browser_context()->IsOffTheRecord(); data->show_icon = wrapper->favicon_tab_helper()->ShouldDisplayFavicon(); data->mini = model_->IsMiniTab(model_index); data->blocked = model_->IsTabBlocked(model_index); diff --git a/chrome/browser/ui/webui/active_downloads_ui.cc b/chrome/browser/ui/webui/active_downloads_ui.cc index a6faa09..816d323 100644 --- a/chrome/browser/ui/webui/active_downloads_ui.cc +++ b/chrome/browser/ui/webui/active_downloads_ui.cc @@ -382,7 +382,8 @@ ActiveDownloadsUI::ActiveDownloadsUI(TabContents* contents) ActiveDownloadsUIHTMLSource* html_source = new ActiveDownloadsUIHTMLSource(); // Set up the chrome://active-downloads/ source. - contents->profile()->GetChromeURLDataManager()->AddDataSource(html_source); + Profile* profile = Profile::FromBrowserContext(contents->browser_context()); + profile->GetChromeURLDataManager()->AddDataSource(html_source); } // static diff --git a/chrome/browser/ui/webui/chromeos/choose_mobile_network_ui.cc b/chrome/browser/ui/webui/chromeos/choose_mobile_network_ui.cc index 243221d..325ef6b 100644 --- a/chrome/browser/ui/webui/chromeos/choose_mobile_network_ui.cc +++ b/chrome/browser/ui/webui/chromeos/choose_mobile_network_ui.cc @@ -252,7 +252,8 @@ ChooseMobileNetworkUI::ChooseMobileNetworkUI(TabContents* contents) ChooseMobileNetworkHTMLSource* html_source = new ChooseMobileNetworkHTMLSource(); // Set up the "chrome://choose-mobile-network" source. - contents->profile()->GetChromeURLDataManager()->AddDataSource(html_source); + Profile* profile = Profile::FromBrowserContext(contents->browser_context()); + profile->GetChromeURLDataManager()->AddDataSource(html_source); } } // namespace chromeos diff --git a/chrome/browser/ui/webui/chromeos/enterprise_enrollment_ui.cc b/chrome/browser/ui/webui/chromeos/enterprise_enrollment_ui.cc index 71bfb67..2ea3a32 100644 --- a/chrome/browser/ui/webui/chromeos/enterprise_enrollment_ui.cc +++ b/chrome/browser/ui/webui/chromeos/enterprise_enrollment_ui.cc @@ -167,7 +167,9 @@ void EnterpriseEnrollmentUI::RenderViewCreated( ChromeURLDataManager::DataSource::SetFontAndTextDirection( localized_strings.get()); // Set up the data source, so the enrollment page can be loaded. - tab_contents()->profile()->GetChromeURLDataManager()->AddDataSource( + Profile* profile = + Profile::FromBrowserContext(tab_contents()->browser_context()); + profile->GetChromeURLDataManager()->AddDataSource( new EnterpriseEnrollmentDataSource(localized_strings.release())); } diff --git a/chrome/browser/ui/webui/chromeos/imageburner/imageburner_ui.cc b/chrome/browser/ui/webui/chromeos/imageburner/imageburner_ui.cc index e8bdd0b..9e54398 100644 --- a/chrome/browser/ui/webui/chromeos/imageburner/imageburner_ui.cc +++ b/chrome/browser/ui/webui/chromeos/imageburner/imageburner_ui.cc @@ -433,7 +433,7 @@ void WebUIHandler::OnConfigFileFetched(const ConfigFile& } if (!download_manager_) { - download_manager_ = tab_contents_->profile()->GetDownloadManager(); + download_manager_ = tab_contents_->browser_context()->GetDownloadManager(); download_manager_->AddObserver(this); } if (!state_machine_->download_started()) { @@ -668,5 +668,6 @@ ImageBurnUI::ImageBurnUI(TabContents* contents) : ChromeWebUI(contents) { imageburner::WebUIHandler* handler = new imageburner::WebUIHandler(contents); AddMessageHandler((handler)->Attach(this)); imageburner::UIHTMLSource* html_source = new imageburner::UIHTMLSource(); - contents->profile()->GetChromeURLDataManager()->AddDataSource(html_source); + Profile* profile = Profile::FromBrowserContext(contents->browser_context()); + profile->GetChromeURLDataManager()->AddDataSource(html_source); } diff --git a/chrome/browser/ui/webui/chromeos/imageburner/imageburner_utils.cc b/chrome/browser/ui/webui/chromeos/imageburner/imageburner_utils.cc index eec9b4a..ee7e03c 100644 --- a/chrome/browser/ui/webui/chromeos/imageburner/imageburner_utils.cc +++ b/chrome/browser/ui/webui/chromeos/imageburner/imageburner_utils.cc @@ -305,7 +305,7 @@ void BurnManager::FetchConfigFile(TabContents* tab_contents, config_file_requested_ = true; config_file_path_ = GetImageDir().Append(kConfigFileName); - download_manager_ = tab_contents->profile()->GetDownloadManager(); + download_manager_ = tab_contents->browser_context()->GetDownloadManager(); download_manager_->AddObserver(this); downloader()->AddListener(this, config_file_url_); downloader()->DownloadFile(config_file_url_, config_file_path_, tab_contents); @@ -429,7 +429,7 @@ void Downloader::OnFileStreamCreatedOnUIThread(const GURL& url, if (created_file_stream) { DownloadManager* download_manager = - tab_contents->profile()->GetDownloadManager(); + tab_contents->browser_context()->GetDownloadManager(); DownloadSaveInfo save_info; save_info.file_path = file_path; save_info.file_stream = linked_ptr<net::FileStream>(created_file_stream); diff --git a/chrome/browser/ui/webui/chromeos/keyboard_overlay_ui.cc b/chrome/browser/ui/webui/chromeos/keyboard_overlay_ui.cc index 51000d2..112d012 100644 --- a/chrome/browser/ui/webui/chromeos/keyboard_overlay_ui.cc +++ b/chrome/browser/ui/webui/chromeos/keyboard_overlay_ui.cc @@ -317,11 +317,12 @@ void KeyboardOverlayHandler::GetLabelMap(const ListValue* args) { KeyboardOverlayUI::KeyboardOverlayUI(TabContents* contents) : HtmlDialogUI(contents) { + Profile* profile = Profile::FromBrowserContext(contents->browser_context()); KeyboardOverlayHandler* handler = - new KeyboardOverlayHandler(contents->profile()); + new KeyboardOverlayHandler(profile); AddMessageHandler((handler)->Attach(this)); KeyboardOverlayUIHTMLSource* html_source = new KeyboardOverlayUIHTMLSource(); // Set up the chrome://keyboardoverlay/ source. - contents->profile()->GetChromeURLDataManager()->AddDataSource(html_source); + profile->GetChromeURLDataManager()->AddDataSource(html_source); } diff --git a/chrome/browser/ui/webui/chromeos/login/login_ui.cc b/chrome/browser/ui/webui/chromeos/login/login_ui.cc index 0b83815..c140263 100644 --- a/chrome/browser/ui/webui/chromeos/login/login_ui.cc +++ b/chrome/browser/ui/webui/chromeos/login/login_ui.cc @@ -74,20 +74,20 @@ LoginUI::LoginUI(TabContents* contents) AddMessageHandler(signin_screen_handler->Attach(this)); signin_screen_handler->GetLocalizedStrings(localized_strings.get()); + Profile* profile = Profile::FromBrowserContext(contents->browser_context()); LoginUIHTMLSource* html_source = new LoginUIHTMLSource(localized_strings.release()); - contents->profile()->GetChromeURLDataManager()->AddDataSource(html_source); + profile->GetChromeURLDataManager()->AddDataSource(html_source); // Load the theme URLs. - ThemeSource* theme = new ThemeSource(contents->profile()); - contents->profile()->GetChromeURLDataManager()->AddDataSource(theme); + ThemeSource* theme = new ThemeSource(profile); + profile->GetChromeURLDataManager()->AddDataSource(theme); // Load the user-image URLs // Set up the chrome://userimage/ source. chromeos::UserImageSource* user_image_source = new chromeos::UserImageSource(); - contents->profile()->GetChromeURLDataManager()->AddDataSource( - user_image_source); + profile->GetChromeURLDataManager()->AddDataSource(user_image_source); } } // namespace chromeos diff --git a/chrome/browser/ui/webui/chromeos/login/oobe_ui.cc b/chrome/browser/ui/webui/chromeos/login/oobe_ui.cc index e225c4d..4ec88d0 100644 --- a/chrome/browser/ui/webui/chromeos/login/oobe_ui.cc +++ b/chrome/browser/ui/webui/chromeos/login/oobe_ui.cc @@ -224,22 +224,21 @@ OobeUI::OobeUI(TabContents* contents) DictionaryValue* localized_strings = new DictionaryValue(); GetLocalizedStrings(localized_strings); + Profile* profile = Profile::FromBrowserContext(contents->browser_context()); // Set up the chrome://theme/ source, for Chrome logo. - ThemeSource* theme = new ThemeSource(contents->profile()); - contents->profile()->GetChromeURLDataManager()->AddDataSource(theme); + ThemeSource* theme = new ThemeSource(profile); + profile->GetChromeURLDataManager()->AddDataSource(theme); // Set up the chrome://terms/ data source, for EULA content. - InitializeAboutDataSource(chrome::kChromeUITermsHost, contents->profile()); + InitializeAboutDataSource(chrome::kChromeUITermsHost, profile); // Set up the chrome://oobe/ source. - OobeUIHTMLSource* html_source = - new OobeUIHTMLSource(localized_strings); - contents->profile()->GetChromeURLDataManager()->AddDataSource(html_source); + OobeUIHTMLSource* html_source = new OobeUIHTMLSource(localized_strings); + profile->GetChromeURLDataManager()->AddDataSource(html_source); // Set up the chrome://userimage/ source. UserImageSource* user_image_source = new UserImageSource(); - contents->profile()->GetChromeURLDataManager()->AddDataSource( - user_image_source); + profile->GetChromeURLDataManager()->AddDataSource(user_image_source); } void OobeUI::ShowScreen(WizardScreen* screen) { diff --git a/chrome/browser/ui/webui/chromeos/mobile_setup_ui.cc b/chrome/browser/ui/webui/chromeos/mobile_setup_ui.cc index 9bde86e..ef94964 100644 --- a/chrome/browser/ui/webui/chromeos/mobile_setup_ui.cc +++ b/chrome/browser/ui/webui/chromeos/mobile_setup_ui.cc @@ -1329,5 +1329,6 @@ MobileSetupUI::MobileSetupUI(TabContents* contents) : ChromeWebUI(contents) { new MobileSetupUIHTMLSource(service_path); // Set up the chrome://mobilesetup/ source. - contents->profile()->GetChromeURLDataManager()->AddDataSource(html_source); + Profile* profile = Profile::FromBrowserContext(contents->browser_context()); + profile->GetChromeURLDataManager()->AddDataSource(html_source); } diff --git a/chrome/browser/ui/webui/chromeos/proxy_settings_ui.cc b/chrome/browser/ui/webui/chromeos/proxy_settings_ui.cc index 6477137..4f0e51f 100644 --- a/chrome/browser/ui/webui/chromeos/proxy_settings_ui.cc +++ b/chrome/browser/ui/webui/chromeos/proxy_settings_ui.cc @@ -80,7 +80,8 @@ ProxySettingsUI::ProxySettingsUI(TabContents* contents) ProxySettingsHTMLSource* source = new ProxySettingsHTMLSource(localized_strings); - contents->profile()->GetChromeURLDataManager()->AddDataSource(source); + Profile* profile = Profile::FromBrowserContext(contents->browser_context()); + profile->GetChromeURLDataManager()->AddDataSource(source); } ProxySettingsUI::~ProxySettingsUI() { diff --git a/chrome/browser/ui/webui/chromeos/register_page_ui.cc b/chrome/browser/ui/webui/chromeos/register_page_ui.cc index 14480c8..19768ce 100644 --- a/chrome/browser/ui/webui/chromeos/register_page_ui.cc +++ b/chrome/browser/ui/webui/chromeos/register_page_ui.cc @@ -310,5 +310,6 @@ RegisterPageUI::RegisterPageUI(TabContents* contents) : ChromeWebUI(contents) { RegisterPageUIHTMLSource* html_source = new RegisterPageUIHTMLSource(); // Set up the chrome://register/ source. - contents->profile()->GetChromeURLDataManager()->AddDataSource(html_source); + Profile* profile = Profile::FromBrowserContext(contents->browser_context()); + profile->GetChromeURLDataManager()->AddDataSource(html_source); } diff --git a/chrome/browser/ui/webui/chromeos/sim_unlock_ui.cc b/chrome/browser/ui/webui/chromeos/sim_unlock_ui.cc index 7cea5a8..9e6e04f 100644 --- a/chrome/browser/ui/webui/chromeos/sim_unlock_ui.cc +++ b/chrome/browser/ui/webui/chromeos/sim_unlock_ui.cc @@ -656,7 +656,8 @@ SimUnlockUI::SimUnlockUI(TabContents* contents) : ChromeWebUI(contents) { SimUnlockUIHTMLSource* html_source = new SimUnlockUIHTMLSource(); // Set up the chrome://sim-unlock/ source. - contents->profile()->GetChromeURLDataManager()->AddDataSource(html_source); + Profile* profile = Profile::FromBrowserContext(contents->browser_context()); + profile->GetChromeURLDataManager()->AddDataSource(html_source); } } // namespace chromeos diff --git a/chrome/browser/ui/webui/chromeos/system_info_ui.cc b/chrome/browser/ui/webui/chromeos/system_info_ui.cc index 872e987..baa5fcf 100644 --- a/chrome/browser/ui/webui/chromeos/system_info_ui.cc +++ b/chrome/browser/ui/webui/chromeos/system_info_ui.cc @@ -178,5 +178,6 @@ SystemInfoUI::SystemInfoUI(TabContents* contents) : ChromeWebUI(contents) { SystemInfoUIHTMLSource* html_source = new SystemInfoUIHTMLSource(); // Set up the chrome://system/ source. - contents->profile()->GetChromeURLDataManager()->AddDataSource(html_source); + Profile* profile = Profile::FromBrowserContext(contents->browser_context()); + profile->GetChromeURLDataManager()->AddDataSource(html_source); } diff --git a/chrome/browser/ui/webui/collected_cookies_ui_delegate.cc b/chrome/browser/ui/webui/collected_cookies_ui_delegate.cc index ca18acb..86018d6 100644 --- a/chrome/browser/ui/webui/collected_cookies_ui_delegate.cc +++ b/chrome/browser/ui/webui/collected_cookies_ui_delegate.cc @@ -133,7 +133,9 @@ void CollectedCookiesSource::StartDataRequest(const std::string& path, void CollectedCookiesUIDelegate::Show(TabContents* tab_contents) { CollectedCookiesUIDelegate* delegate = new CollectedCookiesUIDelegate(tab_contents); - ConstrainedHtmlUI::CreateConstrainedHtmlDialog(tab_contents->profile(), + Profile* profile = + Profile::FromBrowserContext(tab_contents->browser_context()); + ConstrainedHtmlUI::CreateConstrainedHtmlDialog(profile, delegate, tab_contents); } @@ -142,11 +144,11 @@ CollectedCookiesUIDelegate::CollectedCookiesUIDelegate( TabContents* tab_contents) : tab_contents_(tab_contents), closed_(false) { - TabSpecificContentSettings* content_settings = - TabContentsWrapper::GetCurrentWrapperForContents(tab_contents)-> - content_settings(); + TabContentsWrapper* wrapper = + TabContentsWrapper::GetCurrentWrapperForContents(tab_contents); + TabSpecificContentSettings* content_settings = wrapper->content_settings(); HostContentSettingsMap* host_content_settings_map = - tab_contents_->profile()->GetHostContentSettingsMap(); + wrapper->profile()->GetHostContentSettingsMap(); registrar_.Add(this, chrome::NOTIFICATION_COLLECTED_COOKIES_SHOWN, Source<TabSpecificContentSettings>(content_settings)); @@ -158,7 +160,7 @@ CollectedCookiesUIDelegate::CollectedCookiesUIDelegate( CollectedCookiesSource* source = new CollectedCookiesSource( host_content_settings_map->BlockThirdPartyCookies()); - tab_contents->profile()->GetChromeURLDataManager()->AddDataSource(source); + wrapper->profile()->GetChromeURLDataManager()->AddDataSource(source); } CollectedCookiesUIDelegate::~CollectedCookiesUIDelegate() { @@ -227,8 +229,10 @@ void CollectedCookiesUIDelegate::SetInfobarLabel(const std::string& text) { void CollectedCookiesUIDelegate::AddContentException( CookieTreeOriginNode* origin_node, ContentSetting setting) { if (origin_node->CanCreateContentException()) { - origin_node->CreateContentException( - tab_contents_->profile()->GetHostContentSettingsMap(), setting); + Profile* profile = + Profile::FromBrowserContext(tab_contents_->browser_context()); + origin_node->CreateContentException(profile->GetHostContentSettingsMap(), + setting); SetInfobarLabel(GetInfobarLabel(setting, origin_node->GetTitle())); } diff --git a/chrome/browser/ui/webui/conflicts_ui.cc b/chrome/browser/ui/webui/conflicts_ui.cc index a3d5296..4c1d3ea 100644 --- a/chrome/browser/ui/webui/conflicts_ui.cc +++ b/chrome/browser/ui/webui/conflicts_ui.cc @@ -157,7 +157,8 @@ ConflictsUI::ConflictsUI(TabContents* contents) : ChromeWebUI(contents) { AddMessageHandler((new ConflictsDOMHandler())->Attach(this)); // Set up the about:conflicts source. - contents->profile()->GetChromeURLDataManager()->AddDataSource( + Profile* profile = Profile::FromBrowserContext(contents->browser_context()); + profile->GetChromeURLDataManager()->AddDataSource( CreateConflictsUIHTMLSource()); } diff --git a/chrome/browser/ui/webui/new_profile_ui.cc b/chrome/browser/ui/webui/new_profile_ui.cc index 1f6ba0a..9bda595 100644 --- a/chrome/browser/ui/webui/new_profile_ui.cc +++ b/chrome/browser/ui/webui/new_profile_ui.cc @@ -96,8 +96,9 @@ NewProfileUI::NewProfileUI(TabContents* contents) : ChromeWebUI(contents) { handler->Attach(this); // Set up the chrome://theme/ source. - ThemeSource* theme = new ThemeSource(contents->profile()); - contents->profile()->GetChromeURLDataManager()->AddDataSource(theme); + Profile* profile = Profile::FromBrowserContext(contents->browser_context()); + ThemeSource* theme = new ThemeSource(profile); + profile->GetChromeURLDataManager()->AddDataSource(theme); // Set up the new profile source. NewProfileUIHTMLSource* html_source = @@ -105,5 +106,5 @@ NewProfileUI::NewProfileUI(TabContents* contents) : ChromeWebUI(contents) { html_source->set_json_path(kStringsJsFile); html_source->add_resource_path(kNewProfileJsFile, IDR_NEW_PROFILE_JS); html_source->set_default_resource(IDR_NEW_PROFILE_HTML); - contents->profile()->GetChromeURLDataManager()->AddDataSource(html_source); + profile->GetChromeURLDataManager()->AddDataSource(html_source); } diff --git a/chrome/browser/ui/webui/options/options_ui.cc b/chrome/browser/ui/webui/options/options_ui.cc index de75ec6..ede0fcd 100644 --- a/chrome/browser/ui/webui/options/options_ui.cc +++ b/chrome/browser/ui/webui/options/options_ui.cc @@ -260,18 +260,18 @@ OptionsUI::OptionsUI(TabContents* contents) new OptionsUIHTMLSource(localized_strings); // Set up the chrome://settings/ source. - contents->profile()->GetChromeURLDataManager()->AddDataSource(html_source); + Profile* profile = Profile::FromBrowserContext(contents->browser_context()); + profile->GetChromeURLDataManager()->AddDataSource(html_source); // Set up the chrome://theme/ source. - ThemeSource* theme = new ThemeSource(contents->profile()); - contents->profile()->GetChromeURLDataManager()->AddDataSource(theme); + ThemeSource* theme = new ThemeSource(profile); + profile->GetChromeURLDataManager()->AddDataSource(theme); #if defined(OS_CHROMEOS) // Set up the chrome://userimage/ source. chromeos::UserImageSource* user_image_source = new chromeos::UserImageSource(); - contents->profile()->GetChromeURLDataManager()->AddDataSource( - user_image_source); + profile->GetChromeURLDataManager()->AddDataSource(user_image_source); #endif } diff --git a/chrome/browser/ui/webui/plugins_ui.cc b/chrome/browser/ui/webui/plugins_ui.cc index d7ab1b0..397e6fc 100644 --- a/chrome/browser/ui/webui/plugins_ui.cc +++ b/chrome/browser/ui/webui/plugins_ui.cc @@ -305,11 +305,11 @@ PluginsUI::PluginsUI(TabContents* contents) : ChromeWebUI(contents) { // Set up the chrome://plugins/ source. bool enable_controls = true; + Profile* profile = Profile::FromBrowserContext(contents->browser_context()); #if !defined(OS_CHROMEOS) - enable_controls = contents->profile()->GetOriginalProfile()-> - first_launched(); + enable_controls = profile->GetOriginalProfile()->first_launched(); #endif - contents->profile()->GetChromeURLDataManager()->AddDataSource( + profile->GetChromeURLDataManager()->AddDataSource( CreatePluginsUIHTMLSource(enable_controls)); } diff --git a/chrome/browser/ui/webui/test_chrome_web_ui_factory.cc b/chrome/browser/ui/webui/test_chrome_web_ui_factory.cc index c4a51d9..3176cd1 100644 --- a/chrome/browser/ui/webui/test_chrome_web_ui_factory.cc +++ b/chrome/browser/ui/webui/test_chrome_web_ui_factory.cc @@ -37,7 +37,9 @@ WebUI::TypeID TestChromeWebUIFactory::GetWebUIType( WebUI* TestChromeWebUIFactory::CreateWebUIForURL(TabContents* tab_contents, const GURL& url) const { - WebUIProvider* provider = GetWebUIProvider(tab_contents->profile(), url); + Profile* profile = + Profile::FromBrowserContext(tab_contents->browser_context()); + WebUIProvider* provider = GetWebUIProvider(profile, url); return provider ? provider->NewWebUI(tab_contents, url) : ChromeWebUIFactory::CreateWebUIForURL(tab_contents, url); } diff --git a/chrome/browser/ui/webui/web_ui_unittest.cc b/chrome/browser/ui/webui/web_ui_unittest.cc index 93578fc..e027039 100644 --- a/chrome/browser/ui/webui/web_ui_unittest.cc +++ b/chrome/browser/ui/webui/web_ui_unittest.cc @@ -158,8 +158,9 @@ TEST_F(WebUITest, StandardToWebUI) { class TabContentsForFocusTest : public TestTabContents { public: - TabContentsForFocusTest(Profile* profile, SiteInstance* instance) - : TestTabContents(profile, instance), focus_called_(0) { + TabContentsForFocusTest(content::BrowserContext* browser_context, + SiteInstance* instance) + : TestTabContents(browser_context, instance), focus_called_(0) { } virtual void SetFocusToLocationBar(bool select_all) { ++focus_called_; } @@ -172,8 +173,8 @@ class TabContentsForFocusTest : public TestTabContents { TEST_F(WebUITest, FocusOnNavigate) { // Setup. |tc| will be used to track when we try to focus the location bar. TabContentsForFocusTest* tc = new TabContentsForFocusTest( - contents()->profile(), - SiteInstance::CreateSiteInstance(contents()->profile())); + contents()->browser_context(), + SiteInstance::CreateSiteInstance(contents()->browser_context())); tc->controller().CopyStateFrom(controller()); SetContents(tc); int page_id = 200; diff --git a/content/browser/tab_contents/tab_contents.h b/content/browser/tab_contents/tab_contents.h index a2eb522..20d7e45 100644 --- a/content/browser/tab_contents/tab_contents.h +++ b/content/browser/tab_contents/tab_contents.h @@ -15,7 +15,6 @@ #include "base/memory/scoped_ptr.h" #include "base/observer_list.h" #include "base/string16.h" -#include "chrome/browser/profiles/profile.h" #include "content/browser/download/save_package.h" #include "content/browser/javascript_dialogs.h" #include "content/browser/renderer_host/render_view_host_delegate.h" @@ -108,12 +107,6 @@ class TabContents : public PageNavigator, return controller_.browser_context(); } - // Returns the profile. - // TEMPORARY; http://crbug.com/76788 - Profile* profile() const { - return Profile::FromBrowserContext(browser_context()); - } - // Returns the SavePackage which manages the page saving job. May be NULL. SavePackage* save_package() const { return save_package_.get(); } diff --git a/content/browser/tab_contents/test_tab_contents.cc b/content/browser/tab_contents/test_tab_contents.cc index d9eef10..4252114 100644 --- a/content/browser/tab_contents/test_tab_contents.cc +++ b/content/browser/tab_contents/test_tab_contents.cc @@ -13,8 +13,9 @@ #include "content/browser/site_instance.h" #include "content/common/page_transition_types.h" -TestTabContents::TestTabContents(Profile* profile, SiteInstance* instance) - : TabContents(profile, instance, MSG_ROUTING_NONE, NULL, NULL), +TestTabContents::TestTabContents(content::BrowserContext* browser_context, + SiteInstance* instance) + : TabContents(browser_context, instance, MSG_ROUTING_NONE, NULL, NULL), transition_cross_site(false), delegate_view_override_(NULL) { } @@ -33,7 +34,7 @@ bool TestTabContents::CreateRenderViewForRenderManager( TabContents* TestTabContents::Clone() { TabContents* tc = new TestTabContents( - profile(), SiteInstance::CreateSiteInstance(profile())); + browser_context(), SiteInstance::CreateSiteInstance(browser_context())); tc->controller().CopyStateFrom(controller_); return tc; } @@ -43,7 +44,7 @@ void TestTabContents::NavigateAndCommit(const GURL& url) { GURL loaded_url(url); bool reverse_on_redirect = false; BrowserURLHandler::GetInstance()->RewriteURLIfNecessary( - &loaded_url, profile(), &reverse_on_redirect); + &loaded_url, browser_context(), &reverse_on_redirect); // LoadURL created a navigation entry, now simulate the RenderView sending // a notification that it actually navigated. diff --git a/content/browser/tab_contents/test_tab_contents.h b/content/browser/tab_contents/test_tab_contents.h index 9b7c565..fb7b1bc 100644 --- a/content/browser/tab_contents/test_tab_contents.h +++ b/content/browser/tab_contents/test_tab_contents.h @@ -9,15 +9,14 @@ #include "content/browser/tab_contents/tab_contents.h" #include "webkit/glue/webpreferences.h" -class Profile; class TestRenderViewHost; // Subclass TabContents to ensure it creates TestRenderViewHosts and does // not do anything involving views. class TestTabContents : public TabContents { public: - // The render view host factory will be passed on to the - TestTabContents(Profile* profile, SiteInstance* instance); + TestTabContents(content::BrowserContext* browser_context, + SiteInstance* instance); TestRenderViewHost* pending_rvh() const; |