| Index: chrome/browser/ui/views/apps/native_app_window_views_win.cc
|
| 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 3a4221ac1aac3cb8f87d131530841cae3504eb06..4d106bef617b62666bc6f2eda20fa0f9d92aeb91 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
|
| @@ -63,11 +63,11 @@ void CreateIconAndSetRelaunchDetails(
|
|
|
| } // namespace
|
|
|
| -NativeAppWindowViewsWin::NativeAppWindowViewsWin()
|
| +ChromeNativeAppWindowViewsWin::ChromeNativeAppWindowViewsWin()
|
| : weak_ptr_factory_(this) {
|
| }
|
|
|
| -void NativeAppWindowViewsWin::ActivateParentDesktopIfNecessary() {
|
| +void ChromeNativeAppWindowViewsWin::ActivateParentDesktopIfNecessary() {
|
| if (!ash::Shell::HasInstance())
|
| return;
|
|
|
| @@ -84,7 +84,7 @@ void NativeAppWindowViewsWin::ActivateParentDesktopIfNecessary() {
|
| }
|
| }
|
|
|
| -void NativeAppWindowViewsWin::OnShortcutInfoLoaded(
|
| +void ChromeNativeAppWindowViewsWin::OnShortcutInfoLoaded(
|
| const ShellIntegration::ShortcutInfo& shortcut_info) {
|
| DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
|
|
|
| @@ -105,26 +105,28 @@ void NativeAppWindowViewsWin::OnShortcutInfoLoaded(
|
| web_app_path, icon_file, shortcut_info, hwnd));
|
| }
|
|
|
| -HWND NativeAppWindowViewsWin::GetNativeAppWindowHWND() const {
|
| +HWND ChromeNativeAppWindowViewsWin::GetNativeAppWindowHWND() const {
|
| return views::HWNDForWidget(window()->GetTopLevelWidget());
|
| }
|
|
|
| -void NativeAppWindowViewsWin::OnBeforeWidgetInit(
|
| +void ChromeNativeAppWindowViewsWin::OnBeforeWidgetInit(
|
| views::Widget::InitParams* init_params, views::Widget* widget) {
|
| + content::BrowserContext* browser_context = app_window()->browser_context();
|
| + const extensions::Extension* extension = app_window()->extension();
|
| // If an app has any existing windows, ensure new ones are created on the
|
| // same desktop.
|
| apps::AppWindow* any_existing_window =
|
| - apps::AppWindowRegistry::Get(browser_context())
|
| - ->GetCurrentAppWindowForApp(extension()->id());
|
| + apps::AppWindowRegistry::Get(browser_context)
|
| + ->GetCurrentAppWindowForApp(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());
|
| - if (settings->HasDesktopLastLaunchedFrom(extension()->id())) {
|
| - desktop_type = settings->GetDesktopLastLaunchedFrom(extension()->id());
|
| + PerAppSettingsServiceFactory::GetForBrowserContext(browser_context);
|
| + if (settings->HasDesktopLastLaunchedFrom(extension->id())) {
|
| + desktop_type = settings->GetDesktopLastLaunchedFrom(extension->id());
|
| } else {
|
| // We don't know what desktop this app was last launched from, so take our
|
| // best guess as to what desktop the user is on.
|
| @@ -137,33 +139,36 @@ void NativeAppWindowViewsWin::OnBeforeWidgetInit(
|
| init_params->native_widget = new views::DesktopNativeWidgetAura(widget);
|
| }
|
|
|
| -void NativeAppWindowViewsWin::InitializeDefaultWindow(
|
| +void ChromeNativeAppWindowViewsWin::InitializeDefaultWindow(
|
| const apps::AppWindow::CreateParams& create_params) {
|
| - NativeAppWindowViews::InitializeDefaultWindow(create_params);
|
| + ChromeNativeAppWindowViews::InitializeDefaultWindow(create_params);
|
|
|
| + const extensions::Extension* extension = app_window()->extension();
|
| std::string app_name =
|
| - web_app::GenerateApplicationNameFromExtensionId(extension()->id());
|
| + web_app::GenerateApplicationNameFromExtensionId(extension->id());
|
| base::string16 app_name_wide = base::UTF8ToWide(app_name);
|
| HWND hwnd = GetNativeAppWindowHWND();
|
| + Profile* profile =
|
| + Profile::FromBrowserContext(app_window()->browser_context());
|
| ui::win::SetAppIdForWindow(
|
| ShellIntegration::GetAppModelIdForProfile(
|
| app_name_wide,
|
| - Profile::FromBrowserContext(browser_context())->GetPath()),
|
| + profile->GetPath()),
|
| hwnd);
|
|
|
| web_app::UpdateShortcutInfoAndIconForApp(
|
| - *extension(),
|
| - Profile::FromBrowserContext(browser_context()),
|
| - base::Bind(&NativeAppWindowViewsWin::OnShortcutInfoLoaded,
|
| + *extension,
|
| + profile,
|
| + base::Bind(&ChromeNativeAppWindowViewsWin::OnShortcutInfoLoaded,
|
| weak_ptr_factory_.GetWeakPtr()));
|
| }
|
|
|
| -void NativeAppWindowViewsWin::Show() {
|
| +void ChromeNativeAppWindowViewsWin::Show() {
|
| ActivateParentDesktopIfNecessary();
|
| - NativeAppWindowViews::Show();
|
| + ChromeNativeAppWindowViews::Show();
|
| }
|
|
|
| -void NativeAppWindowViewsWin::Activate() {
|
| +void ChromeNativeAppWindowViewsWin::Activate() {
|
| ActivateParentDesktopIfNecessary();
|
| - NativeAppWindowViews::Activate();
|
| + ChromeNativeAppWindowViews::Activate();
|
| }
|
|
|