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

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

Issue 1581473002: Remove base/win/metro.{cc|h} and some associated code (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixes Created 4 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 unified diff | Download patch
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/metro_utils/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/metro.h"
13 #include "base/win/scoped_com_initializer.h"
14 #include "base/win/scoped_comptr.h"
15 #include "base/win/windows_version.h"
16 #include "chrome/installer/util/browser_distribution.h"
17 #include "chrome/installer/util/install_util.h"
18 #include "chrome/installer/util/shell_util.h"
19
20 namespace chrome {
21
22 bool ActivateMetroChrome() {
23 // TODO(cpu): For Win7 we need to activate differently.
24 if (base::win::GetVersion() < base::win::VERSION_WIN8)
25 return true;
26
27 base::FilePath chrome_exe;
28 if (!PathService::Get(base::FILE_EXE, &chrome_exe)) {
29 NOTREACHED() << "Failed to get chrome exe path";
30 return false;
31 }
32
33 base::string16 app_id =
34 ShellUtil::GetBrowserModelId(BrowserDistribution::GetDistribution(),
35 InstallUtil::IsPerUserInstall(chrome_exe));
36 if (app_id.empty()) {
37 NOTREACHED() << "Failed to get chrome app user model id.";
38 return false;
39 }
40
41 base::win::ScopedComPtr<IApplicationActivationManager> activation_manager;
42 HRESULT hr = activation_manager.CreateInstance(
43 CLSID_ApplicationActivationManager);
44 if (!activation_manager.get()) {
45 NOTREACHED() << "Failed to cocreate activation manager. Error: "
46 << std::showbase << std::hex << hr;
47 return false;
48 }
49
50 unsigned long pid = 0;
51 hr = activation_manager->ActivateApplication(app_id.c_str(),
52 L"open",
53 AO_NONE,
54 &pid);
55 if (FAILED(hr)) {
56 NOTREACHED() << "Failed to activate metro chrome. Error: "
57 << std::showbase << std::hex << hr;
58 return false;
59 }
60
61 return true;
62 }
63
64 Win8Environment GetWin8Environment(HostDesktopType desktop) {
65 if (desktop == chrome::HOST_DESKTOP_TYPE_ASH)
66 return WIN_8_ENVIRONMENT_METRO_AURA;
67 else
68 return WIN_8_ENVIRONMENT_DESKTOP_AURA;
69 }
70
71
72 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698