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

Unified Diff: chrome/browser/process_singleton_win.cc

Issue 10910311: If desktop chrome is launched via the New Window/the recently opened url shortcuts on the chrome sh… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 3 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 | « base/win/metro.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/process_singleton_win.cc
===================================================================
--- chrome/browser/process_singleton_win.cc (revision 156844)
+++ chrome/browser/process_singleton_win.cc (working copy)
@@ -5,6 +5,7 @@
#include "chrome/browser/process_singleton.h"
#include <shellapi.h>
+#include <shobjidl.h>
#include "base/base_paths.h"
#include "base/command_line.h"
@@ -14,10 +15,15 @@
#include "base/stringprintf.h"
#include "base/utf_string_conversions.h"
#include "base/win/metro.h"
+#include "base/win/scoped_com_initializer.h"
+#include "base/win/scoped_comptr.h"
#include "base/win/scoped_handle.h"
+#include "base/win/windows_version.h"
#include "base/win/wrapped_window_proc.h"
#include "chrome/browser/ui/simple_message_box.h"
#include "chrome/common/chrome_constants.h"
+#include "chrome/installer/util/browser_distribution.h"
+#include "chrome/installer/util/shell_util.h"
#include "chrome/installer/util/wmi.h"
#include "content/public/common/result_codes.h"
#include "grit/chromium_strings.h"
@@ -120,6 +126,39 @@
return false;
}
+bool ActivateMetroChrome() {
+ FilePath chrome_exe;
+ if (!PathService::Get(base::FILE_EXE, &chrome_exe)) {
+ NOTREACHED() << "Failed to get chrome exe path";
+ return false;
+ }
+ string16 app_id = ShellUtil::GetBrowserModelId(
+ BrowserDistribution::GetDistribution(), chrome_exe.value());
+ if (app_id.empty()) {
+ NOTREACHED() << "Failed to get chrome app user model id.";
+ return false;
+ }
+
+ base::win::ScopedComPtr<IApplicationActivationManager> activation_manager;
+ HRESULT hr = activation_manager.CreateInstance(
+ CLSID_ApplicationActivationManager);
+ if (!activation_manager) {
+ NOTREACHED() << "Failed to cocreate activation manager. Error: " << hr;
+ return false;
+ }
+
+ unsigned long pid = 0;
+ hr = activation_manager->ActivateApplication(app_id.c_str(),
+ L"open",
+ AO_NONE,
+ &pid);
+ if (FAILED(hr)) {
+ NOTREACHED() << "Failed to activate metro chrome. Error: " << hr;
+ return false;
+ }
+ return true;
+}
+
} // namespace
// Microsoft's Softricity virtualization breaks the sandbox processes.
@@ -310,6 +349,15 @@
remote_window_ = NULL;
return PROCESS_NONE;
}
+
+ base::win::ScopedHandle process_handle;
+ if (base::win::GetVersion() >= base::win::VERSION_WIN8 &&
+ base::OpenProcessHandleWithAccess(
+ process_id, PROCESS_QUERY_INFORMATION,
+ process_handle.Receive())) {
+ if (base::win::IsProcessImmersive(process_handle.Get()))
+ ActivateMetroChrome();
+ }
return PROCESS_NOTIFIED;
}
« no previous file with comments | « base/win/metro.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698