| // Copyright (c) 2012 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. |
| |
| #include "chrome/browser/profiles/profile.h" |
| |
| #include "content/public/browser/web_contents.h" |
| #include "content/public/browser/web_ui.h" |
| |
| Profile* Profile::FromBrowserContext(content::BrowserContext* browser_context) { |
| // This is safe; this is the only implementation of the browser context. |
| return static_cast<Profile*>(browser_context); |
| } |
| |
| // static |
| Profile* Profile::FromWebUI(content::WebUI* web_ui) { |
| return FromBrowserContext(web_ui->GetWebContents()->GetBrowserContext()); |
| } |