Removal of Profile from content part 2.

BUG=76788
TEST=no change visible

Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=94332

Review URL: http://codereview.chromium.org/7480028

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@94347 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/chrome/browser/debugger/devtools_window.cc b/chrome/browser/debugger/devtools_window.cc
index eda78d8..367f7970 100644
--- a/chrome/browser/debugger/devtools_window.cc
+++ b/chrome/browser/debugger/devtools_window.cc
@@ -566,7 +566,8 @@
 
   bool do_open = force_open;
   if (!window) {
-    Profile* profile = inspected_rvh->process()->profile();
+    Profile* profile = Profile::FromBrowserContext(
+        inspected_rvh->process()->browser_context());
     bool docked = profile->GetPrefs()->GetBoolean(prefs::kDevToolsOpenDocked);
     window = new DevToolsWindow(profile, inspected_rvh, docked, false);
     manager->RegisterDevToolsClientHostFor(inspected_rvh, window);
diff --git a/chrome/browser/extensions/extension_event_router.cc b/chrome/browser/extensions/extension_event_router.cc
index 44561ce..7a9cb340 100644
--- a/chrome/browser/extensions/extension_event_router.cc
+++ b/chrome/browser/extensions/extension_event_router.cc
@@ -202,7 +202,7 @@
     // Is this event from a different profile than the renderer (ie, an
     // incognito tab event sent to a normal process, or vice versa).
     bool cross_incognito = restrict_to_profile &&
-        listener->process->profile() != restrict_to_profile;
+        listener->process->browser_context() != restrict_to_profile;
     const Extension* extension = service->GetExtensionById(
         listener->extension_id, false);
     // Send the event with different arguments to extensions that can't
diff --git a/chrome/browser/extensions/extension_function_dispatcher.cc b/chrome/browser/extensions/extension_function_dispatcher.cc
index 15529b2..f90868a 100644
--- a/chrome/browser/extensions/extension_function_dispatcher.cc
+++ b/chrome/browser/extensions/extension_function_dispatcher.cc
@@ -498,7 +498,8 @@
   // profile. Note that the profile may already be incognito, in which case
   // we will search the incognito version only, regardless of the value of
   // |include_incognito|.
-  Profile* profile = render_view_host->process()->profile();
+  Profile* profile = Profile::FromBrowserContext(
+      render_view_host->process()->browser_context());
   browser = BrowserList::FindTabbedBrowser(profile, include_incognito);
 
   // NOTE(rafaelw): This can return NULL in some circumstances. In particular,
diff --git a/chrome/browser/extensions/extension_message_handler.cc b/chrome/browser/extensions/extension_message_handler.cc
index 7595082..8895530 100644
--- a/chrome/browser/extensions/extension_message_handler.cc
+++ b/chrome/browser/extensions/extension_message_handler.cc
@@ -37,7 +37,8 @@
 
 void ExtensionMessageHandler::OnPostMessage(int port_id,
                                             const std::string& message) {
-  Profile* profile = render_view_host()->process()->profile();
+  Profile* profile = Profile::FromBrowserContext(
+      render_view_host()->process()->browser_context());
   if (profile->GetExtensionMessageService()) {
     profile->GetExtensionMessageService()->PostMessageFromRenderer(
         port_id, message);
diff --git a/chrome/browser/extensions/extension_message_service.cc b/chrome/browser/extensions/extension_message_service.cc
index 0dd960d..58400e5 100644
--- a/chrome/browser/extensions/extension_message_service.cc
+++ b/chrome/browser/extensions/extension_message_service.cc
@@ -143,12 +143,13 @@
   RenderProcessHost* source = RenderProcessHost::FromID(source_process_id);
   if (!source)
     return;
+  Profile* profile = Profile::FromBrowserContext(source->browser_context());
 
   // Note: we use the source's profile here. If the source is an incognito
   // process, we will use the incognito EPM to find the right extension process,
   // which depends on whether the extension uses spanning or split mode.
   MessagePort receiver(
-      source->profile()->GetExtensionProcessManager()->GetExtensionProcess(
+      profile->GetExtensionProcessManager()->GetExtensionProcess(
           target_extension_id),
       MSG_ROUTING_CONTROL);
   TabContents* source_contents = tab_util::GetTabContentsByID(
@@ -173,10 +174,11 @@
   RenderProcessHost* source = RenderProcessHost::FromID(source_process_id);
   if (!source)
     return;
+  Profile* profile = Profile::FromBrowserContext(source->browser_context());
 
   TabContentsWrapper* contents = NULL;
   MessagePort receiver;
-  if (ExtensionTabUtil::GetTabById(tab_id, source->profile(), true,
+  if (ExtensionTabUtil::GetTabById(tab_id, profile, true,
                                    NULL, NULL, &contents, NULL)) {
     receiver.sender = contents->render_view_host();
     receiver.routing_id = contents->render_view_host()->routing_id();
diff --git a/chrome/browser/extensions/extension_permissions_api.cc b/chrome/browser/extensions/extension_permissions_api.cc
index 87a413b0..e0418c8 100644
--- a/chrome/browser/extensions/extension_permissions_api.cc
+++ b/chrome/browser/extensions/extension_permissions_api.cc
@@ -183,7 +183,8 @@
   for (RenderProcessHost::iterator i(RenderProcessHost::AllHostsIterator());
        !i.IsAtEnd(); i.Advance()) {
     RenderProcessHost* host = i.GetCurrentValue();
-    if (extension_service_->profile()->IsSameProfile(host->profile()))
+    Profile* profile = Profile::FromBrowserContext(host->browser_context());
+    if (extension_service_->profile()->IsSameProfile(profile))
       host->Send(new ExtensionMsg_UpdatePermissions(
           extension->id(),
           active->apis(),
diff --git a/chrome/browser/extensions/extension_process_manager.cc b/chrome/browser/extensions/extension_process_manager.cc
index 1944478..9dc02d4 100644
--- a/chrome/browser/extensions/extension_process_manager.cc
+++ b/chrome/browser/extensions/extension_process_manager.cc
@@ -132,8 +132,9 @@
     const GURL& url, Browser* browser, ViewType::Type view_type) {
   // A NULL browser may only be given for pop-up views.
   DCHECK(browser || (!browser && view_type == ViewType::EXTENSION_POPUP));
-  ExtensionService* service =
-      browsing_instance_->profile()->GetExtensionService();
+  Profile* profile =
+      Profile::FromBrowserContext(browsing_instance_->browser_context());
+  ExtensionService* service = profile->GetExtensionService();
   if (service) {
     const Extension* extension = service->GetExtensionByURL(url);
     if (extension)
@@ -198,8 +199,9 @@
   // Force the options page to open in non-OTR window, because it won't be
   // able to save settings from OTR.
   if (!browser || browser->profile()->IsOffTheRecord()) {
-    browser = Browser::GetOrCreateTabbedBrowser(
-        browsing_instance_->profile()->GetOriginalProfile());
+    Profile* profile =
+        Profile::FromBrowserContext(browsing_instance_->browser_context());
+    browser = Browser::GetOrCreateTabbedBrowser(profile->GetOriginalProfile());
   }
 
   browser->OpenURL(extension->options_url(), GURL(), SINGLETON_TAB,
@@ -262,8 +264,9 @@
   if (it != extension_ids_.end()) {
     // Look up the extension by ID, including disabled extensions in case
     // this gets called while an old process is still around.
-    ExtensionService* service =
-        browsing_instance_->profile()->GetExtensionService();
+    Profile* profile =
+        Profile::FromBrowserContext(browsing_instance_->browser_context());
+    ExtensionService* service = profile->GetExtensionService();
     return service->GetExtensionById(it->second, false);
   }
 
@@ -342,7 +345,7 @@
 
 void ExtensionProcessManager::OnExtensionHostCreated(ExtensionHost* host,
                                                      bool is_background) {
-  DCHECK_EQ(browsing_instance_->profile(), host->profile());
+  DCHECK_EQ(browsing_instance_->browser_context(), host->profile());
 
   all_hosts_.insert(host);
   if (is_background)
@@ -442,8 +445,9 @@
 
 const Extension* IncognitoExtensionProcessManager::GetExtensionOrAppByURL(
     const GURL& url) {
-  ExtensionService* service =
-      browsing_instance_->profile()->GetExtensionService();
+  Profile* profile =
+      Profile::FromBrowserContext(browsing_instance_->browser_context());
+  ExtensionService* service = profile->GetExtensionService();
   if (!service)
     return NULL;
   return (url.SchemeIs(chrome::kExtensionScheme)) ?
@@ -452,8 +456,9 @@
 
 bool IncognitoExtensionProcessManager::IsIncognitoEnabled(
     const Extension* extension) {
-  ExtensionService* service =
-      browsing_instance_->profile()->GetExtensionService();
+  Profile* profile =
+      Profile::FromBrowserContext(browsing_instance_->browser_context());
+  ExtensionService* service = profile->GetExtensionService();
   return service && service->IsIncognitoEnabled(extension->id());
 }
 
@@ -467,12 +472,13 @@
       // incognito window. Watch for new browsers and create the hosts if
       // it matches our profile.
       Browser* browser = Source<Browser>(source).ptr();
-      if (browser->profile() == browsing_instance_->profile()) {
+      if (browser->profile() == browsing_instance_->browser_context()) {
         // On Chrome OS, a login screen is implemented as a browser.
         // This browser has no extension service.  In this case,
         // service will be NULL.
-        ExtensionService* service =
-            browsing_instance_->profile()->GetExtensionService();
+        Profile* profile =
+            Profile::FromBrowserContext(browsing_instance_->browser_context());
+        ExtensionService* service = profile->GetExtensionService();
         if (service && service->is_ready())
           CreateBackgroundHosts(this, service->extensions());
       }
diff --git a/chrome/browser/extensions/extension_service.cc b/chrome/browser/extensions/extension_service.cc
index 72667a1..ffb87e06 100644
--- a/chrome/browser/extensions/extension_service.cc
+++ b/chrome/browser/extensions/extension_service.cc
@@ -1363,8 +1363,9 @@
   for (RenderProcessHost::iterator i(RenderProcessHost::AllHostsIterator());
        !i.IsAtEnd(); i.Advance()) {
     RenderProcessHost* host = i.GetCurrentValue();
-    if (host->profile()->GetOriginalProfile() ==
-        profile_->GetOriginalProfile()) {
+    Profile* host_profile =
+        Profile::FromBrowserContext(host->browser_context());
+    if (host_profile->GetOriginalProfile() == profile_->GetOriginalProfile()) {
       host->Send(
           new ExtensionMsg_Loaded(ExtensionMsg_Loaded_Params(
               extension, extension->GetActivePermissions())));
@@ -1460,10 +1461,10 @@
   for (RenderProcessHost::iterator i(RenderProcessHost::AllHostsIterator());
        !i.IsAtEnd(); i.Advance()) {
     RenderProcessHost* host = i.GetCurrentValue();
-    if (host->profile()->GetOriginalProfile() ==
-        profile_->GetOriginalProfile()) {
+    Profile* host_profile =
+        Profile::FromBrowserContext(host->browser_context());
+    if (host_profile->GetOriginalProfile() == profile_->GetOriginalProfile())
       host->Send(new ExtensionMsg_Unloaded(extension->id()));
-    }
   }
 
   profile_->UnregisterExtensionWithRequestContexts(extension->id(), reason);
diff --git a/chrome/browser/extensions/extensions_ui.cc b/chrome/browser/extensions/extensions_ui.cc
index 8eb68c83..c10ad0de 100644
--- a/chrome/browser/extensions/extensions_ui.cc
+++ b/chrome/browser/extensions/extensions_ui.cc
@@ -757,8 +757,9 @@
       continue;
     }
 
-    result->push_back(ExtensionPage(url, process->id(), host->routing_id(),
-                                    process->profile()->IsOffTheRecord()));
+    result->push_back(
+        ExtensionPage(url, process->id(), host->routing_id(),
+                      process->browser_context()->IsOffTheRecord()));
   }
 }
 
diff --git a/chrome/browser/extensions/user_script_master.cc b/chrome/browser/extensions/user_script_master.cc
index 758700c..8267b78e 100644
--- a/chrome/browser/extensions/user_script_master.cc
+++ b/chrome/browser/extensions/user_script_master.cc
@@ -363,8 +363,9 @@
 
 void UserScriptMaster::SendUpdate(RenderProcessHost* process,
                                   base::SharedMemory* shared_memory) {
+  Profile* profile = Profile::FromBrowserContext(process->browser_context());
   // Make sure we only send user scripts to processes in our profile.
-  if (!profile_->IsSameProfile(process->profile()))
+  if (!profile_->IsSameProfile(profile))
     return;
 
   // If the process is being started asynchronously, early return.  We'll end up
diff --git a/chrome/browser/memory_details.cc b/chrome/browser/memory_details.cc
index 8d26788..7649775 100644
--- a/chrome/browser/memory_details.cc
+++ b/chrome/browser/memory_details.cc
@@ -135,7 +135,8 @@
         continue;
       }
       process.type = ChildProcessInfo::RENDER_PROCESS;
-      Profile* profile = render_process_host->profile();
+      Profile* profile =
+          Profile::FromBrowserContext(render_process_host->browser_context());
       ExtensionService* extension_service = profile->GetExtensionService();
 
       // The RenderProcessHost may host multiple TabContents.  Any
diff --git a/chrome/browser/spellcheck_host_impl.cc b/chrome/browser/spellcheck_host_impl.cc
index e0f9fd2..f490e0d 100644
--- a/chrome/browser/spellcheck_host_impl.cc
+++ b/chrome/browser/spellcheck_host_impl.cc
@@ -143,7 +143,8 @@
 void SpellCheckHostImpl::InitForRenderer(RenderProcessHost* process) {
   DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
 
-  PrefService* prefs = process->profile()->GetPrefs();
+  Profile* profile = Profile::FromBrowserContext(process->browser_context());
+  PrefService* prefs = profile->GetPrefs();
   IPC::PlatformFileForTransit file;
 
   if (GetDictionaryFile() != base::kInvalidPlatformFileValue) {
diff --git a/chrome/browser/spellcheck_message_filter.cc b/chrome/browser/spellcheck_message_filter.cc
index 54de49e..483d560 100644
--- a/chrome/browser/spellcheck_message_filter.cc
+++ b/chrome/browser/spellcheck_message_filter.cc
@@ -94,7 +94,7 @@
   RenderProcessHost* host = RenderProcessHost::FromID(render_process_id_);
   if (!host)
     return;  // Teardown.
-  Profile* profile = host->profile();
+  Profile* profile = Profile::FromBrowserContext(host->browser_context());
   // The renderer has requested that we initialize its spellchecker. This should
   // generally only be called once per session, as after the first call, all
   // future renderers will be passed the initialization information on startup
@@ -117,7 +117,8 @@
   if (!host)
     return;  // Teardown.
   // Delegates to SpellCheckHost which tracks the stats of our spellchecker.
-  SpellCheckHost* spellcheck_host = host->profile()->GetSpellCheckHost();
+  Profile* profile = Profile::FromBrowserContext(host->browser_context());
+  SpellCheckHost* spellcheck_host = profile->GetSpellCheckHost();
   if (spellcheck_host && spellcheck_host->GetMetrics())
     spellcheck_host->GetMetrics()->RecordCheckedWordStats(word, misspelled);
 }
diff --git a/chrome/browser/tab_contents/background_contents.cc b/chrome/browser/tab_contents/background_contents.cc
index 66c20a9..0c78a80 100644
--- a/chrome/browser/tab_contents/background_contents.cc
+++ b/chrome/browser/tab_contents/background_contents.cc
@@ -52,7 +52,8 @@
 BackgroundContents::~BackgroundContents() {
   if (!render_view_host_)   // Will be null for unit tests.
     return;
-  Profile* profile = render_view_host_->process()->profile();
+  Profile* profile = Profile::FromBrowserContext(
+      render_view_host_->process()->browser_context());
   NotificationService::current()->Notify(
       chrome::NOTIFICATION_BACKGROUND_CONTENTS_DELETED,
       Source<Profile>(profile),
@@ -92,7 +93,8 @@
   // extent a background page will be opened but will remain at about:blank.
   url_ = params.url;
 
-  Profile* profile = render_view_host->process()->profile();
+  Profile* profile = Profile::FromBrowserContext(
+      render_view_host->process()->browser_context());
   NotificationService::current()->Notify(
       chrome::NOTIFICATION_BACKGROUND_CONTENTS_NAVIGATED,
       Source<Profile>(profile),
@@ -147,7 +149,8 @@
 }
 
 void BackgroundContents::Close(RenderViewHost* render_view_host) {
-  Profile* profile = render_view_host->process()->profile();
+  Profile* profile = Profile::FromBrowserContext(
+      render_view_host->process()->browser_context());
   NotificationService::current()->Notify(
       chrome::NOTIFICATION_BACKGROUND_CONTENTS_CLOSED,
       Source<Profile>(profile),
@@ -158,7 +161,8 @@
 void BackgroundContents::RenderViewGone(RenderViewHost* rvh,
                                         base::TerminationStatus status,
                                         int error_code) {
-  Profile* profile = rvh->process()->profile();
+  Profile* profile =
+      Profile::FromBrowserContext(rvh->process()->browser_context());
   NotificationService::current()->Notify(
       chrome::NOTIFICATION_BACKGROUND_CONTENTS_TERMINATED,
       Source<Profile>(profile),
@@ -182,7 +186,8 @@
 WebPreferences BackgroundContents::GetWebkitPrefs() {
   // TODO(rafaelw): Consider enabling the webkit_prefs.dom_paste_enabled for
   // apps.
-  Profile* profile = render_view_host_->process()->profile();
+  Profile* profile = Profile::FromBrowserContext(
+      render_view_host_->process()->browser_context());
   return RenderViewHostDelegateHelper::GetWebkitPrefs(profile,
                                                       false);  // is_web_ui
 }
@@ -190,12 +195,13 @@
 void BackgroundContents::CreateNewWindow(
     int route_id,
     const ViewHostMsg_CreateWindow_Params& params) {
+  Profile* profile = Profile::FromBrowserContext(
+      render_view_host_->process()->browser_context());
   delegate_view_helper_.CreateNewWindow(
       route_id,
-      render_view_host_->process()->profile(),
+      profile,
       render_view_host_->site_instance(),
-      ChromeWebUIFactory::GetInstance()->GetWebUIType(
-          render_view_host_->process()->profile(), url_),
+      ChromeWebUIFactory::GetInstance()->GetWebUIType(profile, url_),
       this,
       params.window_container_type,
       params.frame_name);
diff --git a/chrome/browser/ui/cocoa/extensions/extension_popup_controller.mm b/chrome/browser/ui/cocoa/extensions/extension_popup_controller.mm
index 85bee4f..d5e22c3f 100644
--- a/chrome/browser/ui/cocoa/extensions/extension_popup_controller.mm
+++ b/chrome/browser/ui/cocoa/extensions/extension_popup_controller.mm
@@ -133,7 +133,7 @@
     registrar_.reset(new NotificationRegistrar);
     registrar_->Add(notificationBridge_.get(),
                     content::NOTIFICATION_DEVTOOLS_WINDOW_CLOSING,
-                    Source<Profile>(host->profile()));
+                    Source<content::BrowserContext>(host->profile()));
     registrar_->Add(notificationBridge_.get(),
                     chrome::NOTIFICATION_EXTENSION_HOST_DID_STOP_LOADING,
                     Source<Profile>(host->profile()));
diff --git a/chrome/browser/ui/gtk/extensions/extension_popup_gtk.cc b/chrome/browser/ui/gtk/extensions/extension_popup_gtk.cc
index ac258d7..84393dd 100644
--- a/chrome/browser/ui/gtk/extensions/extension_popup_gtk.cc
+++ b/chrome/browser/ui/gtk/extensions/extension_popup_gtk.cc
@@ -100,7 +100,7 @@
     DevToolsWindow::OpenDevToolsWindow(host_->render_view_host());
     // Listen for the the devtools window closing.
     registrar_.Add(this, content::NOTIFICATION_DEVTOOLS_WINDOW_CLOSING,
-        Source<Profile>(host_->profile()));
+        Source<content::BrowserContext>(host_->profile()));
   }
 
   // Only one instance should be showing at a time. Get rid of the old one, if
diff --git a/chrome/browser/ui/views/extensions/extension_popup.cc b/chrome/browser/ui/views/extensions/extension_popup.cc
index 9d1a5ad..4a2eec9 100644
--- a/chrome/browser/ui/views/extensions/extension_popup.cc
+++ b/chrome/browser/ui/views/extensions/extension_popup.cc
@@ -129,7 +129,7 @@
         if (inspect_with_devtools_) {
           // Listen for the the devtools window closing.
           registrar_.Add(this, content::NOTIFICATION_DEVTOOLS_WINDOW_CLOSING,
-              Source<Profile>(extension_host_->profile()));
+              Source<content::BrowserContext>(extension_host_->profile()));
           DevToolsWindow::ToggleDevToolsWindow(
               extension_host_->render_view_host(),
               DEVTOOLS_TOGGLE_ACTION_SHOW_CONSOLE);
diff --git a/chrome/browser/visitedlink/visitedlink_event_listener.cc b/chrome/browser/visitedlink/visitedlink_event_listener.cc
index cadfedb..13461d44 100644
--- a/chrome/browser/visitedlink/visitedlink_event_listener.cc
+++ b/chrome/browser/visitedlink/visitedlink_event_listener.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
@@ -122,7 +122,8 @@
   for (Updaters::iterator i = updaters_.begin(); i != updaters_.end(); ++i) {
     // Make sure to not send to incognito renderers.
     RenderProcessHost* process = RenderProcessHost::FromID(i->first);
-    VisitedLinkMaster* master = process->profile()->GetVisitedLinkMaster();
+    Profile* profile = Profile::FromBrowserContext(process->browser_context());
+    VisitedLinkMaster* master = profile->GetVisitedLinkMaster();
     if (master && master->shared_memory() == table_memory)
       i->second->SendVisitedLinkTable(table_memory);
   }
@@ -169,7 +170,9 @@
 
       // Initialize support for visited links. Send the renderer process its
       // initial set of visited links.
-      VisitedLinkMaster* master = process->profile()->GetVisitedLinkMaster();
+      Profile* profile =
+          Profile::FromBrowserContext(process->browser_context());
+      VisitedLinkMaster* master = profile->GetVisitedLinkMaster();
       if (!master)
         return;
 
diff --git a/chrome/browser/visitedlink/visitedlink_unittest.cc b/chrome/browser/visitedlink/visitedlink_unittest.cc
index 86362a1a..3af5113 100644
--- a/chrome/browser/visitedlink/visitedlink_unittest.cc
+++ b/chrome/browser/visitedlink/visitedlink_unittest.cc
@@ -524,7 +524,8 @@
 
   virtual bool Send(IPC::Message* msg) {
     VisitCountingProfile* counting_profile =
-        static_cast<VisitCountingProfile*>(profile());
+        static_cast<VisitCountingProfile*>(
+            Profile::FromBrowserContext(browser_context()));
 
     if (msg->type() == ViewMsg_VisitedLink_Add::ID) {
       void* iter = NULL;
diff --git a/content/browser/browsing_instance.h b/content/browser/browsing_instance.h
index 31a1cf4..b550659c 100644
--- a/content/browser/browsing_instance.h
+++ b/content/browser/browsing_instance.h
@@ -8,7 +8,6 @@
 
 #include "base/hash_tables.h"
 #include "base/memory/ref_counted.h"
-#include "chrome/browser/profiles/profile.h"
 
 class GURL;
 class SiteInstance;
@@ -70,12 +69,6 @@
   // Get the browser context to which this BrowsingInstance belongs.
   content::BrowserContext* browser_context() { return browser_context_; }
 
-  // Returns the profile.
-  // TEMPORARY; http://crbug.com/76788
-  Profile* profile() {
-    return Profile::FromBrowserContext(browser_context());
-  }
-
   // Returns whether this BrowsingInstance has registered a SiteInstance for
   // the site of the given URL.
   bool HasSiteInstance(const GURL& url);
diff --git a/content/browser/debugger/devtools_manager.cc b/content/browser/debugger/devtools_manager.cc
index 01e6479..383d6c4 100644
--- a/content/browser/debugger/devtools_manager.cc
+++ b/content/browser/debugger/devtools_manager.cc
@@ -122,7 +122,8 @@
 
   NotificationService::current()->Notify(
       content::NOTIFICATION_DEVTOOLS_WINDOW_CLOSING,
-      Source<Profile>(inspected_rvh->site_instance()->GetProcess()->profile()),
+      Source<content::BrowserContext>(
+          inspected_rvh->site_instance()->GetProcess()->browser_context()),
       Details<RenderViewHost>(inspected_rvh));
 
   UnbindClientHost(inspected_rvh, host);
diff --git a/content/browser/renderer_host/render_process_host.h b/content/browser/renderer_host/render_process_host.h
index 0b3b3e9..569d55c9 100644
--- a/content/browser/renderer_host/render_process_host.h
+++ b/content/browser/renderer_host/render_process_host.h
@@ -13,7 +13,6 @@
 #include "base/process.h"
 #include "base/process_util.h"
 #include "base/time.h"
-#include "chrome/browser/profiles/profile.h"
 #include "ipc/ipc_channel_proxy.h"
 #include "ui/gfx/native_widget_types.h"
 #include "ui/gfx/surface/transport_dib.h"
@@ -74,12 +73,6 @@
   // Returns the user browser context associated with this renderer process.
   content::BrowserContext* browser_context() const { return browser_context_; }
 
-  // Returns the profile.
-  // TEMPORARY; http://crbug.com/76788
-  Profile* profile() const {
-    return Profile::FromBrowserContext(browser_context());
-  }
-
   // Returns the unique ID for this child process. This can be used later in
   // a call to FromID() to get back to this object (this is used to avoid
   // sending non-threadsafe pointers to other threads).
diff --git a/content/browser/renderer_host/render_view_host.cc b/content/browser/renderer_host/render_view_host.cc
index 9b1b9543..d7526b6 100644
--- a/content/browser/renderer_host/render_view_host.cc
+++ b/content/browser/renderer_host/render_view_host.cc
@@ -104,8 +104,8 @@
       save_accessibility_tree_for_testing_(false),
       render_view_termination_status_(base::TERMINATION_STATUS_STILL_RUNNING) {
   if (!session_storage_namespace_) {
-    session_storage_namespace_ =
-        new SessionStorageNamespace(process()->profile()->GetWebKitContext());
+    session_storage_namespace_ = new SessionStorageNamespace(
+        process()->browser_context()->GetWebKitContext());
   }
 
   DCHECK(instance_);
@@ -147,7 +147,7 @@
   if (!process()->Init(renderer_accessible()))
     return false;
   DCHECK(process()->HasConnection());
-  DCHECK(process()->profile());
+  DCHECK(process()->browser_context());
 
   if (BindingsPolicy::is_web_ui_enabled(enabled_bindings_)) {
     ChildProcessSecurityPolicy::GetInstance()->GrantWebUIBindings(
@@ -167,7 +167,7 @@
   ViewMsg_New_Params params;
   params.parent_window = GetNativeViewId();
   params.renderer_preferences =
-      delegate_->GetRendererPrefs(process()->profile());
+      delegate_->GetRendererPrefs(process()->browser_context());
   params.web_preferences = delegate_->GetWebkitPrefs();
   params.view_id = routing_id();
   params.session_storage_namespace_id = session_storage_namespace_->id();
@@ -193,7 +193,7 @@
 void RenderViewHost::SyncRendererPrefs() {
   Send(new ViewMsg_SetRendererPrefs(routing_id(),
                                     delegate_->GetRendererPrefs(
-                                        process()->profile())));
+                                        process()->browser_context())));
 }
 
 void RenderViewHost::Navigate(const ViewMsg_Navigate_Params& params) {
@@ -1260,14 +1260,15 @@
                                   bool remember,
                                   const GURL& url) {
   DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
-  HostZoomMap* host_zoom_map = process()->profile()->GetHostZoomMap();
+  HostZoomMap* host_zoom_map = process()->browser_context()->GetHostZoomMap();
   if (remember) {
     host_zoom_map->SetZoomLevel(net::GetHostOrSpecFromURL(url), zoom_level);
     // Notify renderers from this profile.
     for (RenderProcessHost::iterator i(RenderProcessHost::AllHostsIterator());
          !i.IsAtEnd(); i.Advance()) {
       RenderProcessHost* render_process_host = i.GetCurrentValue();
-      if (render_process_host->profile() == process()->profile()) {
+      if (render_process_host->browser_context() ==
+          process()->browser_context()) {
         render_process_host->Send(
             new ViewMsg_SetZoomLevelForCurrentURL(url, zoom_level));
       }
diff --git a/content/common/content_notification_types.h b/content/common/content_notification_types.h
index 78b0479..f136878 100644
--- a/content/common/content_notification_types.h
+++ b/content/common/content_notification_types.h
@@ -214,8 +214,8 @@
   //  The source and details are unspecified.
   NOTIFICATION_APP_EXITING,
 
-  // Indicates that a devtools window is closing. The source is the Profile*
-  // and the details is the inspected RenderViewHost*.
+  // Indicates that a devtools window is closing. The source is the
+  // content::BrowserContext* and the details is the inspected RenderViewHost*.
   NOTIFICATION_DEVTOOLS_WINDOW_CLOSING,
 
   // Tabs --------------------------------------------------------------------