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

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
« base/win/metro.h ('K') | « 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,14 @@
#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/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 +125,41 @@
return false;
}
+bool ActivateMetroChrome() {
+ base::win::ScopedCOMInitializer com_init;
cpu_(ooo_6.6-7.5) 2012/09/17 20:39:06 we are trying to limit the com initialization to o
ananta 2012/09/17 22:16:31 Removed
+
+ 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 +350,14 @@
remote_window_ = NULL;
return PROCESS_NONE;
}
+
cpu_(ooo_6.6-7.5) 2012/09/17 20:39:06 check for win8 or bigger here, that is less expens
ananta 2012/09/17 22:16:31 Done.
+ base::win::ScopedHandle process_handle;
+ if (base::OpenProcessHandleWithAccess(
+ process_id, PROCESS_QUERY_INFORMATION,
+ process_handle.Receive())) {
+ if (base::win::IsImmersiveProcess(process_handle.Get()))
+ ActivateMetroChrome();
+ }
return PROCESS_NOTIFIED;
}
« base/win/metro.h ('K') | « base/win/metro.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698