summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorasvitkine@chromium.org <asvitkine@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-02-13 18:55:19 +0000
committerasvitkine@chromium.org <asvitkine@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-02-13 18:55:19 +0000
commitb882b2ee87dc7ba66f10393a9dd92406aee85247 (patch)
treef41161e3a3ba076a9f889186b8ba7f8ad4112642 /chrome
parentb33a48378ec5d1946331ca4edbb7e3403b7f4efd (diff)
downloadchromium_src-b882b2ee87dc7ba66f10393a9dd92406aee85247.zip
chromium_src-b882b2ee87dc7ba66f10393a9dd92406aee85247.tar.gz
chromium_src-b882b2ee87dc7ba66f10393a9dd92406aee85247.tar.bz2
Revert 250826 "Remove Profile dependency from apps::ShellWindow"
Speculative revert for failures: http://build.chromium.org/p/chromium.win/builders/Win7%20Sync%20x64/builds/11201 > Remove Profile dependency from apps::ShellWindow > > Part of the effort to remove src/chrome dependencies from src/{apps, extensions} > > BUG=341690 > TBR=tapted@chromium.org,stevenjb@chromium.org > > Review URL: https://codereview.chromium.org/157813007 TBR=rockot@chromium.org Review URL: https://codereview.chromium.org/163913004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@251094 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/extensions/api/app_window/app_window_api.cc1
-rw-r--r--chrome/browser/extensions/api/tabs/ash_panel_contents.cc16
-rw-r--r--chrome/browser/extensions/api/tabs/ash_panel_contents.h3
-rw-r--r--chrome/browser/extensions/chrome_extensions_browser_client.cc5
-rw-r--r--chrome/browser/extensions/chrome_extensions_browser_client.h1
-rw-r--r--chrome/browser/ui/apps/chrome_shell_window_delegate.cc14
-rw-r--r--chrome/browser/ui/apps/chrome_shell_window_delegate.h9
-rw-r--r--chrome/browser/ui/ash/launcher/multi_profile_shell_window_launcher_controller.cc12
-rw-r--r--chrome/browser/ui/cocoa/apps/native_app_window_cocoa.h1
-rw-r--r--chrome/browser/ui/cocoa/apps/native_app_window_cocoa.mm2
-rw-r--r--chrome/browser/ui/cocoa/apps/native_app_window_cocoa_browsertest.mm7
-rw-r--r--chrome/browser/ui/gtk/apps/native_app_window_gtk.cc5
-rw-r--r--chrome/browser/ui/gtk/apps/native_app_window_gtk.h1
-rw-r--r--chrome/browser/ui/views/apps/native_app_window_views.cc21
-rw-r--r--chrome/browser/ui/views/apps/native_app_window_views.h7
-rw-r--r--chrome/browser/ui/views/apps/native_app_window_views_win.cc7
16 files changed, 42 insertions, 70 deletions
diff --git a/chrome/browser/extensions/api/app_window/app_window_api.cc b/chrome/browser/extensions/api/app_window/app_window_api.cc
index b709e6b..1bc4da4 100644
--- a/chrome/browser/extensions/api/app_window/app_window_api.cc
+++ b/chrome/browser/extensions/api/app_window/app_window_api.cc
@@ -14,7 +14,6 @@
#include "chrome/browser/app_mode/app_mode_utils.h"
#include "chrome/browser/devtools/devtools_window.h"
#include "chrome/browser/extensions/window_controller.h"
-#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/apps/chrome_shell_window_delegate.h"
#include "chrome/common/extensions/api/app_window.h"
#include "chrome/common/extensions/features/feature_channel.h"
diff --git a/chrome/browser/extensions/api/tabs/ash_panel_contents.cc b/chrome/browser/extensions/api/tabs/ash_panel_contents.cc
index b3f2891..408f29f 100644
--- a/chrome/browser/extensions/api/tabs/ash_panel_contents.cc
+++ b/chrome/browser/extensions/api/tabs/ash_panel_contents.cc
@@ -15,7 +15,6 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/sessions/session_tab_helper.h"
#include "chrome/common/extensions/extension_messages.h"
-#include "content/public/browser/browser_context.h"
#include "content/public/browser/site_instance.h"
#include "content/public/browser/web_contents.h"
#include "extensions/common/extension.h"
@@ -168,16 +167,15 @@ AshPanelContents::AshPanelContents(ShellWindow* host)
AshPanelContents::~AshPanelContents() {
}
-void AshPanelContents::Initialize(content::BrowserContext* context,
- const GURL& url) {
+void AshPanelContents::Initialize(Profile* profile, const GURL& url) {
url_ = url;
extension_function_dispatcher_.reset(
- new ExtensionFunctionDispatcher(context, this));
+ new ExtensionFunctionDispatcher(profile, this));
- web_contents_.reset(
- content::WebContents::Create(content::WebContents::CreateParams(
- context, content::SiteInstance::CreateForURL(context, url_))));
+ web_contents_.reset(content::WebContents::Create(
+ content::WebContents::CreateParams(
+ profile, content::SiteInstance::CreateForURL(profile, url_))));
// Needed to give the web contents a Window ID. Extension APIs expect web
// contents to have a Window ID. Also required for FaviconTabHelper to
@@ -197,8 +195,8 @@ void AshPanelContents::Initialize(content::BrowserContext* context,
void AshPanelContents::LoadContents(int32 creator_process_id) {
// This must be created after the native window has been created.
- window_controller_.reset(new AshPanelWindowController(
- host_, Profile::FromBrowserContext(host_->browser_context())));
+ window_controller_.reset(
+ new AshPanelWindowController(host_, host_->profile()));
web_contents_->GetController().LoadURL(
url_, content::Referrer(), content::PAGE_TRANSITION_LINK,
diff --git a/chrome/browser/extensions/api/tabs/ash_panel_contents.h b/chrome/browser/extensions/api/tabs/ash_panel_contents.h
index 021e6a6..0ccc9c9 100644
--- a/chrome/browser/extensions/api/tabs/ash_panel_contents.h
+++ b/chrome/browser/extensions/api/tabs/ash_panel_contents.h
@@ -39,8 +39,7 @@ class AshPanelContents : public apps::ShellWindowContents,
virtual ~AshPanelContents();
// apps::ShellWindowContents
- virtual void Initialize(content::BrowserContext* context,
- const GURL& url) OVERRIDE;
+ virtual void Initialize(Profile* profile, const GURL& url) OVERRIDE;
virtual void LoadContents(int32 creator_process_id) OVERRIDE;
virtual void NativeWindowChanged(apps::NativeAppWindow* native_app_window)
OVERRIDE;
diff --git a/chrome/browser/extensions/chrome_extensions_browser_client.cc b/chrome/browser/extensions/chrome_extensions_browser_client.cc
index d1e9f83..fa93a50 100644
--- a/chrome/browser/extensions/chrome_extensions_browser_client.cc
+++ b/chrome/browser/extensions/chrome_extensions_browser_client.cc
@@ -81,11 +81,6 @@ content::BrowserContext* ChromeExtensionsBrowserClient::GetOriginalContext(
return static_cast<Profile*>(context)->GetOriginalProfile();
}
-bool ChromeExtensionsBrowserClient::IsGuestSession(
- content::BrowserContext* context) {
- return static_cast<Profile*>(context)->IsGuestSession();
-}
-
bool ChromeExtensionsBrowserClient::IsExtensionIncognitoEnabled(
const std::string& extension_id,
content::BrowserContext* context) const {
diff --git a/chrome/browser/extensions/chrome_extensions_browser_client.h b/chrome/browser/extensions/chrome_extensions_browser_client.h
index d74c1cd..b89bef6 100644
--- a/chrome/browser/extensions/chrome_extensions_browser_client.h
+++ b/chrome/browser/extensions/chrome_extensions_browser_client.h
@@ -44,7 +44,6 @@ class ChromeExtensionsBrowserClient : public ExtensionsBrowserClient {
content::BrowserContext* context) OVERRIDE;
virtual content::BrowserContext* GetOriginalContext(
content::BrowserContext* context) OVERRIDE;
- virtual bool IsGuestSession(content::BrowserContext* context) OVERRIDE;
virtual bool IsExtensionIncognitoEnabled(
const std::string& extension_id,
content::BrowserContext* context) const OVERRIDE;
diff --git a/chrome/browser/ui/apps/chrome_shell_window_delegate.cc b/chrome/browser/ui/apps/chrome_shell_window_delegate.cc
index 30e83bd..4d12672 100644
--- a/chrome/browser/ui/apps/chrome_shell_window_delegate.cc
+++ b/chrome/browser/ui/apps/chrome_shell_window_delegate.cc
@@ -9,7 +9,6 @@
#include "chrome/browser/file_select_helper.h"
#include "chrome/browser/media/media_capture_devices_dispatcher.h"
#include "chrome/browser/platform_util.h"
-#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/shell_integration.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_dialogs.h"
@@ -17,7 +16,6 @@
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/scoped_tabbed_browser_displayer.h"
#include "chrome/common/render_messages.h"
-#include "content/public/browser/browser_context.h"
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_contents_view.h"
@@ -41,7 +39,7 @@ bool disable_external_open_for_testing_ = false;
// Opens a URL with Chromium (not external browser) with the right profile.
content::WebContents* OpenURLFromTabInternal(
- content::BrowserContext* context,
+ Profile* profile,
content::WebContents* source,
const content::OpenURLParams& params) {
// Force all links to open in a new tab, even if they were trying to open a
@@ -51,7 +49,7 @@ content::WebContents* OpenURLFromTabInternal(
new_tab_params.disposition = params.disposition == NEW_BACKGROUND_TAB
? params.disposition
: NEW_FOREGROUND_TAB;
- new_tab_params.initiating_profile = Profile::FromBrowserContext(context);
+ new_tab_params.initiating_profile = profile;
chrome::Navigate(&new_tab_params);
return new_tab_params.target_contents;
@@ -150,14 +148,14 @@ apps::NativeAppWindow* ChromeShellWindowDelegate::CreateNativeAppWindow(
}
content::WebContents* ChromeShellWindowDelegate::OpenURLFromTab(
- content::BrowserContext* context,
+ Profile* profile,
content::WebContents* source,
const content::OpenURLParams& params) {
- return OpenURLFromTabInternal(context, source, params);
+ return OpenURLFromTabInternal(profile, source, params);
}
void ChromeShellWindowDelegate::AddNewContents(
- content::BrowserContext* context,
+ Profile* profile,
content::WebContents* new_contents,
WindowOpenDisposition disposition,
const gfx::Rect& initial_pos,
@@ -170,7 +168,7 @@ void ChromeShellWindowDelegate::AddNewContents(
return;
}
chrome::ScopedTabbedBrowserDisplayer displayer(
- Profile::FromBrowserContext(context), chrome::GetActiveDesktop());
+ profile, chrome::GetActiveDesktop());
// Force all links to open in a new tab, even if they were trying to open a
// new window.
disposition =
diff --git a/chrome/browser/ui/apps/chrome_shell_window_delegate.h b/chrome/browser/ui/apps/chrome_shell_window_delegate.h
index 026e67c..1cd3fd7 100644
--- a/chrome/browser/ui/apps/chrome_shell_window_delegate.h
+++ b/chrome/browser/ui/apps/chrome_shell_window_delegate.h
@@ -7,15 +7,12 @@
#include "apps/shell_window.h"
#include "base/memory/scoped_ptr.h"
+#include "chrome/browser/profiles/profile.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_contents_delegate.h"
#include "ui/base/window_open_disposition.h"
#include "ui/gfx/rect.h"
-namespace content {
-class BrowserContext;
-}
-
class ShellWindowLinkDelegate : public content::WebContentsDelegate {
public:
ShellWindowLinkDelegate();
@@ -43,10 +40,10 @@ class ChromeShellWindowDelegate : public apps::ShellWindow::Delegate {
apps::ShellWindow* window,
const apps::ShellWindow::CreateParams& params) OVERRIDE;
virtual content::WebContents* OpenURLFromTab(
- content::BrowserContext* context,
+ Profile* profile,
content::WebContents* source,
const content::OpenURLParams& params) OVERRIDE;
- virtual void AddNewContents(content::BrowserContext* context,
+ virtual void AddNewContents(Profile* profile,
content::WebContents* new_contents,
WindowOpenDisposition disposition,
const gfx::Rect& initial_pos,
diff --git a/chrome/browser/ui/ash/launcher/multi_profile_shell_window_launcher_controller.cc b/chrome/browser/ui/ash/launcher/multi_profile_shell_window_launcher_controller.cc
index dd171f1..13280a9 100644
--- a/chrome/browser/ui/ash/launcher/multi_profile_shell_window_launcher_controller.cc
+++ b/chrome/browser/ui/ash/launcher/multi_profile_shell_window_launcher_controller.cc
@@ -43,18 +43,14 @@ void MultiProfileShellWindowLauncherController::ActiveUserChanged(
for (ShellWindowList::iterator it = shell_window_list_.begin();
it != shell_window_list_.end(); ++it) {
apps::ShellWindow* shell_window = *it;
- Profile* profile =
- Profile::FromBrowserContext(shell_window->browser_context());
- if (!multi_user_util::IsProfileFromActiveUser(profile) &&
+ if (!multi_user_util::IsProfileFromActiveUser(shell_window->profile()) &&
IsRegisteredApp(shell_window->GetNativeWindow()))
UnregisterApp(shell_window->GetNativeWindow());
}
for (ShellWindowList::iterator it = shell_window_list_.begin();
it != shell_window_list_.end(); ++it) {
apps::ShellWindow* shell_window = *it;
- Profile* profile =
- Profile::FromBrowserContext(shell_window->browser_context());
- if (multi_user_util::IsProfileFromActiveUser(profile) &&
+ if (multi_user_util::IsProfileFromActiveUser(shell_window->profile()) &&
!IsRegisteredApp(shell_window->GetNativeWindow()))
RegisterApp(*it);
}
@@ -73,9 +69,7 @@ void MultiProfileShellWindowLauncherController::OnShellWindowAdded(
if (!ControlsWindow(shell_window->GetNativeWindow()))
return;
shell_window_list_.push_back(shell_window);
- Profile* profile =
- Profile::FromBrowserContext(shell_window->browser_context());
- if (multi_user_util::IsProfileFromActiveUser(profile))
+ if (multi_user_util::IsProfileFromActiveUser(shell_window->profile()))
RegisterApp(shell_window);
}
diff --git a/chrome/browser/ui/cocoa/apps/native_app_window_cocoa.h b/chrome/browser/ui/cocoa/apps/native_app_window_cocoa.h
index b0f6775..b83f5fe 100644
--- a/chrome/browser/ui/cocoa/apps/native_app_window_cocoa.h
+++ b/chrome/browser/ui/cocoa/apps/native_app_window_cocoa.h
@@ -18,6 +18,7 @@
#include "ui/gfx/rect.h"
class ExtensionKeybindingRegistryCocoa;
+class Profile;
class NativeAppWindowCocoa;
@class ShellNSWindow;
class SkRegion;
diff --git a/chrome/browser/ui/cocoa/apps/native_app_window_cocoa.mm b/chrome/browser/ui/cocoa/apps/native_app_window_cocoa.mm
index 790cb5f..54dedd36 100644
--- a/chrome/browser/ui/cocoa/apps/native_app_window_cocoa.mm
+++ b/chrome/browser/ui/cocoa/apps/native_app_window_cocoa.mm
@@ -365,7 +365,7 @@ NativeAppWindowCocoa::NativeAppWindowCocoa(
UpdateWindowMinMaxSize();
extension_keybinding_registry_.reset(new ExtensionKeybindingRegistryCocoa(
- Profile::FromBrowserContext(shell_window_->browser_context()),
+ shell_window_->profile(),
window,
extensions::ExtensionKeybindingRegistry::PLATFORM_APPS_ONLY,
shell_window));
diff --git a/chrome/browser/ui/cocoa/apps/native_app_window_cocoa_browsertest.mm b/chrome/browser/ui/cocoa/apps/native_app_window_cocoa_browsertest.mm
index 35bbfad..13afc2e 100644
--- a/chrome/browser/ui/cocoa/apps/native_app_window_cocoa_browsertest.mm
+++ b/chrome/browser/ui/cocoa/apps/native_app_window_cocoa_browsertest.mm
@@ -30,11 +30,8 @@ class NativeAppWindowCocoaBrowserTest : public PlatformAppBrowserTest {
content::WindowedNotificationObserver app_loaded_observer(
content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME,
content::NotificationService::AllSources());
- OpenApplication(
- AppLaunchParams(profile(),
- app_,
- extensions::LAUNCH_CONTAINER_NONE,
- NEW_WINDOW));
+ OpenApplication(AppLaunchParams(
+ profile(), app_, extensions::LAUNCH_CONTAINER_NONE, NEW_WINDOW));
app_loaded_observer.Wait();
}
}
diff --git a/chrome/browser/ui/gtk/apps/native_app_window_gtk.cc b/chrome/browser/ui/gtk/apps/native_app_window_gtk.cc
index 9242e94..a35491f 100644
--- a/chrome/browser/ui/gtk/apps/native_app_window_gtk.cc
+++ b/chrome/browser/ui/gtk/apps/native_app_window_gtk.cc
@@ -146,7 +146,7 @@ NativeAppWindowGtk::NativeAppWindowGtk(ShellWindow* shell_window,
// Add the keybinding registry.
extension_keybinding_registry_.reset(new ExtensionKeybindingRegistryGtk(
- Profile::FromBrowserContext(shell_window_->browser_context()),
+ shell_window_->profile(),
window_,
extensions::ExtensionKeybindingRegistry::PLATFORM_APPS_ONLY,
shell_window_));
@@ -624,8 +624,7 @@ bool NativeAppWindowGtk::IsDetached() const {
}
void NativeAppWindowGtk::UpdateWindowIcon() {
- Profile* profile =
- Profile::FromBrowserContext(shell_window_->browser_context());
+ Profile* profile = shell_window_->profile();
gfx::Image app_icon = shell_window_->app_icon();
if (!app_icon.IsEmpty())
gtk_util::SetWindowIcon(window_, profile, app_icon.ToGdkPixbuf());
diff --git a/chrome/browser/ui/gtk/apps/native_app_window_gtk.h b/chrome/browser/ui/gtk/apps/native_app_window_gtk.h
index ac15a4e..2e6504f 100644
--- a/chrome/browser/ui/gtk/apps/native_app_window_gtk.h
+++ b/chrome/browser/ui/gtk/apps/native_app_window_gtk.h
@@ -20,6 +20,7 @@
#include "ui/gfx/x/x11_atom_cache.h"
class ExtensionKeybindingRegistryGtk;
+class Profile;
namespace extensions {
class Extension;
diff --git a/chrome/browser/ui/views/apps/native_app_window_views.cc b/chrome/browser/ui/views/apps/native_app_window_views.cc
index 6adc3a6..0d90452 100644
--- a/chrome/browser/ui/views/apps/native_app_window_views.cc
+++ b/chrome/browser/ui/views/apps/native_app_window_views.cc
@@ -266,11 +266,12 @@ void NativeAppWindowViews::Init(
} else {
InitializeDefaultWindow(create_params);
}
- extension_keybinding_registry_.reset(new ExtensionKeybindingRegistryViews(
- Profile::FromBrowserContext(browser_context()),
- window_->GetFocusManager(),
- extensions::ExtensionKeybindingRegistry::PLATFORM_APPS_ONLY,
- shell_window_));
+ extension_keybinding_registry_.reset(
+ new ExtensionKeybindingRegistryViews(
+ profile(),
+ window_->GetFocusManager(),
+ extensions::ExtensionKeybindingRegistry::PLATFORM_APPS_ONLY,
+ shell_window_));
OnViewWasResized();
window_->AddObserver(this);
@@ -361,15 +362,11 @@ void NativeAppWindowViews::InitializeDefaultWindow(
#if defined(OS_WIN)
base::string16 app_name_wide = base::UTF8ToWide(app_name);
HWND hwnd = GetNativeAppWindowHWND();
- ui::win::SetAppIdForWindow(
- ShellIntegration::GetAppModelIdForProfile(
- app_name_wide,
- Profile::FromBrowserContext(browser_context())->GetPath()),
- hwnd);
+ ui::win::SetAppIdForWindow(ShellIntegration::GetAppModelIdForProfile(
+ app_name_wide, profile()->GetPath()), hwnd);
web_app::UpdateShortcutInfoAndIconForApp(
- *extension(),
- Profile::FromBrowserContext(browser_context()),
+ *extension(), profile(),
base::Bind(&NativeAppWindowViews::OnShortcutInfoLoaded,
weak_ptr_factory_.GetWeakPtr()));
#endif
diff --git a/chrome/browser/ui/views/apps/native_app_window_views.h b/chrome/browser/ui/views/apps/native_app_window_views.h
index 4bd3fb6..9934fa0 100644
--- a/chrome/browser/ui/views/apps/native_app_window_views.h
+++ b/chrome/browser/ui/views/apps/native_app_window_views.h
@@ -29,13 +29,13 @@ class ImmersiveFullscreenController;
#endif
class ExtensionKeybindingRegistryViews;
+class Profile;
namespace apps {
class ShellWindowFrameView;
}
namespace content {
-class BrowserContext;
class RenderViewHost;
class WebContents;
}
@@ -76,10 +76,7 @@ class NativeAppWindowViews : public apps::NativeAppWindow,
virtual void Show() OVERRIDE;
virtual void Activate() OVERRIDE;
- content::BrowserContext* browser_context() {
- return shell_window_->browser_context();
- }
-
+ Profile* profile() { return shell_window_->profile(); }
const extensions::Extension* extension() {
return shell_window_->extension();
}
diff --git a/chrome/browser/ui/views/apps/native_app_window_views_win.cc b/chrome/browser/ui/views/apps/native_app_window_views_win.cc
index 21b7fbb..5bdf999 100644
--- a/chrome/browser/ui/views/apps/native_app_window_views_win.cc
+++ b/chrome/browser/ui/views/apps/native_app_window_views_win.cc
@@ -10,6 +10,7 @@
#include "chrome/browser/apps/per_app_settings_service.h"
#include "chrome/browser/apps/per_app_settings_service_factory.h"
#include "chrome/browser/metro_utils/metro_chrome_win.h"
+#include "chrome/browser/profiles/profile.h"
#include "extensions/common/extension.h"
#include "ui/aura/remote_root_window_host_win.h"
#include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h"
@@ -39,15 +40,15 @@ void NativeAppWindowViewsWin::OnBeforeWidgetInit(
// If an app has any existing windows, ensure new ones are created on the
// same desktop.
apps::ShellWindow* any_existing_window =
- apps::ShellWindowRegistry::Get(browser_context())
- ->GetCurrentShellWindowForApp(extension()->id());
+ apps::ShellWindowRegistry::Get(profile())->
+ GetCurrentShellWindowForApp(extension()->id());
chrome::HostDesktopType desktop_type;
if (any_existing_window) {
desktop_type = chrome::GetHostDesktopTypeForNativeWindow(
any_existing_window->GetNativeWindow());
} else {
PerAppSettingsService* settings =
- PerAppSettingsServiceFactory::GetForBrowserContext(browser_context());
+ PerAppSettingsServiceFactory::GetForBrowserContext(profile());
if (settings->HasDesktopLastLaunchedFrom(extension()->id())) {
desktop_type = settings->GetDesktopLastLaunchedFrom(extension()->id());
} else {