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

Side by Side Diff: chrome/browser/ui/metro_chrome_win.cc

Issue 14617003: Make chrome.exe rendezvous with existing chrome process earlier. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/metro_chrome_win.h ('k') | chrome/chrome.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/ui/metro_chrome_win.h"
6
7 #include <windows.h>
8 #include <shobjidl.h>
9
10 #include "base/files/file_path.h"
11 #include "base/path_service.h"
12 #include "base/win/scoped_com_initializer.h"
13 #include "base/win/scoped_comptr.h"
14 #include "chrome/installer/util/browser_distribution.h"
15 #include "chrome/installer/util/install_util.h"
16 #include "chrome/installer/util/shell_util.h"
17
18 namespace chrome {
19
20 bool ActivateMetroChrome() {
21 base::FilePath chrome_exe;
22 if (!PathService::Get(base::FILE_EXE, &chrome_exe)) {
23 NOTREACHED() << "Failed to get chrome exe path";
24 return false;
25 }
26
27 string16 app_id = ShellUtil::GetBrowserModelId(
28 BrowserDistribution::GetDistribution(),
29 InstallUtil::IsPerUserInstall(chrome_exe.value().c_str()));
30 if (app_id.empty()) {
31 NOTREACHED() << "Failed to get chrome app user model id.";
32 return false;
33 }
34
35 base::win::ScopedComPtr<IApplicationActivationManager> activation_manager;
36 HRESULT hr = activation_manager.CreateInstance(
37 CLSID_ApplicationActivationManager);
38 if (!activation_manager) {
39 NOTREACHED() << "Failed to cocreate activation manager. Error: " << hr;
40 return false;
41 }
42
43 unsigned long pid = 0;
44 hr = activation_manager->ActivateApplication(app_id.c_str(),
45 L"open",
46 AO_NONE,
47 &pid);
48 if (FAILED(hr)) {
49 NOTREACHED() << "Failed to activate metro chrome. Error: " << hr;
50 return false;
51 }
52
53 return true;
54 }
55
56 } // namespace chrome
OLDNEW
« no previous file with comments | « chrome/browser/ui/metro_chrome_win.h ('k') | chrome/chrome.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698