Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(44)

Unified Diff: chrome/browser/ui/views/apps/native_app_window_views_win.cc

Issue 111553008: Add PerAppSettingsService and use it to remember what desktop apps should create windows on. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: redirect PerAppSettingsService in incognito mode because component apps can run in incognito mode (… Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/startup/startup_browser_creator_impl.cc ('k') | chrome/chrome_browser_extensions.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 00ea974f9361824a022bea95fc680bf3a69b19a4..5bdf99938fd28f921e5deb0612d547902bc5703b 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
@@ -7,6 +7,8 @@
#include "apps/shell_window.h"
#include "apps/shell_window_registry.h"
#include "ash/shell.h"
+#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"
@@ -45,11 +47,15 @@ void NativeAppWindowViewsWin::OnBeforeWidgetInit(
desktop_type = chrome::GetHostDesktopTypeForNativeWindow(
any_existing_window->GetNativeWindow());
} else {
- // TODO(tapted): Ideally, when an OnLaunched event is dispatched from UI
- // and immediately results in window creation, |desktop_type| here should
- // match that UI. However, there is no guarantee that an app will create
- // a window in its OnLaunched event handler, so linking these up is hard.
- desktop_type = chrome::GetActiveDesktop();
+ PerAppSettingsService* settings =
+ PerAppSettingsServiceFactory::GetForBrowserContext(profile());
+ 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.
+ desktop_type = chrome::GetActiveDesktop();
+ }
}
if (desktop_type == chrome::HOST_DESKTOP_TYPE_ASH)
init_params->context = ash::Shell::GetPrimaryRootWindow();
« no previous file with comments | « chrome/browser/ui/startup/startup_browser_creator_impl.cc ('k') | chrome/chrome_browser_extensions.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698